-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
85 lines (69 loc) · 2.05 KB
/
App.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//modules
import React, {Component} from 'react';
import {View} from 'react-native';
import {createStackNavigator, createAppContainer} from 'react-navigation';
//redux
import store from './src/redux/store/store';
import {Provider} from 'react-redux';
import * as Font from 'expo-font';
//components
import ScannerContainer from './src/components/Scanner/ScannerContainer';
import ResultsContainer from './src/components/Results/ResultContainer';
import FormContainer from './src/components/Form/FormContainer';
import {
headerRightButton,
headerBackButton,
headerTitle
} from './src/components/NavigationHeader/NavigationHeader';
//styling
import AppStyles from './src/globals/styles/AppStyle';
//set up navigation
let RootStack = createStackNavigator ({
ScannerScreen: {
screen: ScannerContainer,
},
ResultsScreen: {
screen: ResultsContainer,
navigationOptions: {
headerTitle: headerTitle("Results")
}
},
FormScreen: {
screen: FormContainer,
}}, //end screen config
//start navigator config
{
initialRouteName: "ScannerScreen",
defaultNavigationOptions: {
headerStyle: AppStyles.headerStyle,
headerRight: headerRightButton(),
headerBackTitle: null,
headerBackImage: headerBackButton()
}
}
);
let Navigator = createAppContainer(RootStack);
export default class App extends Component {
//MARK: init
constructor(props){
super(props);
this.state = {
fontsLoaded: false,
}
}
async componentDidMount() {
await Font.loadAsync({
"Raleway-Extra-Bold": require("./assets/Raleway-ExtraBold.ttf"),
"Raleway-Regular": require('./assets/Raleway-Regular.ttf')
});
this.setState({fontsLoaded : true});
}
render() {
return (
<Provider store={store}>
{this.state.fontsLoaded ? <Navigator /> :
<View />}
</Provider>
)
}
}