diff options
author | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-15 22:39:47 -0700 |
---|---|---|
committer | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-15 22:39:47 -0700 |
commit | 8071ae313d7ad94bd051ba95a96b72f543576292 (patch) | |
tree | f26488f777316273916d5b878753e9947acc5132 /src/view/screens/CustomFeed.tsx | |
parent | c4a666c2210c2e9c14812ddc5a0f797dd538014c (diff) | |
download | voidsky-8071ae313d7ad94bd051ba95a96b72f543576292.tar.zst |
like/unlike improvements WIP
Diffstat (limited to 'src/view/screens/CustomFeed.tsx')
-rw-r--r-- | src/view/screens/CustomFeed.tsx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/view/screens/CustomFeed.tsx b/src/view/screens/CustomFeed.tsx index 070db8c07..be6261ac2 100644 --- a/src/view/screens/CustomFeed.tsx +++ b/src/view/screens/CustomFeed.tsx @@ -1,6 +1,6 @@ import {NativeStackScreenProps} from '@react-navigation/native-stack' import {usePalette} from 'lib/hooks/usePalette' -import {HeartIcon} from 'lib/icons' +import {HeartIcon, HeartIconSolid} from 'lib/icons' import {CommonNavigatorParams} from 'lib/routes/types' import {colors, s} from 'lib/styles' import {observer} from 'mobx-react-lite' @@ -74,13 +74,21 @@ export const CustomFeed = withAuthRequired( <TouchableOpacity accessibilityRole="button" onPress={() => { - currentFeed?.like() + if (currentFeed?.isLiked) { + currentFeed?.unlike() + } else { + currentFeed?.like() + } }} style={[styles.likeButton]}> <Text style={[pal.text, s.semiBold]}> {currentFeed?.data.likeCount} </Text> - <HeartIcon strokeWidth={3} size={18} style={styles.liked} /> + {currentFeed?.isLiked ? ( + <HeartIconSolid size={18} style={styles.liked} /> + ) : ( + <HeartIcon strokeWidth={3} size={18} style={styles.liked} /> + )} </TouchableOpacity> </View> </View> |