Skip to content

Commit

Permalink
Merge pull request #2049 from negativetwelve/docs/animated-input-events
Browse files Browse the repository at this point in the history
[Docs] Fix Animated example for onScroll and onPanResponderMove to match paragraph description
  • Loading branch information
sahrens committed Jul 20, 2015
2 parents fc23d0c + f3dd075 commit e3afc4e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/Animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
handler), and `pan.x` maps to `gestureState.dx` (`gestureState` is the second
arg passed to the `PanResponder` handler).
handler), and `pan.x` and `pan.y` map to `gestureState.dx` and `gestureState.dy`,
respectively (`gestureState` is the second arg passed to the `PanResponder` handler).

```javascript
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([
null, // ignore the native event
Expand Down

0 comments on commit e3afc4e

Please sign in to comment.