Merge pull request #2049 from negativetwelve/docs/animated-input-events

[Docs] Fix Animated example for onScroll and onPanResponderMove to match paragraph description
This commit is contained in:
Spencer Ahrens 2015-07-20 19:25:23 +02:00
commit e3afc4efd8
1 changed files with 3 additions and 3 deletions

View File

@ -205,12 +205,12 @@ map syntax so that values can be extracted from complex event objects. The
first level is an array to allow mapping across multiple args, and that array first level is an array to allow mapping across multiple args, and that array
contains nested objects. In the example, you can see that `scrollX` maps to contains nested objects. In the example, you can see that `scrollX` maps to
`event.nativeEvent.contentOffset.x` (`event` is normally the first arg to the `event.nativeEvent.contentOffset.x` (`event` is normally the first arg to the
handler), and `pan.x` maps to `gestureState.dx` (`gestureState` is the second handler), and `pan.x` and `pan.y` map to `gestureState.dx` and `gestureState.dy`,
arg passed to the `PanResponder` handler). respectively (`gestureState` is the second arg passed to the `PanResponder` handler).
```javascript ```javascript
onScroll={Animated.event( onScroll={Animated.event(
[{nativeEvent: {contentOffset: {y: pan.y}}}] // pan.y = e.nativeEvent.contentOffset.y [{nativeEvent: {contentOffset: {x: scrollX}}}] // scrollX = e.nativeEvent.contentOffset.x
)} )}
onPanResponderMove={Animated.event([ onPanResponderMove={Animated.event([
null, // ignore the native event null, // ignore the native event