Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

useNativeDriver with PanResponder

Tags:

react-native

I was trying to move all things that I could to useNativeDriver. I tried this:

onPanResponderMove: Animated.event([null, { dy:this.state.appearAnim }], { useNativeDriver:true }),

However this causes the error of:

config.onPanResponderMove is not a function

If I just set useNativeDriver to false, it works as per expectations. Does anyone have any idea on how to use native driver with PanResponder?

like image 728
Noitidart Avatar asked Jul 28 '17 01:07

Noitidart


1 Answers

I quote from the react-native github repository:

PanResponder can't work with Animated.event([], {useNativeDriver: true});

This is a current limitation of native Animated.event. It doesn't work with PanResponder because it is implemented in JavaScript. You can have a look at https://github.com/wix/react-native-interactable which can handle gestures with native animated values.

Looks like it is currently not possible to useNativeDriver with the PanResponder in react native.

like image 172
Klemens159 Avatar answered Nov 04 '22 14:11

Klemens159