nandorojo / moti

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

[0.0.18] invalid value passed to interaction #185

Closed hirbod closed 2 years ago

hirbod commented 2 years ago

Hi @nandorojo,

tried the Canary and so far, everything was working as expected without breaking changes. While I tried your release-note example, which was looking dope, I encountered this issue:

<MotiPressable>
  {(interaction) => {
    return (
      <MotiView
        animate={() => {
          'worklet'

          const { pressed, hovered } = interaction.value

          return { opacity: pressed ? 0.9 : 1 }
        }}
      />
    )
  }}
</MotiPressable>

IMG_8611

Some informations:

nandorojo commented 2 years ago

Hmm weird, thanks for sending. I haven't tried reanimated 2.5 yet, I wonder if that's related (I'm on 2.3).

hirbod commented 2 years ago

FYI: if you're using a custom-dev-client like I do, you will need to disable expo autolinking for rea inside the package.json since its not working with 2.5.0 currently.

  "expo": {
    "autolinking": {
      "exclude": [
        "react-native-reanimated"
      ]
    }
  },
nandorojo commented 2 years ago

I reproduced this in my app, will investigate.

nandorojo commented 2 years ago

Dealing with reanimated internals is tricky! Think I got it, will push shortly.

hirbod commented 2 years ago

I am dealing with those internals since 3 days to fix an ugly bug but I am close to give up! Thanks for investigating

nandorojo commented 2 years ago

Hm, reanimated may not allow this specific case for some reason. Going to try to repro and send a PR. Thought I had it working, might have been mistaken.

nandorojo commented 2 years ago

It will work for the animate prop, but the child as a function may not work out of the box yet.

nandorojo commented 2 years ago

Here is a reproduction that shows it's not possible with Reanimated: https://snack.expo.dev/@beatgig/courageous-bubblegum

Will open an issue there.

nandorojo commented 2 years ago

Opened an issue: https://github.com/software-mansion/react-native-reanimated/issues/3123

nandorojo commented 2 years ago

Closing for now since it's a reanimated issue. Will make a note of this on the canary release notes.

hirbod commented 2 years ago

Closing this will most likely cause duplicate reports, or?

nandorojo commented 2 years ago

I pushed a fix that solves the animate prop allowing a worklet. As for the MotiPressable child case, I added a note to the release notes:

Screen Shot 2022-03-31 at 6 32 48 PM
nandorojo commented 2 years ago

closing, as we're beholden to reanimated for this to work and it's documented that it isn't ready yet.