-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
52 lines (42 loc) · 1.4 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
//import thư viện
import React from "react";
import { Alert } from 'react-native';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import createSagaMiddleware from 'redux-saga';
//import file
import allReducers from './src/redux/reducers/index';
import rootSaga from './src/redux/middleware/saga/rootSaga';
import AppContainer from "./src/containers/App"
import messaging from '@react-native-firebase/messaging';
const sagaMiddleware = createSagaMiddleware();
let store = createStore(allReducers, applyMiddleware(sagaMiddleware));
export default class Root extends React.Component {
componentDidMount() {
messaging().onNotificationOpenedApp(remoteMessage => {
console.log(
'Notification caused app to open from background state:',
remoteMessage.notification,
);
});
messaging().getInitialNotification()
.then(remoteMessage => {
if (remoteMessage) {
console.log(
'Notification caused app to open from quit statexxx:',
remoteMessage,
remoteMessage.notification.body,
);
}
});
// messaging().onMessage(async remoteMessage => {
// console.log('A new FCM message arrived!', JSON.stringify(remoteMessage));
// });
}
render() {
return<Provider store = { store }>
< AppContainer />
</Provider >;
}
}
sagaMiddleware.run(rootSaga);