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

[Docs] Fix Animated example for onScroll and onPanResponderMove to match paragraph description #2049

Merged
merged 1 commit into from Jul 20, 2015

Conversation

negativetwelve
Copy link
Contributor

I was going through the animated documentation and noticed that the example for the Input Events didn't match the variables in the paragraph above. Simple fix.

cc @sahrens

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jul 20, 2015
@brentvatne
Copy link
Collaborator

@negativetwelve - just looked at this quickly as I'm about to board a flight but this change looks incorrect to me - why are you using scrollX instead of pan.y? The pan.y value is specifying what value to update.

@negativetwelve
Copy link
Contributor Author

@brentvatne thanks for taking a look. The diff doesn't show the second example fully so I think that might be somewhat confusing.

The paragraph above states:

In the example, you can see that scrollX maps to event.nativeEvent.contentOffset.x

but the example never mentions scrollX and instead shows:

onScroll={Animated.event(
  [{nativeEvent: {contentOffset: {y: pan.y}}}]   // pan.y = e.nativeEvent.contentOffset.y
)}

The second example updates both pan.x and pan.y but the paragraph above only references pan.x.

Maybe this section should be broken up into two distinct examples?

From what I understand, the variable in the innermost part of the hash is the one being set to the equivalent of chaining all the keys from the outer hash values together for either the event or gestureState variables. If that's not correct, please let me know!

@sahrens
Copy link
Contributor

sahrens commented Jul 20, 2015

Yeah, this looks good - thanks for the fix!

sahrens added a commit that referenced this pull request Jul 20, 2015
[Docs] Fix Animated example for onScroll and onPanResponderMove to match paragraph description
@sahrens sahrens merged commit e3afc4e into facebook:master Jul 20, 2015
@brentvatne
Copy link
Collaborator

haha ok that makes sense, nice one @negativetwelve 😄

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants