-
-
Notifications
You must be signed in to change notification settings - Fork 907
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
[BUG] Incompatible with React 19 #2668
Comments
Interestingly, everything does work after building, but not in dev mode (using Vite) |
Isn't it in dev mode that React now double renders as well as runs double effects? |
From the upgrade guide, for clarity's sake:
|
I have found that almost all animations break in react 19 with strict mode on. Initial state will be stuck forever and exit animations just instantly snap to the last state. Turning off strict mode fixes all of these issues as far as I know. This is, ofcourse, inadvisable. |
Understand that from the PR this is not a priority and I've been able to work around this issue happily ^ Encountered this during a test upgrade of NextJS which is likely going to force React 19 upon it's users from 14.3.0+ (it currently throws an error at startup and asks you to upgrade to React 19.0.0 >=), so you may see more issues being raised around this particular snafu. Just thought I'd throw it out there before the deluge of issues comes in 😂 |
Just found this issue after searching for a while why the animations of https://github.com/Temzasse/react-modal-sheet wouldn't work in dev mode, but would in production mode. Very surprising, thanks ! |
Track React 19 progress here: #2667 Current compatible version is |
Anyone coming here after upgrading to Next 15 It's suggested to use framer-motion@12.0.0-alpha.1 now until react 19 is out |
@DrewLandgraveCbsi Yep! |
@DrewLandgraveCbsi , This isn't working for me, I updated to the latest nextJS. Did you also update to the latest or do you have a different version? |
@alexwindelberg Do you have the proper module resolutions/overrides in your package.json? I'm using yarn so it looks like
For npm I think it's
When I ran the codemod for nextjs it did this for me |
@DrewLandgraveCbsi , thank you this helped |
Do you guys facing any trouble for Ref? |
Trying to install
Also tried with
Looking at the source code, seems to still be requiring React v18: What I'm missing? |
Upgrading to |
Still seeing a bug where the initial opacity always remains and never transitions, but only during development. Using |
I don't think it should be necessary to do force install. |
I got "dependencies": {
"framer-motion": "^12.0.0-alpha.1",
"next": "15.0.3",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
},
"overrides": {
"framer-motion": {
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
}
} Then |
i am using next js 15 and i try to install framer motion on it but it throw error like npm i framer-motion when i try to downgrade my react version to 18 it works i mean it got installed is that advisable to downgrade that? here is my dependencies in package manager : { "dependencies": { |
This is the only solution that worked for me when upgrading to Next15. Thanks! |
Yes, this works. But isn't |
I m still getting the error hexa@hexas-MacBook-Air hexa-carbon-web-fe % npm install framer-motion@v12.0.0-alpha.1 (node:63392) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require(). |
This worked for me. Thank you |
For my case its work for installing but soon I use motion.div from "framer-motion" it got error for reference my package.json "dependencies": {
"framer-motion": "^12.0.0-alpha.1",
"next": "15.0.3",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "15.0.3",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"overrides": {
"framer-motion": {
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
}
} |
FYI |
My bad I've learned the "use client" is needed at the top of the file, it work thanks |
@FathZulfaAli THANX, had the same problem. Even though, to be fair, I could have guessed it. This should really go in the Documentation right bellow React 19 / Next 15 |
Confirmed working correctly without overrides. |
I did when I deployed on Vercel because it was using “npm install” during the build for installing dependencies, so I had to override it with “npm install —legacy-peer-deps“ and it worked |
If I am not wrong , after using “npm install —legacy-peer-deps“ you cannot install any other libraries or packages. If you try to install it will throw error. |
I'm using react 19 due to Next 15 in a Turborepo. Framer components started tossing various TS warnings due to missing types. Then I applied the 12 alpha as suggested by @ArishN above and it seems to work fine. All the TS errors are gone, and my animations still work fine so far. |
I tested it and it works great
|
@6abotage You can try |
i still get warning when install 11.13.4 with pnpm
|
Thanks, let me take a look with 11.13.5 |
11.13.5 should have fixed this |
yeah now it works, Thanks a lot! |
Ah good catch, working on that now thanks |
Works great, thank you for your fast work! |
@mattgperry not sure if I've missed something, but if we want the vanilla-js version of the package, we still need to just install the "motion" package, right? I am getting the react peer deps issue as well, but react is not really part of my app -- it's just in the project for storybook. |
@igorkoho what’s the exact error? I wonder if Storybook has an older version of React, as those deps are marked as optional so it should only fail if they’re present but don’t meet 18 |
This was the exact error. TBH I'm not even sure if I need react installed as an explicit dependency. Removing it seems to work for storybook, but I suppose I may run into some edge case where there is an issue.
|
For the record, I resolved this in my project by just upgrading my storybook to v8, which doesn't require me to have react installed. Still, if there were an option to install a vanilla version of this plugin without the react peer-dep, IMO that would be great. |
The peer dep is optional so now that Storybook doesn’t require it - it won’t be installed. It was the version mismatch that was the problem. |
I understand, but the version of react I had installed for storybook IMO should be irrelevant for my usage of motion, which I was planning on using in vanilla JS mode. Totally understandable if keeping these packages in one install is what is needed to make shipping both more manageable, I suppose it not working in my case is an edge case. |
Framer Motion is incompatible with React 19.
Framer itself runs on React 18 and given the scope of breaking changes (subtle and major) I think it is unlikely to be upgraded in the near-term.
To support 19, we preferably have to fix types and animations in a way that is backwards compatible with 18.
Types: #2640
Animations: #2624
Please add further examples of broken behaviour in the comments here.
The text was updated successfully, but these errors were encountered: