-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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] Add a sample to clarify animation callback #16770
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Can you rebase? We just landed a commit that shifts documentation to plain old markdown files in the |
Sure thing @hramos! Just did so :) |
@facebook-github-bot label Documentation Attention: @hramos Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Left a few comments inline.
docs/animated.md
Outdated
@@ -66,6 +66,16 @@ invoked with `{finished: true}`. If the animation is done because `stop()` | |||
was called on it before it could finish (e.g. because it was interrupted by a | |||
gesture or another animation), then it will receive `{finished: false}`. | |||
|
|||
```javascript | |||
this.animateValue.spring({}).start(function onComplete({finished}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use arrow function here
docs/animated.md
Outdated
@@ -66,6 +66,16 @@ invoked with `{finished: true}`. If the animation is done because `stop()` | |||
was called on it before it could finish (e.g. because it was interrupted by a | |||
gesture or another animation), then it will receive `{finished: false}`. | |||
|
|||
```javascript | |||
this.animateValue.spring({}).start(function onComplete({finished}) { | |||
if (finished === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (finished) {
docs/animated.md
Outdated
```javascript | ||
this.animateValue.spring({}).start(function onComplete({finished}) { | ||
if (finished === true) { | ||
console.log('Animation was stopped') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Animation was completed" maybe?
Hi @janicduplessis, thanks for the comments. Just updated based on feedback 😄 I can squash commits if necessary. |
@jsagorin Thanks, you don't have to squash commits it will be done automatically when your PR lands. |
@facebook-github-bot shipit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janicduplessis is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
@hramos Can you check why this failed to import? |
Can I do something to help with this? @hramos @janicduplessis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Trying to land again. I couldn't find any particular reason this failed to import. |
Summary: Even having worked long with React Native, I am pretty new to animations, so it took me a while to figure out how to trigger some code after an animation had finished. After some investigation, it was evident I did not ready as in depth as I am supposed to, but this can be a problem for many who, like me, try to search quick through docs and other resources. Here more cases: https://stackoverflow.com/questions/38053071/react-native-animated-complete-event facebook#3212 Read the proposed sample, and see if it is adequate. [DOCS] [ENHANCEMENT] [AnimatedImplementation.js] - Adds a sample for animation callbacks Closes facebook#16770 Differential Revision: D6304441 Pulled By: hramos fbshipit-source-id: c22e391aece6a62684a78847fc74df203c2438d7
Summary: Even having worked long with React Native, I am pretty new to animations, so it took me a while to figure out how to trigger some code after an animation had finished. After some investigation, it was evident I did not ready as in depth as I am supposed to, but this can be a problem for many who, like me, try to search quick through docs and other resources. Here more cases: https://stackoverflow.com/questions/38053071/react-native-animated-complete-event facebook#3212 Read the proposed sample, and see if it is adequate. [DOCS] [ENHANCEMENT] [AnimatedImplementation.js] - Adds a sample for animation callbacks Closes facebook#16770 Differential Revision: D6304441 Pulled By: hramos fbshipit-source-id: c22e391aece6a62684a78847fc74df203c2438d7
Motivation
Even having worked long with React Native, I am pretty new to animations, so it took me a while to figure out how to trigger some code after an animation had finished. After some investigation, it
was evident I did not ready as in depth as I am supposed to, but this can be a problem for many
who, like me, try to search quick through docs and other resources.
Here more cases:
https://stackoverflow.com/questions/38053071/react-native-animated-complete-event
#3212
Test Plan
Read the proposed sample, and see if it is adequate.
Release Notes
[DOCS] [ENHANCEMENT] [AnimatedImplementation.js] - Adds a sample for animation callbacks