Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly show how to add the optional listener #15576

Closed
wants to merge 6 commits into from

Conversation

geirman
Copy link
Contributor

@geirman geirman commented Aug 20, 2017

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

(Write your motivation here.)

Test Plan

(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!)

The previous example only showed where to add the optional "listener" but didn't show how to make use of it.
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Aug 20, 2017
@pull-bot
Copy link

pull-bot commented Aug 20, 2017

@facebook-github-bot label Core Team

Generated by 🚫 dangerJS

@@ -2857,7 +2857,7 @@ module.exports = {
*```javascript
* onScroll={Animated.event(
* [{nativeEvent: {contentOffset: {x: this._scrollX}}}],
* {listener}, // Optional async listener
* {listener: (event, gestureState) => console.log(gestureState)}, // Optional async listener
Copy link
Contributor

@janicduplessis janicduplessis Aug 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this looks like an onScroll event from ScrollView I think we should not add the gestureState param, might be more confusing than anything else. Maybe just (event) => console.log(event)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust your opinion, but gestureState is passed along as the second param... so isn't it better to document it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even for ScrollView onScroll? I thought it was only for PanResponder events.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, maybe I should move the example to onPanResponderMove... or add another?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure lets just change to onPanResponderMove instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done! I left the example for onScroll too. Can only help, right?

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Sep 26, 2017
@facebook-github-bot
Copy link
Contributor

@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants