简体   繁体   English

useNativeDriver with PanResponder

[英]useNativeDriver with PanResponder

I was trying to move all things that I could to useNativeDriver . 我试图移动所有我可以使用的东西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 config.onPanResponderMove不是一个函数

If I just set useNativeDriver to false , it works as per expectations. 如果我只是将useNativeDriver设置为false ,它可以按照预期工作。 Does anyone have any idea on how to use native driver with PanResponder? 有没有人知道如何使用本地驱动程序与PanResponder?

I quote from the react-native github repository: 我引用react-native github存储库:

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

This is a current limitation of native Animated.event. 这是本机Animated.event的当前限制。 It doesn't work with PanResponder because it is implemented in JavaScript. 它不适用于PanResponder,因为它是用JavaScript实现的。 You can have a look at https://github.com/wix/react-native-interactable which can handle gestures with native animated values. 您可以查看https://github.com/wix/react-native-interactable ,它可以处理具有原生动画值的手势。

Looks like it is currently not possible to useNativeDriver with the PanResponder in react native. 看起来目前无法使用响应原生的PanResponder的NativeDriver。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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