11import React , { PropsWithChildren , useCallback , useEffect , useRef } from 'react' ;
2- import { StyleSheet } from 'react-native' ;
2+ import { Alert , StyleSheet , View } from 'react-native' ;
33
4+ import { Pressable } from 'react-native-gesture-handler' ;
45import Animated , {
56 Extrapolation ,
67 SharedValue ,
@@ -18,6 +19,7 @@ import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRe
1819
1920const ACTION_WIDTH = 80 ;
2021const DEFAULT_RIGHT_ACTIONS_WIDTH = ACTION_WIDTH * 2 ;
22+ const AnimatedPressable = Animated . createAnimatedComponent ( Pressable ) ;
2123
2224const animationOptions = {
2325 damping : 24 ,
@@ -43,8 +45,18 @@ const DefaultRightActions = ({ translation }: { translation: SharedValue<number>
4345
4446 return (
4547 < Animated . View style = { styles . rightActionsContainer } >
46- < Animated . View style = { [ styles . action , styles . redAction , animatedActionWidthStyle ] } />
47- < Animated . View style = { [ styles . action , styles . blueAction , animatedActionWidthStyle ] } />
48+ < AnimatedPressable
49+ onPress = { ( ) => Alert . alert ( 'Red pressed' ) }
50+ style = { [ styles . action , animatedActionWidthStyle ] }
51+ >
52+ < View style = { { flex : 1 , backgroundColor : 'red' } } />
53+ </ AnimatedPressable >
54+ < AnimatedPressable
55+ onPress = { ( ) => Alert . alert ( 'Blue pressed' ) }
56+ style = { [ styles . action , animatedActionWidthStyle ] }
57+ >
58+ < View style = { { flex : 1 , backgroundColor : 'blue' } } />
59+ </ AnimatedPressable >
4860 </ Animated . View >
4961 ) ;
5062} ;
0 commit comments