explicitly show how to add the optional listener

Summary:
The previous example only showed where to add the optional "listener" but didn't show how to make use of it.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

(Write your motivation here.)

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Closes https://github.com/facebook/react-native/pull/15576

Differential Revision: D5911716

Pulled By: shergin

fbshipit-source-id: 60023470d23c2cbbde47ab9aa82c7ecef73be467
This commit is contained in:
Chris Geirman 2017-09-26 10:19:39 -07:00 committed by Facebook Github Bot
parent 6f6329d5e3
commit e3a6be5d37
1 changed files with 2 additions and 1 deletions

View File

@ -839,12 +839,13 @@ module.exports = {
*```javascript
* onScroll={Animated.event(
* [{nativeEvent: {contentOffset: {x: this._scrollX}}}],
* {listener}, // Optional async listener
* {listener: (event) => console.log(event)}, // Optional async listener
* )}
* ...
* onPanResponderMove: Animated.event([
* null, // raw event arg ignored
* {dx: this._panX}, // gestureState arg
{listener: (event, gestureState) => console.log(event, gestureState)}, // Optional async listener
* ]),
*```
*