-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.jsx
50 lines (41 loc) · 1.3 KB
/
App.jsx
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
import React, { useState } from "react";
import * as Font from "expo-font";
import { AppLoading } from "expo";
import { enableScreens } from "react-native-screens";
import { createStore, combineReducers, applyMiddleware } from "redux";
import { Provider } from "react-redux";
import ReduxThunk from "redux-thunk";
import spotReducer from "./store/reducers/spotReducer";
import { init } from "./helpers/db";
import PlacesNavigator from "./navigation/PlacesNavigator";
enableScreens(true);
const fetchFonts = () => {
return Font.loadAsync({
poppins: require("./assets/fonts/Poppins-Regular.ttf"),
poppinsLight: require("./assets/fonts/Poppins-Light.ttf"),
poppinsBold: require("./assets/fonts/Poppins-Bold.ttf"),
});
};
const rootReducer = combineReducers({
spots: spotReducer,
});
const store = createStore(rootReducer, applyMiddleware(ReduxThunk));
init()
.then(() => {
console.log("Initialized Database");
})
.catch((err) => {
console.log("Initializing database failed");
console.log(err);
});
export default function App() {
const [FontLoaded, setFontLoaded] = useState(false);
if (!FontLoaded) {
return <AppLoading startAsync={fetchFonts} onFinish={() => setFontLoaded(true)} />;
}
return (
<Provider store={store}>
<PlacesNavigator />
</Provider>
);
}