nandorojo / moti

🐼 The React Native (+ Web) animation library, powered by Reanimated 3.
https://moti.fyi
MIT License
4.01k stars 127 forks source link

[Types] @types/react 18.0.0 causes children type issue in AnimatePresence #187

Closed xzilja closed 2 years ago

xzilja commented 2 years ago

Is there an existing issue for this?

Current Behavior

I believe there were some changes made to children type in the new react types package that causes following typescript error in AnimatePresence component (I think it needs to explicitly define children now?)

Type '{ children: false | Element | undefined; }' has no properties in common with type 'IntrinsicAttributes & AnimatePresenceProps'.

Expected Behavior

Should not error when children are passed

Steps To Reproduce

  1. Import AnimatePresence component
  2. Add some children to it
  3. Update to latest @types/react package

Versions

- Moti: 0.17.1
- Reanimated: 2.6.0
- React Native: 0.67.4

Screenshots

Screenshot 2022-04-09 at 10 44 48

Reproduction

-

nandorojo commented 2 years ago

this is a framer motion issue. i might have to update the dependency

nandorojo commented 2 years ago

can you run yarn why framer-motion and share the result?

xzilja commented 2 years ago

Sure thing, here you go

framer-motion@3.10.6
node_modules/framer-motion
  framer-motion@"^3.9.1" from @motify/core@0.17.1
  node_modules/@motify/core
    @motify/core@"^0.17.1" from moti@0.17.1
    node_modules/moti
      moti@"0.17.1" from @skimitar/app@1.0.0
      @app
        @skimitar/app@1.0.0
        node_modules/@skimitar/app
          workspace @app from the root project
    @motify/core@"^0.17.1" from @motify/components@0.17.1
    node_modules/@motify/components
      @motify/components@"^0.17.1" from moti@0.17.1
      node_modules/moti
        moti@"0.17.1" from @skimitar/app@1.0.0
        @app
          @skimitar/app@1.0.0
          node_modules/@skimitar/app
            workspace @app from the root project
xzilja commented 2 years ago

Here is related post from dan on stackoverflow https://stackoverflow.com/questions/71788254/react-18-typescript-children-fc/71809927#71809927

xzilja commented 2 years ago

Looks like this was fixed upstream if moti updates framer-motion? https://twitter.com/mattgperry/status/1513933956877627407

nandorojo commented 2 years ago

sounds good, until then you can use a yarn resolution for it. i’ll update when i get the chance. thanks for the catch!

nandorojo commented 2 years ago

Fixed in 0.18.0-alpha.17.

yarn add moti@canary