简体   繁体   中英

useNativeDriver with PanResponder

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM