React-native-gesture-handler: Crash when using Animated.event on onGestureEvent

Created on 1 Jun 2018  路  8Comments  路  Source: software-mansion/react-native-gesture-handler

I have made reproduction repo of the problem here: https://github.com/henrikra/gesture-handler-crash/blob/master/App.js

I am using PanGestureHandler as my gesture handler. Then I want to add function for onGestureEvent just like in the docs example: https://kmagiera.github.io/react-native-gesture-handler/docs/handler-pan.html#example
But if I do what the docs say and add Animated.event and swipe my view it will crash with this error:
image

But if I make the function by myself like in my repo it works. So something weird is going on here 馃

Most helpful comment

@henrikra
I did try to take o a look and this issue and you might consider as a very temporary workaround to use Animated.View instead of View.

All 8 comments

Same issue here. If I set useNativeDriver:false, it works well.

@ATShiTou that is true but I want to use it because then the animation is smooth :)

I know, why does the example work well? The DraggableBox

Another consequence of the fact that events are hooked into the children node is that when using useNativeDriver flag with Animated.event the children node needs to be a view wrapped by Animated.API e.g. instead of a :

@henrikra
I did try to take o a look and this issue and you might consider as a very temporary workaround to use Animated.View instead of View.

@ATShiTou If that's true then is this documentation accurate?

https://kmagiera.github.io/react-native-gesture-handler/docs/handler-pan.html

That snippet at the bottom is using the native driver with a direct child of View, not Animated.View.

I'm getting that error, but in my case it happens when I wrapper a commom <View> inside a <TapGestureHandler>. However if i wrapper a <Animated.View> inside a <TapGestureHandler> the component works fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brunolemos picture brunolemos  路  3Comments

rt2zz picture rt2zz  路  4Comments

jacobrosenskold picture jacobrosenskold  路  3Comments

enahum picture enahum  路  4Comments

brunolemos picture brunolemos  路  3Comments