-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
65 lines (59 loc) · 1.94 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
import React from 'react';
import { StyleSheet, Text, View, Alert } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import { Notifications } from 'expo';
// import store from './store';
import WelcomeScreen from './screens/WelcomeScreen';
import AuthScreen from './screens/AuthScreen';
import { MainBottonTab } from './navigation';
import Screen from './components/Screen';
import configurationStore from './store';
import registerForNotifications from './services/pushNotifications';
export default function App() {
registerForNotifications();
Notifications.addListener((notification) => {
const text = notification.data.text;
const origin = notification.origin;
if (origin === 'received' && text) {
Alert.alert(
'New Push Notification',
text,
[{ text: 'Ok.' }]
)
}
});
const Tab = createBottomTabNavigator();
const { persistor, store } = configurationStore();
return (
<Provider store={store}>
<PersistGate persistor={persistor}>
<Screen>
<NavigationContainer>
<Tab.Navigator >
<Tab.Screen name="Welcome" component={WelcomeScreen} options={{
tabBarVisible: false
}} />
<Tab.Screen name="Auth" component={AuthScreen} options={{
tabBarVisible: false
}} />
<Tab.Screen name="Main" component={MainBottonTab} options={{
tabBarVisible: false
}} />
</Tab.Navigator>
</NavigationContainer >
</Screen>
</PersistGate>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});