-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
57 lines (48 loc) · 1.35 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
import React, { useState } from "react";
import * as Font from "expo-font";
import { AppLoading } from "expo";
import { createStore, combineReducers, applyMiddleware } from "redux";
import { Provider } from "react-redux";
import { composeWithDevTools } from "redux-devtools-extension";
import ReduxThunk from "redux-thunk"; // allow to make async request to Firebase
import PlacesNavigator from "./navigation/PlacesNavigator";
import placeReducer from "./store/placeReducer";
import { init } from "./db/db";
init()
.then(() => {
console.log("Inititalized database");
})
.catch((err) => {
console.log("Initializing db failed.");
console.log(err);
});
const rootReducer = combineReducers({
places: placeReducer,
});
const store = createStore(
rootReducer,
applyMiddleware(ReduxThunk),
composeWithDevTools()
);
const fetchFonts = () => {
return Font.loadAsync({
"montserrat-bold": require("./assets/fonts/Montserrat-Bold.ttf"),
"montserrat-regular": require("./assets/fonts/Montserrat-Regular.ttf"),
});
};
export default function App() {
const [fontLoaded, setFontLoaded] = useState(false);
if (!fontLoaded) {
return (
<AppLoading
startAsync={fetchFonts}
onFinish={() => setFontLoaded(true)}
/>
);
}
return (
<Provider store={store}>
<PlacesNavigator />
</Provider>
);
}