nandorojo / moti

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

React Native: ReanimatedError: stepAnimation is not a function (it is undefined), js engine: reanimated #295

Closed FluffyDiscord closed 11 months ago

FluffyDiscord commented 12 months ago

Is there an existing issue for this?

Current Behavior

Cannot animate using sequences

Expected Behavior

Animates as described in docs

Steps To Reproduce

<MotiView
            animate={{
                transform: [
                    {
                        translateX: [20, 0, -12, 14],
                    },
                    {
                        translateY: [-15, 10, -2, 9],
                    },
                ],
            }}
            transition={{
                loop: true,
                type: "timing",
                duration: 20,
            }}
/>

Versions

- Moti: 0.25.3
- Reanimated: 3.3.0
- React Native: 0.72.1

Screenshots

No response

Reproduction

ss

nandorojo commented 12 months ago

can you put the values inline instead of in the transform array?

FluffyDiscord commented 12 months ago

can you put the values inline instead of in the transform array?

Same error when doing this:


        <MotiView
           animate={{
                translateX: [20, 0, -12, 14],
                translateY: [-15, 10, -2, 9],
            }}
            transition={{
                loop: true,
                type: "timing",
                duration: 20,
            }}/>

image

comontes commented 11 months ago

I get Simulator Screenshot - iPhone 14 Pro Max - 2023-07-17 at 12 02 35

nandorojo commented 11 months ago

maybe a reanimated 3-specific error, should ideally have an easy fix

cowlabs-xyz commented 11 months ago

Experiencing same error with Reanimated 3 and expo 49, stepAnimation is not a function

nandorojo commented 11 months ago

if someone can spin up an example app i’m sure it’s somewhat of an easy fix, i’d review a PR

cowlabs-xyz commented 11 months ago

Great, In "submission to app store mode" right now but will try to get one done after!

grgmgd commented 11 months ago

I think this is related to #282 tried the following patch and got the issue resolved. There is also an open PR with this fix

diff --git a/node_modules/moti/src/core/use-motify.ts b/node_modules/moti/src/core/use-motify.ts
index 0b0680c..a95c5ae 100644
--- a/node_modules/moti/src/core/use-motify.ts
+++ b/node_modules/moti/src/core/use-motify.ts
@@ -244,7 +244,7 @@ const getSequenceArray = (

   const sequence: any[] = []

-  sequenceArray.forEach((step) => {
+  for (const step of sequenceArray) {
     const shouldPush =
       typeof step === 'object'
         ? step && step?.value != null && step?.value !== false
@@ -302,7 +302,7 @@ const getSequenceArray = (
         sequence.push(sequenceValue)
       }
     }
-  })
+  }

   return sequence
 }
nandorojo commented 11 months ago

is this on hermes or JSC?

nandorojo commented 11 months ago

fixed in 0.25.4

grgmgd commented 11 months ago

@nandorojo Hermes

dattm97 commented 2 months ago

I got same error in:

When i turn off hermes, error was gone. Please kindly check it, thanks @nandorojo.