-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
40 lines (32 loc) · 1.11 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
import React, { useCallback, useEffect } from "react";
import { NavigationContainer } from "@react-navigation/native";
import { RootNavigator } from "./src/navigation/RootNavigator";
import { createStore, applyMiddleware, compose } from "redux";
import { Provider } from "react-redux";
import promiseMiddleware from "redux-promise";
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
import reducers from "./src/store/reducers";
import messaging from "@react-native-firebase/messaging";
import pushNoti from "./src/utils/pushNoti";
const createStoreWithMiddleware = createStore(
reducers,
composeEnhancers(applyMiddleware(promiseMiddleware)),
);
export default function App() {
const foregroundListener = useCallback(() => {
messaging().onMessage(async message => {
console.log(message);
pushNoti.displayNoti(message);
});
}, []);
useEffect(() => {
foregroundListener();
}, []);
return (
<Provider store={createStoreWithMiddleware}>
<NavigationContainer>
<RootNavigator></RootNavigator>
</NavigationContainer>
</Provider>
);
}