-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove transform on animation end #747
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
Comments
I missed the fact @aleclarson advised me to test it with v9. I did another test with
Can't confirm if it is working. |
You can now use import { Transition } from 'react-spring' |
It works with some caveats:
TypeScript is also complaining about this line (style):
|
Is this out of the scope of this bug? Should I close? |
The following error is what I expected to happen, but it's not the intended behavior:
I'll try to fix that before v9 beta is over. You can keep this issue open. 👍 |
Thank you very very much! :) |
Can you provide a Code Sandbox so I can test my fix. Thanks 👍 |
There: https://codesandbox.io/s/react-spring-v7211-747-o9yvi |
A fix in the meantime for me was to put elements that require |
This will definitely be fixed in the next canary version ( const AnimatedRoute = ({ children }) => (
<Route
render={({ location }) => (
<Transition
- native
items={location}
keys={location => location.pathname}
from={{
opacity: 0,
transform: 'perspective(900px) rotateY(180deg)',
}}
enter={[
{ opacity: 1, transform: 'perspective(1000px) rotateY(0deg)' },
{ transform: 'none', immediate: true },
]}
- leave={{ opacity: 0, transform: 'perspective(900px) rotateY(-180deg)', pointerEvents: 'none' }}>
- {location => style => <Container style={style}>{children(location)}</Container>}
+ leave={[
+ { transform: 'perspective(1000px) rotateY(0deg)', immediate: true },
+ {
+ opacity: 0,
+ transform: 'perspective(900px) rotateY(-180deg)',
+ pointerEvents: 'none',
+ },
+ ]}>
+ {(style, location) => (
+ <Container style={style}>{children(location)}</Container>
+ )}
</Transition>
)}
/>
) The first update of the Also, the render prop has a new signature now, in accordance with #809. |
Now available in v9.0.0-rc.2 #985 |
For anyone else on v8, I could only get this to work with interpolation (I'm using the hooks API): const transitions = useTransition( mount, null, {
from: { transform: 100 },
enter: { transform: 0 },
leave: { transform: 100 },
} )
return transitions.map( ( { item, props: { transform, ...props } } ) => item && (
<animated.div
key
className={classes.root}
style={{
...props,
transform: transform.interpolate( ( t ) => ( t ? `translateX(${t}%)` : 'none' ) ),
}}
>
<Component />
</animated.div>
) ) |
🐛 Bug Report
What I am trying to do is to remove the transform property after the animation is complete. I found out I can set a second value in enter function, but it tries to animate it from
perspective(1000px) rotateY(0deg)
tonone
, which results in crash. Transform interferes withposition: fixed
of a child element and it needs to benone
(long live CSS bugs!). The only thing I can think of is to chain transition elements and use immediate on the second, but this sounds like an overkill.To Reproduce
(tested with
{ transform: "none", immediate: true }
as well)Expected behavior
transform: none
Link to reproduce
https://gist.github.com/arvigeus/8ae09dc28cfd13b9f4e42418dd0eaa99
Environment
react-spring
v8.0.27react
v16.8.6The text was updated successfully, but these errors were encountered: