-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Nextjs 9 & react-spring 9: useSpring opposite values in prod/dev-mode #804
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
Please provide a CodeSandbox or git repo. Thanks! 👍 |
Yes sure! Codesandbox: Github repo: In the codesandbox everything seems to work. To view the false behaviour please:
|
After trying out v9 of Or app is not based on Next.js but on Create React App (generated a couple of weeks ago). const InlineLabel = ({
fieldIsFocused,
fieldHasValue,
children,
}) => {
const labelProps = useSpring({
transform:
fieldIsFocused || fieldHasValue
? 'scale(0.8) translate3d(0px, -12px, 0px)'
: 'scale(1) translate3d(0px, 0px, 0px)',
});
return (
<animated.label
hasError={fieldHasError}
style={labelProps}
>
{children}
</animated.label>
);
}; If it helps I can try to put the whole example into a repo. |
FWIW, I've seen this same thing in a production Gatsby build using https://codesandbox.io/s/zealous-visvesvaraya-iw6qj (NOTE: The issue only seems to manifest in production builds, so the codesandbox preview should appear to work as intended!) To see the bug, view that same example built for production: https://csb-iw6qj.netlify.com/ The bug looks sort of like the animation executes oppositely of what is intended, or like it is animating the previous state change when the next state change occurs. NOTE: upgrading |
@lettertwo That's not the latest canary version. LMK if |
@aleclarson whoops, i grabbed the first one in the list yarn showed me! I switched to I would love to know what the underlying issue was, if you have insight and care to share! |
I also hit this with my Gatsby app. I tried the latest canary (9.0.0-canary.808.12.11b2708) but I ran into a bug. I have const overlayTransitions = useTransition(isOpen, null, {
ref: springRef,
config: {
mass: 1,
tension: 200,
friction: 20,
clamp: true,
},
from: { alpha: 0, blur: 0 },
leave: { alpha: 0, blur: 0 },
enter: { alpha: 0.3, blur: 25 },
}) and got an error, I think due to the |
I could confirm this problem from CRA as well. Any fix? |
@samselikoff The v9 canary has a new API for @edwardyh80 Please try the latest canary. |
Closing this according to reports of it being fixed by the canary. If you see this issue, please try with the latest version ( |
🐛 Bug Report
We are using Nextjs 9 & React-spring 9-beta.34. De problem we are experiencing while using useSpring is that transform reacts differently depending on Nextjs build mode prod vs dev. Visibility behaves correctly, maybe because it is a Boolean value. So in development it is correct. Probably related to #778.
To be more clear. When projectDetailVisibility == true:
In production = 'translate3d(0, 0vh, 0)'
In development = 'translate3d(0, 100vh, 0)'
To Reproduce
If it is important to build a codeSandbox, please ask me :)
Expected behavior
I expect useSpring to behave the same in production and development.
In React-spring v8.0.27 it works correctly.
Environment
react-spring
v9.0.0-beta.34react
v16.9.0next
v9.0.6-canary.0 (Have tried different builds)The text was updated successfully, but these errors were encountered: