GestureHandler already initialized for root view
Hi there,
I'm basically trying to replicate native driver example from docs:
const PanAndRotate = () => (
<PanGestureHandler onGestureEvent={Animated.event({ ... }, { useNativeDriver: true })}>
<Animated.View>
<RotationGestureHandler onGestureEvent={Animated.event({ ... }, { useNativeDriver: true })}>
<Animated.View style={animatedStyles}/>
</RotationGestureHandler>
</Animated.View>
</PanGestureHandler>
);
and get this error. Maybe I'm missing something, is there any working samples with native driver and Animated.Views? Without native driver seems it's working for me, but I wish to get more animation performance.
@zinoviev, would you mind give us a wider context of this issue? Where do insert PanAndRotate component?
I have that admit that this issue provided me to notice a bug in Example App (https://github.com/kmagiera/react-native-gesture-handler/pull/176)
If you want to see how it should work, you may checkout on this branch (or wait, it gonna be merged soon) and see "Scale, rotate & tilt" Thank you for this issue. Please let me know if you still face the problem
@osdnk Hi, I follow exactly this sample and after some time realize it doesn't use the native driver(as you did in #176) I change it and got an error about nesting handler. Try to wrap in animated.view and got an error "GestureHandler already initialized for root view"
I will provide snack or self-contained example a little bit later. Also will be nice to have a hint in console warning about Animated.View using option with native driver nested handlers, I can guess it will frequently issue.
Yes, thank you for you suggestion. I think you're right. Link to example I mentioned above is related to already fixed example.
@osdnk Seems I did something stupid yesterday. Today I put <Animated.View /> wrapper in between handler and didn't notice any errors. So I get my ludicrous fast 60 fps animations! Thanks for the assistance and shoutout to all project team. Your work MUST be merged into RN core!
@zinoviev, Thank you :)