Can I use the native animation driver to track a pan gesture?

Viewed 870

The React-Native Animated docs show this example as a way to make an Animated.Value (_panX) track a pan gesture:

onPanResponderMove: Animated.event([
   null,                // raw event arg ignored
   {dx: this._panX},    // gestureState arg
]),

Likewise, the Animated.event docs say I can pass a second config parameter, with:

useNativeDriver: Uses the native driver when true. Default false.

Unfortunately, doing this appears to be broken:

onPanResponderMove: Animated.event(..., { useNativeDriver: true });

In particular, because PanResponder.create has a onResponderMove function that does:

if (config.onPanResponderMove) {
  config.onPanResponderMove(e, gestureState);
}

Which causes an error, when it treats config.onPanResponderMove as a function, when it's actually an object...

Am I doing something wrong? Or is useNativeDriver not supported when making Animated.Value track a gesture? Would be nice to have something seamlessly track the mouse like that...

0 Answers
Related