-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
51 lines (46 loc) · 1.41 KB
/
App.js
File metadata and controls
51 lines (46 loc) · 1.41 KB
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
import 'react-native-gesture-handler';
import React from 'react';
import AsyncStorage from '@react-native-community/async-storage';
import SwitchNavigator from './screens/SwitchNavigator';
import {createStore, applyMiddleware} from 'redux';
import {Provider} from 'react-redux';
import rootReducer from './reducers';
import rootSaga from './sagas';
import createSagaMiddleware from 'redux-saga';
import {composeWithDevTools} from 'redux-devtools-extension';
import {NavigationContainer} from '@react-navigation/native';
import {setLoginState} from './reducers/authentication';
import {setCustomText} from 'react-native-global-props';
export default App = () => {
const sagaMiddleware = createSagaMiddleware();
const store = createStore(
rootReducer,
composeWithDevTools(applyMiddleware(sagaMiddleware)),
);
const loadToken = async () => {
try {
const user = await AsyncStorage.getItem('authorization');
if (!user) {
return; //로그인 상태아니면 아무것도 안하도록
}
store.dispatch(setLoginState(true));
} catch (error) {
console.log(error);
}
};
sagaMiddleware.run(rootSaga);
loadToken();
const customTextProps = {
style: {
fontFamily: 'AntDesign',
},
};
setCustomText(customTextProps);
return (
<Provider store={store}>
<NavigationContainer>
<SwitchNavigator />
</NavigationContainer>
</Provider>
);
};