aboutsummaryrefslogtreecommitdiff
path: root/src/components/notifications/Notification.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/notifications/Notification.tsx')
-rw-r--r--src/components/notifications/Notification.tsx42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx
index f6a04526..184e3f27 100644
--- a/src/components/notifications/Notification.tsx
+++ b/src/components/notifications/Notification.tsx
@@ -1,9 +1,22 @@
import {useNavigation} from '@react-navigation/native';
import React, {useEffect, useState} from 'react';
-import {Image, StyleSheet, Text, View} from 'react-native';
+import {
+ ActivityIndicatorBase,
+ Alert,
+ Image,
+ StyleSheet,
+ Text,
+ View,
+} from 'react-native';
import {TouchableWithoutFeedback} from 'react-native-gesture-handler';
-import {useDispatch, useStore} from 'react-redux';
+import {useDispatch, useSelector, useStore} from 'react-redux';
+import {MomentCommentsScreen} from '../../screens';
import {loadAvatar} from '../../services';
+import {
+ EMPTY_MOMENTS_LIST,
+ EMPTY_MOMENT_CATEGORIES,
+} from '../../store/initialStates';
+import {userSocialsReducer} from '../../store/reducers';
import {RootState} from '../../store/rootReducer';
import {NotificationType, ScreenType} from '../../types';
import {
@@ -15,6 +28,7 @@ import {
interface NotificationProps {
item: NotificationType;
+ userXId: string | undefined;
screenType: ScreenType;
}
@@ -27,11 +41,16 @@ const Notification: React.FC<NotificationProps> = (props) => {
notification_object,
unread,
},
+ userXId,
screenType,
} = props;
const navigation = useNavigation();
const state: RootState = useStore().getState();
const dispatch = useDispatch();
+ const {moments: loggedInUserMoments} =
+ notification_type === 'CMT'
+ ? useSelector((state: RootState) => state.moments)
+ : {moments: undefined};
const [avatarURI, setAvatarURI] = useState<string | undefined>(undefined);
const [momentURI, setMomentURI] = useState<string | undefined>(undefined);
@@ -81,6 +100,25 @@ const Notification: React.FC<NotificationProps> = (props) => {
screenType,
});
break;
+ case 'CMT':
+ // find the moment we need to display
+ const moment = loggedInUserMoments?.find(
+ (m) => m.moment_id === notification_object?.moment_id,
+ );
+ if (moment) {
+ navigation.push('IndividualMoment', {
+ moment,
+ userXId,
+ screenType,
+ });
+ setTimeout(() => {
+ navigation.push('MomentCommentsScreen', {
+ moment_id: moment.moment_id,
+ screenType,
+ });
+ }, 500);
+ }
+ break;
default:
break;
}