-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
92 lines (88 loc) · 3.12 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
87
88
89
90
91
92
import 'react-native-gesture-handler';
import React, { useState } from 'react';
//Redux
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import ReduxThunk from 'redux-thunk';
import { composeWithDevTools } from 'redux-devtools-extension';
//Reducer
import {
authReducer,
cartReducer,
favoriteReducer,
orderReducer,
productReducer,
} from './src/reducers';
//Navigator
import { AppNavigator } from './src/navigation';
import AppLoading from 'expo-app-loading';
import { Asset } from 'expo-asset';
import * as Font from 'expo-font';
//redux form
import { reducer as formReducer } from 'redux-form';
import { StatusBar } from 'expo-status-bar';
//Notification
import LocalNotication from './src/components/Notification/LocalNotification';
const rootReducer = combineReducers({
store: productReducer,
cart: cartReducer,
order: orderReducer,
auth: authReducer,
fav: favoriteReducer,
form: formReducer,
});
const store = createStore(rootReducer, composeWithDevTools(applyMiddleware(ReduxThunk)));
const LoadAssets = async () => {
const imageAssets = Asset.loadAsync([
require('./src/assets/Images/banner1.jpg'),
require('./src/assets/Images/banner3.jpg'),
require('./src/assets/Images/banner4.jpg'),
require('./src/assets/Images/banner5.jpg'),
require('./src/assets/Images/banner6.jpg'),
require('./src/assets/Images/bg1.jpg'),
require('./src/assets/Images/bg2.jpg'),
require('./src/assets/Images/bg3.jpg'),
require('./src/assets/Images/defaultprofile.jpg'),
require('./src/assets/Images/flower3.jpg'),
require('./src/assets/Images/logoNoText.png'),
require('./src/assets/Images/logo1.png'),
require('./src/assets/Images/logoTextWhite.png'),
require('./src/assets/Images/slide1.png'),
require('./src/assets/Images/slide2.png'),
require('./src/assets/Images/slide3.png'),
require('./src/assets/Images/social1.png'),
require('./src/assets/Images/social2.png'),
require('./src/assets/Images/social3.png'),
require('./src/assets/Images/creditcards.png'),
require('./src/assets/Images/faceid.png'),
]);
const fetchFonts = Font.loadAsync({
'Roboto-Bold': require('./src/assets/Fonts/Roboto-Bold.ttf'),
'Roboto-BoldItalic': require('./src/assets/Fonts/Roboto-BoldItalic.ttf'),
'Roboto-Italic': require('./src/assets/Fonts/Roboto-Italic.ttf'),
'Roboto-LightItalic': require('./src/assets/Fonts/Roboto-LightItalic.ttf'),
'Roboto-Medium': require('./src/assets/Fonts/Roboto-Medium.ttf'),
'Roboto-MediumItalic': require('./src/assets/Fonts/Roboto-MediumItalic.ttf'),
'Roboto-Regular': require('./src/assets/Fonts/Roboto-Regular.ttf'),
});
return await Promise.all([imageAssets, fetchFonts]);
};
export default function App() {
const [assetLoaded, setAssetLoaded] = useState(false);
if (!assetLoaded) {
return (
<AppLoading
startAsync={LoadAssets}
onFinish={() => setAssetLoaded(true)}
onError={console.warn}
/>
);
}
return (
<Provider store={store}>
<StatusBar />
<LocalNotication />
<AppNavigator />
</Provider>
);
}