diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/moments/MomentPostHeader.tsx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index 56b073d6..9abf7fce 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -30,21 +30,21 @@ const MomentPostHeader: React.FC<MomentPostHeaderProps> = ({ }) => { const [drawerVisible, setDrawerVisible] = useState(false); const dispatch = useDispatch(); + const navigation = useNavigation(); const {userId: loggedInUserId, username: loggedInUserName} = useSelector( (state: RootState) => state.user.user, ); const isOwnProfile = loggedInUserName === username; + const navigateToProfile = () => { + navigation.navigate('Profile', { + userXId: isOwnProfile ? undefined : userXId, + screenType, + }); + }; return ( <View style={[styles.container, style]}> - <TouchableOpacity - onPress={() => { - navigation.navigate('Profile', { - userXId: isOwnProfile ? undefined : userXId, - screenType, - }); - }} - style={styles.header}> + <TouchableOpacity onPress={navigateToProfile} style={styles.header}> <Avatar style={styles.avatar} userXId={userXId} |