Inconsistent behavior of onGestureEvent
See original GitHub issueHi, thanks for this nice library.
I have the following code:
this.translateX = new Animated.Value(0);
this.onGestureEvent = Animated.event(
[{ nativeEvent: { translationX: this.translateX } }],
{ useNativeDriver: true },
);
this.translateX.addListener(({ value }) => console.log(value));
<PanGestureHandler onGestureEvent={this.onGestureEvent}>...</PanGestureHandler>
On iOS, after loading the application, the console will be empty (the listener not triggered, as expected).
On Android, we’ll see the initial value of Animated.Value
(0 in this case, i.e. the listener triggered off).
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Does onGestureEvent of TapGestureHandler never fire?
Keep in mind that onGestureEvent is only generated in continuous gesture handlers and shouldn't be used in the TapGestureHandler and other ...
Read more >content/public/test/browser_test_utils.cc - chromium/src
RegisterThrottleForTesting has this behavior. class TestNavigationManagerThrottle : public NavigationThrottle {. public: ... get into an inconsistent state.
Read more >react-native-gesture-handler - Bountysource
Hi ! I have a little issue on Android, onGestureEvent is not trigger when GestureHandler components is on a modal on Android. When...
Read more >browser_view.cc - Chromium Code Search
Widget::IsActive is inconsistent between Mac and Aura, so don't check for ... Manually clear focus before setting focus behavior so that the focus....
Read more >react-native-gesture-handler: Versions - Openbase
Adjust Swipeable's overshootFriction behavior (#1275) by @kolking ... [WEB] Fix x/y for PanGestureHandler onGestureEvent by @awinograd (#799) ...
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
@luutruong in your case I bet that the reason was that the inner child of
GestureHandler
component was not anAnimated.View
. When you want to useAnimated.event
for event handlers you need to make sure that the child of the gesture-handler component isAnimated.View
(orAnimated.Image
etc) as opposed to it just being aView
or sthI tried the repro @jakub-gonet provided and with some help of @kmagiera I was able to reproduce the exact same issue with
Animated.ScrollView
the issue is not coming from the Gesture Handler but React Native Animated library.Because of that I’m closing the issue.
Below example that I used to repro that 😄