-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
66 lines (62 loc) · 1.91 KB
/
App.tsx
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
import WebchatModal from '@src/components/webchatModal';
import Navigator from '@src/routes/navigator';
import {store} from '@src/utils/redux/store';
import * as React from 'react';
import FlashMessage from 'react-native-flash-message';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {Provider} from 'react-redux';
import useRequest from '@src/hooks/apiHook';
import constants from './src/constant/api';
import Toast, {BaseToast, ErrorToast} from 'react-native-toast-message';
import {View, Text} from 'react-native';
import {ChatModalProps} from 'rn-sestek-webchat';
export default function App() {
const toastConfig = {
success: (props: any) => (
<BaseToast
{...props}
style={{borderLeftColor: 'pink'}}
contentContainerStyle={{paddingHorizontal: 15}}
text1Style={{
fontSize: 15,
fontWeight: '400',
}}
/>
),
error: (props: any) => (
<ErrorToast
{...props}
text1Style={{
fontSize: 17,
}}
text2Style={{
fontSize: 15,
}}
/>
),
tomatoToast: ({text1, props}) => (
<View style={{height: 60, width: '100%', backgroundColor: 'tomato'}}>
<Text>{text1}</Text>
<Text>{props.uuid}</Text>
</View>
),
};
const {getRequestToken} = useRequest();
React.useEffect(() => {
getRequestToken(constants.apiUrl, constants.requestData);
}, []);
const modalRef = React.useRef<ChatModalProps>(null);
return (
<GestureHandlerRootView style={{flex: 1}}>
<FlashMessage position="top" />
<SafeAreaProvider>
<Provider store={store}>
<WebchatModal modalRef={modalRef} />
<Navigator modalRef={modalRef} />
<Toast config={toastConfig} />
</Provider>
</SafeAreaProvider>
</GestureHandlerRootView>
);
}