-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
41 lines (36 loc) · 1.07 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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import AppNavigator from './src/navigators/AppNavigator';
import { createStore, applyMiddleware } from 'redux'
import { Provider } from 'react-redux';
import reducers from './src/reducers/index';
import thunk from 'redux-thunk';
import { composeWithDevTools } from 'redux-devtools-extension';
import FCM, {FCMEvent, RemoteNotificationResult, WillPresentNotificationResult, NotificationType} from 'react-native-fcm';
const store = createStore(
reducers,
composeWithDevTools(
applyMiddleware(thunk)
)
);
export default class App extends React.Component {
componentDidMount() {
FCM.getFCMToken().then(token => {
console.log(token)
// store fcm token in your server
});
this.notificationListener = FCM.on(FCMEvent.Notification, (notif) => {
console.log(notif)
});
}
componentWillUnmount() {
this.notificationListener.remove();
}
render() {
return (
<Provider store ={store}>
<AppNavigator/>
</Provider>
);
}
}