aboutsummaryrefslogtreecommitdiff
path: root/src/routes/Routes.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/Routes.tsx')
-rw-r--r--src/routes/Routes.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/routes/Routes.tsx b/src/routes/Routes.tsx
index 38a987f7..a14f1576 100644
--- a/src/routes/Routes.tsx
+++ b/src/routes/Routes.tsx
@@ -5,6 +5,8 @@ import {useSelector, useDispatch} from 'react-redux';
import {RootState} from '../store/rootReducer';
import {userLogin} from '../utils';
import SplashScreen from 'react-native-splash-screen';
+import messaging from '@react-native-firebase/messaging';
+import {updateNewNotificationReceived} from '../store/actions';
const Routes: React.FC = () => {
const {
@@ -24,7 +26,12 @@ const Routes: React.FC = () => {
* SplashScreen is the actual react-native's splash screen.
* We can hide / show it depending on our application needs.
*/
+
useEffect(() => {
+ messaging().onMessage(() => {
+ dispatch(updateNewNotificationReceived(true));
+ });
+
if (!userId) {
userLogin(dispatch, {userId: '', username: ''});
} else {