Pass an anonymous function to onPanResponderMove
<p>I have a javascript issue and I'm not sure how to resolve it.</p>

<p>In my React Native application, I have a panResponder and I'm using this hook to call Animated.event.</p>

<pre><code>this.panResponder = PanResponder.create({
    /* ... some other methods ... */
    onPanResponderMove: Animated.event([null, { dx: this.state.x, dy: this.state.y }]),
});
</code></pre>

<p>Although, I would like the hook to be an anonymous function instead, to be able to do some other things. I tried a few different way to use an anonymous function instead but I can't make it to work. </p>

<pre><code>this.panResponder = PanResponder.create({
    /* ... some other methods ... */
    onPanResponderMove: (event, gestureState) =&gt; {
        this.callSomething(); 
        return Animated.event([null, { /* I'm not sure what to pass here to map with gestureState... */ }]);
    },
});
</code></pre>

<p>I've read the documentation but even with that I still don't know.</p>

<p>Can you help me out?</p>

<p>Thanks.</p>

<p><strong>Update:</strong></p>

<p>I've finally did something like that:</p>

<pre><code>let valueY;
this.panResponder = PanResponder.create({
    /* ... some other methods ... */
    onPanResponderGrant: () =&gt; {
        valueY = this.state.y._value;
    },
    onPanResponderMove: (event, gestureState) =&gt; {
        this.callSomething();
        let panY = valueY + gestureState.dy;
        this.state.y.setValue({ y: panY });
    },
});
</code></pre>

<p>I don't think that's the best way to do it though...</p>