-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
86 lines (76 loc) · 2 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
85
86
import React from "react";
import { StatusBar } from "react-native";
import { createStackNavigator } from "react-navigation";
import { Font, AppLoading } from "expo";
import edo from "./assets/fonts/edo.ttf";
import { createStore } from "redux";
import { composeWithDevTools } from "redux-devtools-extension";
import { reducer } from "./reducer";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import { persistStore, persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
const persistConfig = {
key: "root",
storage
};
const persistedReducer = persistReducer(persistConfig, reducer);
const store = createStore(persistedReducer, composeWithDevTools());
const persistor = persistStore(store);
import HomeScreen from "./containers/HomeScreen";
import DetailsScreen from "./containers/DetailsScreen";
import LoginScreen from "./containers/LoginScreen";
const RootStack = createStackNavigator(
{
Home: HomeScreen,
Details: DetailsScreen,
Login: LoginScreen
},
{
initialRouteName: "Login",
navigationOptions: {
headerStyle: {
backgroundColor: "#A61414"
},
headerTintColor: "white",
headerTitleStyle: {
fontFamily: "edo",
fontSize: 22
}
}
}
);
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isReady: false
};
}
async _loadFonts() {
return await Font.loadAsync({
edo
});
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
startAsync={this._loadFonts}
onFinish={() => {
this.setState({ isReady: true });
}}
onError={console.warn}
/>
);
}
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<StatusBar barStyle="light-content" />
<RootStack />
</PersistGate>
</Provider>
);
}
}