-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add "pause" prop #981
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91fc771
to
8265e0c
Compare
b689083
to
f732b86
Compare
This lets you cancel all animations until { cancel: false, default: true } is merged.
- pass an `AnimationTarget` object to `runAsync` function - check for invalidated `runAsync` call whenever an `animate` promise is resolved - only set `state.asyncTo` on a default cancel, because using `cancel: true` without `default: true` should only affect the update it's defined in - use `getResult` functions for brevity
The `scheduleProps` function is concerned with delays and pausing. The `reset` prop is none of its business.
The object contains new values for default props. This commit also moves special handling for default `immediate: true` into the `useSprings` hook, which is what it's really intended for. This means you can use `immediate: true` in a declarative update without inadvertently making future updates immediate by default. If you really want such behavior, you can still use `default: { immediate: true }` in a declarative update. In imperative updates, using `default: true` will still set the default value for the `immediate` prop, if it's defined in the update.
In contrast with the `concatFn` solution, this lets us remove a handler from the queue.
..which lets it pause the current animation as well as the next animation.
The `runAsync` function already handles it for us
67418f7
to
995eaae
Compare
Remove `cancel` handling from the `runAsync` function, forcing callers to implement cancellation manually.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.