-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
40 lines (37 loc) · 979 Bytes
/
main.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
import Expo from 'expo';
import React from 'react';
import { Navigator } from 'react-native';
import { Font } from 'expo';
import Login from './components/Login'
class App extends React.Component {
constructor(props){
super(props);
this.state = {
fontLoaded:false
}
}
async componentDidMount() {
await Font.loadAsync({
'raleway': require('./assets/fonts/Raleway-Regular.ttf'),
});
this.setState({ fontLoaded: true });
}
renderScene(route, navigator) {
let Component = route.component;
return <Component navigator={navigator} route={route} data={route.passProps}/>;
}
render() {
if(this.state.fontLoaded)
return (
<Navigator
style={{flex: 1}}
initialRoute={{component:Login}}
renderScene={this.renderScene}
configureScene={(route, routeStack) =>
Navigator.SceneConfigs.PushFromRight} />
);
else
return null;
}
}
Expo.registerRootComponent(App);