@@ -5,14 +5,13 @@ import Animated, {
55 withSequence ,
66 withTiming ,
77} from "react-native-reanimated" ;
8- import { Pressable } from "react-native-gesture-handler" ;
8+ import { GestureDetector , Gesture } from "react-native-gesture-handler" ;
99
1010import { theme } from "@/theme" ;
1111import { Session } from "@/types" ;
1212import { useBookmark } from "@/hooks/useBookmark" ;
1313import { SymbolView } from "expo-symbols" ;
14-
15- const AnimatedPressable = Animated . createAnimatedComponent ( Pressable ) ;
14+ import { StyleSheet } from "react-native" ;
1615
1716export function BaseBookmark ( {
1817 session,
@@ -36,24 +35,39 @@ export function BaseBookmark({
3635 await toggleBookmark ( session ) ;
3736 } ;
3837
38+ const tapGesture = Gesture . Tap ( )
39+ . onStart ( ( ) => {
40+ handlePress ( ) ;
41+ } )
42+ . runOnJS ( true ) ;
43+
3944 const bookmarked = isBookmarked ( session . id ) ;
4045 const bookmarkColor = bookmarked
4146 ? theme . color . reactBlue . light
4247 : theme . colorGrey ;
4348
4449 return (
45- < AnimatedPressable hitSlop = { 20 } onPress = { handlePress } style = { animatedStyle } >
46- < SymbolView
47- name = { bookmarked ? "bookmark.fill" : "bookmark" }
48- tintColor = { bookmarkColor }
49- fallback = {
50- < MaterialCommunityIcons
51- name = { bookmarked ? "bookmark" : "bookmark-outline" }
52- size = { theme . fontSize28 }
53- color = { bookmarkColor }
54- />
55- }
56- />
57- </ AnimatedPressable >
50+ < GestureDetector gesture = { tapGesture } >
51+ < Animated . View style = { [ styles . container , animatedStyle ] } >
52+ < SymbolView
53+ name = { bookmarked ? "bookmark.fill" : "bookmark" }
54+ tintColor = { bookmarkColor }
55+ fallback = {
56+ < MaterialCommunityIcons
57+ name = { bookmarked ? "bookmark" : "bookmark-outline" }
58+ size = { theme . fontSize28 }
59+ color = { bookmarkColor }
60+ />
61+ }
62+ />
63+ </ Animated . View >
64+ </ GestureDetector >
5865 ) ;
5966}
67+
68+ const styles = StyleSheet . create ( {
69+ container : {
70+ margin : - theme . space8 ,
71+ padding : theme . space8 ,
72+ } ,
73+ } ) ;
0 commit comments