-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApp.js
More file actions
39 lines (35 loc) · 1.17 KB
/
App.js
File metadata and controls
39 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React, { useState } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import AppNavigator from './navigation/AppNavigator';
import * as Font from 'expo-font';
import AppLoading from 'expo-app-loading'; // For loading fonts
const loadFonts = async () => {
try {
await Font.loadAsync({
'Inter-Regular': require('./assets/fonts/Inter-Regular.ttf'),
'Inter-Bold': require('./assets/fonts/Inter-Bold.ttf'),
'Inter-Light': require('./assets/fonts/Inter-Light.ttf'),
'Inter-Medium': require('./assets/fonts/Inter-Medium.ttf'),
'Inter-SemiBold': require('./assets/fonts/Inter-SemiBold.ttf'),
});
} catch (error) {
console.error('Font loading failed:', error); // Log the error for debugging
}
};
export default function App() {
const [fontsLoaded, setFontsLoaded] = useState(false);
if (!fontsLoaded) {
return (
<AppLoading
startAsync={loadFonts}
onFinish={() => setFontsLoaded(true)}
onError={(err) => console.warn('AppLoading Error:', err)} // Log AppLoading issues
/>
);
}
return (
<NavigationContainer>
<AppNavigator />
</NavigationContainer>
);
}