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

useTransition and immediate #594

Closed
nervestaple opened this issue Mar 15, 2019 · 6 comments
Closed

useTransition and immediate #594

nervestaple opened this issue Mar 15, 2019 · 6 comments
Labels
kind: request New feature or request that should be actioned
Milestone

Comments

@nervestaple
Copy link

nervestaple commented Mar 15, 2019

immediate key fails when used with update: or enter: or whatever keys on useTransition. is there any way to immediately snap an update to its destination, for example? would this require an API change?

@drcmda
Copy link
Member

drcmda commented Mar 15, 2019

i think you don't need transition at all in this case, it's been made for situations where immediate actions are intercepted in order to animate items in and out.

@nervestaple
Copy link
Author

sure, that's what I'm using it for -- I want to animate transitions like enter/exit/update, but also want to conditionally snap certain transitions to their destination some of the time. immediate is an option that exists in useSpring, for example -- is there something that conceptually prevents such an option in useTransition?

@nervestaple
Copy link
Author

nervestaple commented Mar 17, 2019

the issue is manifesting with animating display: grid cells. imagine using useTransition to manage adding/removing/moving grid rows smoothly.

upon adding a row to the grid, the existing cells in rows below have to be shifted down 1 row (transform: translateY()) -- once they're in position, the grid-row of each cell must be incremented simultaneously with their transform: translateY snapping back to 0. this doesn't seem possible with useTransition currently without an option like immediate.

@aleclarson aleclarson added the type: needs repro Needs minimal reproduction label Apr 1, 2019
@aleclarson
Copy link
Contributor

Please provide a CodeSandbox that demonstrates the issues you're having. Thanks! 👍

@nervestaple
Copy link
Author

nervestaple commented Apr 1, 2019

https://codesandbox.io/s/ql21yr2l4?fontsize=14

it's very possible that there's a way to fix this specific implementation without something like immediate, or that it doesn't make technical sense to implement immediate properties for useTransition, but it does seem like it would be convenient here.

@aleclarson aleclarson added kind: request New feature or request that should be actioned and removed type: needs repro Needs minimal reproduction labels Apr 1, 2019
@aleclarson aleclarson reopened this Apr 1, 2019
@aleclarson aleclarson mentioned this issue Apr 15, 2019
5 tasks
@aleclarson aleclarson added this to the v9.0.0 milestone Apr 23, 2019
@aleclarson
Copy link
Contributor

You can use v9 like this now: yarn add react-spring@next

Let us know how it goes: #642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: request New feature or request that should be actioned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants