Hi, what is the hide function? I only have AppLoading (from expo-app-loading) that shows before the fonts load.
This is my main App.js:
import React from "react";
import AppLoading from 'expo-app-loading';
import * as Font from 'expo-font';
import {Ionicons} from '@expo/vector-icons';
import AppNavigator from "./navigations";
import * as Notifications from 'expo-notifications';
import * as Permissions from 'expo-permissions';
import Constants from 'expo-constants';
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: false,
}),
});
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isReady: false,
token: '',
};
}
async componentDidMount() {
await this.registerForPushNotificationAsync();
await Font.loadAsync({
Roboto: require('native-base/Fonts/Roboto.ttf'),
Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
...Ionicons.font,
});
this.setState({ isReady: true });
}
async registerForPushNotificationAsync () {
let token;
if (Constants.isDevice) {
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
finalStatus = status;
}
if (finalStatus !== 'granted') {
alert('Failed to get push token for push notification!');
return;
}
token = (await Notifications.getExpoPushTokenAsync()).data;
console.log(token);
} else {
alert('Must use physical device for Push Notifications');
}
if (Platform.OS === 'android') {
Notifications.setNotificationChannelAsync('default', {
name: 'default',
importance: Notifications.AndroidImportance.MAX,
vibrationPattern: [0, 250, 250, 250],
lightColor: '#FF231F7C',
});
}
return token;
}
render() {
if (!this.state.isReady) {
return <AppLoading />;
}
return (
<AppNavigator />
);
}
}