diff options
author | ankit-thanekar007 <ankit.thanekar007@gmail.com> | 2021-03-22 12:25:39 -0700 |
---|---|---|
committer | ankit-thanekar007 <ankit.thanekar007@gmail.com> | 2021-03-23 12:06:01 -0700 |
commit | b2c3242021348274fc518a7e716dc9e0d6d1586d (patch) | |
tree | 48db197e79fb38793297d7ef570a80c4fa52f967 /src | |
parent | 0187200d794d54c1d9954dd86a6a156132dedcac (diff) |
TMA 642 Refactoring
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} |