-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.jsx
64 lines (56 loc) · 1.61 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, {useEffect} from 'react';
import {NavigationContainer, DefaultTheme} from '@react-navigation/native';
import {Provider, useDispatch, useSelector} from 'react-redux';
import Toast, {ErrorToast, SuccessToast} from 'react-native-toast-message';
import {StatusBar} from 'react-native';
import SplashScreen from 'react-native-splash-screen';
// components
import BottomTab from './src/navigation/BottomTab';
import Store from './src/redux/Store';
import {fetchRecentTransactions} from './src/redux/slice/RecentTransactionSlice';
// cd ./android && ./gradlew clean && cd .. && npm run android
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: '#ffffff',
},
};
const toastConfig = {
success: props => (
<SuccessToast
{...props}
contentContainerStyle={{paddingHorizontal: 20}}
text1NumberOfLines={2}
text1Style={{fontSize: 14}}
text2Style={{fontSize: 13}}
/>
),
error: props => (
<ErrorToast
{...props}
contentContainerStyle={{paddingHorizontal: 20}}
text1NumberOfLines={2}
text1Style={{fontSize: 14}}
text2Style={{fontSize: 13}}
/>
),
};
const App = () => {
const dispatch = useDispatch();
const {status} = useSelector(state => state.transactions);
useEffect(() => {
SplashScreen.hide();
if (status === 'idle') dispatch(fetchRecentTransactions());
}, []);
return (
<>
<StatusBar backgroundColor={'#42224a'} />
<NavigationContainer theme={theme}>
<BottomTab />
</NavigationContainer>
<Toast config={toastConfig} />
</>
);
};
export default App;