Using Animated.event with TapGestureHandler onHandlerStateChange doesn't work
See original GitHub issueThis is usage with react-native-reanimated.
I get this error:
Expected `onGestureHandlerStateChange` listener to be a function, instead got a value of `object` type.
Example:
const tapState = new Animated.Value(0);
const tapStateEvent = Animated.event([{ nativeEvent: { state: tapState } }]);
// ...
<TapGestureHandler onHandlerStateChange={tapStateEvent}>{...}</TapGestureHandler>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:6
Top Results From Across the Web
TapGestureHandler not triggering onHandlerStateChange
I have a onHandlerStateChange event in TapGestureHandler . When the onHandlerStateChange is triggered, i want to change the opacity of a ...
Read more >Using Animated.event with TapGestureHandler ...
Using Animated.event with TapGestureHandler onHandlerStateChange doesn't work ... This is usage with react-native-reanimated . I get this error:
Read more >About Gesture Handlers | React Native ... - Software Mansion
Gesture handler components do not instantiate a native view in the view hierarchy. ... two gesture handlers using Animated.event is not currently supported....
Read more >Animated - React Native
The Animated library is designed to make animations fluid, powerful, and painless to build and maintain. Animated focuses on declarative ...
Read more >React Native Gesture Handler: Swipe, long-press, and more
dont 't forget to import Animated from react native ... Single-tap gesture with TapGestureHandler using React Native Gesture Handler.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

For future reference I was able to solve my problem by having the GestureHandler’s immediate child changed to a reanimated
Animated.ViewIn the event that using
Animated.Viewdoes not fix this issue, double-check your imports. I was mistakenly importingAnimatedfrom react-native instead of react-native-reanimated.