-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
124 lines (118 loc) · 2.96 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//import liraries
import {NavigationContainer} from '@react-navigation/native';
import React, {Component} from 'react';
import {View, Text, StyleSheet} from 'react-native';
import {Provider} from 'react-redux';
import AppView from './src/StudentModule/AppView';
import Splash from './src/StudentModule/Splash/Splash';
import {store} from './src/redux/store';
import Toast, {BaseToast, ErrorToast} from 'react-native-toast-message';
import {fonts} from './src/styles';
import AntDesign from 'react-native-vector-icons/AntDesign';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
const toastConfig = {
success: props => (
<BaseToast
{...props}
style={{borderLeftColor: '#69C779'}}
text1Style={{
fontSize: 12,
fontFamily: fonts.primarySemiBold,
marginLeft: -10,
}}
text1NumberOfLines={3}
text2Style={{
fontSize: 12,
fontFamily: fonts.primarySemiBold,
marginLeft: -10,
}}
autoHide={false}
onPress={() => Toast.hide()}
renderLeadingIcon={() => (
<AntDesign
style={[styles.toastIconStyles, {color: '#69C779', paddingLeft: 10}]}
name={'checkcircleo'}
/>
)}
renderTrailingIcon={() => (
<MaterialIcons
style={[styles.toastIconStyles, {color: '#FE6301', paddingRight: 10}]}
name={'cancel'}
/>
)}
/>
),
error: props => (
<ErrorToast
{...props}
text1Style={{
fontSize: 12,
fontFamily: fonts.primarySemiBold,
marginLeft: -10,
}}
text1NumberOfLines={3}
text2Style={{
fontSize: 12,
fontFamily: fonts.primarySemiBold,
marginLeft: -10,
}}
autoHide={false}
onPress={() => Toast.hide()}
renderLeadingIcon={() => (
<AntDesign
style={[styles.toastIconStyles, {color: '#FE6301', paddingLeft: 10}]}
name={'warning'}
/>
)}
renderTrailingIcon={() => (
<MaterialIcons
style={[styles.toastIconStyles, {color: '#FE6301', paddingRight: 10}]}
name={'cancel'}
/>
)}
/>
),
};
// create a component
class App extends Component {
constructor(props) {
super(props);
}
state = {
appReady: false,
restartAllowed: true,
};
componentDidMount() {
setTimeout(() => {
this.setState({appReady: true});
}, 2000);
}
render() {
if (!this.state.appReady) {
return <Splash />;
}
return (
<Provider store={store}>
<NavigationContainer>
<AppView />
</NavigationContainer>
<Toast config={toastConfig} />
</Provider>
);
}
}
// define your styles
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
},
toastIconStyles: {
fontSize: 24,
alignSelf: 'center',
},
});
//make this component available to the app
export default App;