auto-animate icon indicating copy to clipboard operation
auto-animate copied to clipboard

Support for React 17 and 18

Open kachidk opened this issue 1 year ago • 21 comments

Support for at least react 17 would be appreciated

kachidk avatar Jul 11 '22 20:07 kachidk

Should work fine as long as you can do an ESM import

justin-schroeder avatar Jul 12 '22 16:07 justin-schroeder

Not working for me either, error i'm getting:

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @formkit/[email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! peer react@"^16 || ^17 || ^18" from @headlessui/[email protected] npm ERR! node_modules/@headlessui/react npm ERR! @headlessui/react@"^1.6.5" from the root project npm ERR! peer react@"^17.0.2 || ^18" from @mux/[email protected] npm ERR! node_modules/@mux/mux-player-react npm ERR! @mux/mux-player-react@"^0.1.0-beta.21" from the root project npm ERR! 11 more (@trpc/next, @trpc/react, next, next-auth, react-dom, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional react@"^16.8.0" from @formkit/[email protected] npm ERR! node_modules/@formkit/auto-animate npm ERR! @formkit/auto-animate@"*" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peerOptional react@"^16.8.0" from @formkit/[email protected] npm ERR! node_modules/@formkit/auto-animate npm ERR! @formkit/auto-animate@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /Users/lukemacauley/.npm/eresolve-report.txt for a full report.

luke-ae avatar Jul 22 '22 20:07 luke-ae

Same here: peerOptional react@"^16.8.0" from @formkit/[email protected]

nadilas avatar Jul 23 '22 12:07 nadilas

Same here (using pnpm) :

 ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

.
└─┬ @formkit/auto-animate
  └── ✕ unmet peer react@^16.8.0: found 18.2.0

Lukrisum avatar Jul 24 '22 11:07 Lukrisum

+1

canerd7u avatar Jul 25 '22 19:07 canerd7u

Same here: peerOptional react@"^16.8.0" from @formkit/[email protected]

I have the same conflict, but with vue. I think we all need to wait until beta 2, because https://github.com/formkit/auto-animate/commit/029b1a6a95b648115fc4d006fe880249457999b1 solves this problem

AndreyYolkin avatar Jul 27 '22 11:07 AndreyYolkin

yeah, all peer dependencies are being removed in beta.2 because it seems package managers dont do a great job of respecting the "optional" property. Mia culpa on that.

justin-schroeder avatar Jul 27 '22 13:07 justin-schroeder

You could have stopped at package managers don’t do a great job. 😂 no need to specify.

when is beta 2 expected to drop?

nadilas avatar Jul 27 '22 15:07 nadilas

Hey, I'm facing the same issue

nawed2611 avatar Jul 28 '22 09:07 nawed2611

It does work fine when you use --force

luke-ae avatar Jul 28 '22 09:07 luke-ae

I don't want to use --force, which can possibly broke other dependency resolutions, that's why I temporarily removed lib from project

AndreyYolkin avatar Jul 28 '22 10:07 AndreyYolkin

works for me but I'm using pnpm

kristian-puccio avatar Jul 28 '22 11:07 kristian-puccio

Same problem. Was really excited to take this package out for a spin after seeing Theo use it, but then I got slapped with this:

npm ERR! While resolving: @formkit/[email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! peerOptional react@"^16.8.0 || ^17.0.0 || ^18.0.0" from @apollo/[email protected] npm ERR! node_modules/@apollo/client npm ERR! @apollo/client@"^3.6.9" from the root project npm ERR! peer react@"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0" from @react-aria/[email protected] npm ERR! node_modules/@react-aria/ssr npm ERR! @react-aria/ssr@"^3.2.0" from @restart/[email protected] npm ERR! node_modules/@restart/ui npm ERR! @restart/ui@"^1.2.0" from [email protected] npm ERR! node_modules/react-bootstrap npm ERR! react-bootstrap@"^2.4.0" from the root project npm ERR! 11 more (@restart/hooks, @restart/ui, prop-types-extra, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional react@"^16.8.0" from @formkit/[email protected] npm ERR! node_modules/@formkit/auto-animate npm ERR! @formkit/auto-animate@"*" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peerOptional react@"^16.8.0" from @formkit/[email protected] npm ERR! node_modules/@formkit/auto-animate npm ERR! @formkit/auto-animate@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution

Hopefully soon.

one2code avatar Jul 29 '22 00:07 one2code

all peer dependencies are being removed in beta.2

I've just tried to install the package by ignoring the dependencies, however it seems that there are some TypeScript issues that have to be fixed, so I'm not sure whether making the dependencies optional would solve the issue @justin-schroeder. Or maybe this is not related to the dependencies?

(property) ClassAttributes<HTMLDivElement>.ref?: LegacyRef<HTMLDivElement> | undefined
Type 'RefObject<Element>' is not assignable to type 'LegacyRef<HTMLDivElement> | undefined'.
  Type 'RefObject<Element>' is not assignable to type 'RefObject<HTMLDivElement>'.
    Type 'Element' is missing the following properties from type 'HTMLDivElement': align, accessKey, accessKeyLabel, autocapitalize, and 114 more.ts(2322)
index.d.ts(137, 9): The expected type comes from property 'ref' which is declared here on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'

LucaDiba avatar Jul 29 '22 06:07 LucaDiba

@LucaDiba you need to use const [yourRef] = useAutoAnimate<HTMLDivElement>();

luke-ae avatar Jul 29 '22 06:07 luke-ae

as a workaround for now, I added the following to my package.json

  "overrides": {
    "react": "18.2.0"
  }

It's working for me... but I would prefer not to have to use this.

perfectbase avatar Jul 29 '22 08:07 perfectbase

@LucaDiba you need to use const [yourRef] = useAutoAnimate<HTMLDivElement>();

Thanks @luke-ae! Is there a reason why we should specify the generics? Also, all the examples use auto animate in a div but do not specify the type: is there something different in my case? Should the docs be updated or this is kinda a bug and will be fixed in the future?

LucaDiba avatar Jul 31 '22 08:07 LucaDiba

@LucaDiba not 100% sure but you're getting a typescript error telling you that you need to add that in. I don't think it matters if it's a div or not.

luke-ae avatar Jul 31 '22 08:07 luke-ae

@LucaDiba The examples in the docs are in JavaScript. If you are using TypeScript, the ref needs to be of the right type for you to set it in an element. The generic is used internally to cast the ref type.

(I do think it's important to have typescript examples in the docs, though)

perfectbase avatar Jul 31 '22 10:07 perfectbase

To only override '@formkit/auto-animate' react dependencie you can do:

 "overrides": {
    "@formkit/auto-animate": {
      "react": "17.0.2"
    }
  },

(Still not ideal solution, but doesn't require --force and can be removed with new beta version)

kasparsuvi1 avatar Aug 02 '22 13:08 kasparsuvi1

Not working for me either, error i'm getting:

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @formkit/[email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! peer react@"^16 || ^17 || ^18" from @headlessui/[email protected] npm ERR! node_modules/@headlessui/react npm ERR! @headlessui/react@"^1.6.5" from the root project npm ERR! peer react@"^17.0.2 || ^18" from @mux/[email protected] npm ERR! node_modules/@mux/mux-player-react npm ERR! @mux/mux-player-react@"^0.1.0-beta.21" from the root project npm ERR! 11 more (@trpc/next, @trpc/react, next, next-auth, react-dom, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional react@"^16.8.0" from @formkit/[email protected] npm ERR! node_modules/@formkit/auto-animate npm ERR! @formkit/auto-animate@"*" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peerOptional react@"^16.8.0" from @formkit/[email protected] npm ERR! node_modules/@formkit/auto-animate npm ERR! @formkit/auto-animate@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /Users/lukemacauley/.npm/eresolve-report.txt for a full report.

Same here too

savin2001 avatar Aug 04 '22 10:08 savin2001

This should be fixed in the latest betas since we removed peerDependencies all together

justin-schroeder avatar Sep 02 '22 13:09 justin-schroeder

Just wanted to note that this comment fixed this error for me. 🙂

LinnJS avatar Sep 20 '22 16:09 LinnJS