aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-01 15:43:22 -0400
committerGitHub <noreply@github.com>2021-07-01 15:43:22 -0400
commitde390ea6b0f3bfd851029cf038aacd11f269a823 (patch)
tree9f8b0a26a78f791f5a5c38390c8a5043a4c24606 /src/components
parent7046c2673c54ecf2f418a85fbcfc2c4872858697 (diff)
parent5caf2c7584c9fd79715eb36bc7017b54393f00c3 (diff)
Merge pull request #484 from grusuTagg/tma950-BUGFIX-Video-Notification-Crash
[TMA-950] BUGFIX Video Notification Crash
Diffstat (limited to 'src/components')
-rw-r--r--src/components/moments/MomentPost.tsx39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index f5a256d6..319542f9 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -1,5 +1,5 @@
import {useNavigation} from '@react-navigation/native';
-import React, {useContext, useEffect, useRef, useState} from 'react';
+import React, {useContext, useEffect, useMemo, useRef, useState} from 'react';
import {
Image,
KeyboardAvoidingView,
@@ -173,22 +173,25 @@ const MomentPost: React.FC<MomentPostProps> = ({
}
}, [currentVisibleMomentId]);
- const MomentPosterPreview = () => (
- <View style={styles.momentPosterContainer}>
- <TouchableOpacity
- onPress={() =>
- navigateToProfile(state, dispatch, navigation, screenType, user)
- }
- style={styles.header}>
- <TaggAvatar
- style={styles.avatar}
- userXId={userXId}
- screenType={screenType}
- editable={false}
- />
- <Text style={styles.headerText}>{user.username}</Text>
- </TouchableOpacity>
- </View>
+ const momentPosterPreview = useMemo(
+ () => (
+ <View style={styles.momentPosterContainer}>
+ <TouchableOpacity
+ onPress={() =>
+ navigateToProfile(state, dispatch, navigation, screenType, user)
+ }
+ style={styles.header}>
+ <TaggAvatar
+ style={styles.avatar}
+ userXId={userXId}
+ screenType={screenType}
+ editable={false}
+ />
+ <Text style={styles.headerText}>{user.username}</Text>
+ </TouchableOpacity>
+ </View>
+ ),
+ [user.username],
);
return (
@@ -284,7 +287,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
screenType={screenType}
/>
</View>
- <MomentPosterPreview />
+ {momentPosterPreview}
{!hideText && (
<>
{moment.caption !== '' &&