Skip to content

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 14 commits into from
May 5, 2020
Merged

feat: add "pause" prop #981

merged 14 commits into from
May 5, 2020

Conversation

aleclarson
Copy link
Contributor

No description provided.

@aleclarson aleclarson force-pushed the feat/pause-prop branch 5 times, most recently from 91fc771 to 8265e0c Compare May 4, 2020 17:33
@aleclarson aleclarson force-pushed the feat/pause-prop branch 3 times, most recently from b689083 to f732b86 Compare May 5, 2020 20:08
aleclarson added 11 commits May 5, 2020 16:11
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
@aleclarson aleclarson marked this pull request as ready for review May 5, 2020 20:16
@aleclarson aleclarson merged commit 7f4debd into v9 May 5, 2020
@aleclarson aleclarson deleted the feat/pause-prop branch May 5, 2020 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant