-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (55 loc) · 1.99 KB
/
index.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import 'react-native-gesture-handler';
import React from 'react';
import {registerRootComponent} from 'expo';
//navigation packages
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
//screens
import SplashScreen from './screens/SplashScreen';
import LoginScreen from './screens/LoginScreen';
import HomeScreen from './screens/HomeScreen';
import PreferenceScreen from './screens/PreferenceScreen';
import TransactionsScreen from './screens/TransactionsScreen';
//Load Fonts/Icons
import * as Font from 'expo-font';
import Roboto from 'native-base/Fonts/Roboto.ttf';
import Roboto_medium from 'native-base/Fonts/Roboto_medium.ttf';
import {Ionicons} from '@expo/vector-icons';
//splash delay
import AppLoading from 'expo-app-loading';
//create navigaton root
const Stack = createStackNavigator();
class App extends React.Component{
constructor(props){
super(props);
//App state
this.state = {
//state to delay mounting till fonts are loaded
fontsLoaded: false
}
}
async componentDidMount(){
//Load Fonts
await Font.loadAsync({
Roboto,
Roboto_medium,
...Ionicons.font,
});
this.setState({fontsLoaded:true});//load app
}
render(){
return !this.state.fontsLoaded ?
<AppLoading/> : (
<NavigationContainer>
<Stack.Navigator screenOptions={{headerShown:false}}>
<Stack.Screen name="Splash" component={SplashScreen} />
<Stack.Screen name="Login" component={LoginScreen}/>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Preferences" component={PreferenceScreen}/>
<Stack.Screen name="Transactions" component={TransactionsScreen}/>
</Stack.Navigator>
</NavigationContainer>
)
}
}
registerRootComponent(App)