nandorojo / moti

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

Animate backgroundColor not work #176

Closed lklima closed 2 years ago

lklima commented 2 years ago

I'm trying to animate the background but it doesn't work. useDynamicAnimation and useAnimationState doesn't work either.

expo: 44.0.0 moti: 0.17.1 react-native-reanimated: 2.3.1

<MotiView
   from={{ backgroundColor: "red", scale: 0 }}
   animate={{ backgroundColor: "gray", scale: 1 }}
   transition={{ type: "timing", duration: 2000 }}
/>
nandorojo commented 2 years ago

this is a duplicate. it’s a reanimated issue, not a moti issue. i believe they fixed it in 2.4

lklima commented 2 years ago

@nandorojo using useAnimatedState works, so i think it's not a reanimated issue.

nandorojo commented 2 years ago

It still may be a reanimated issue. It's possible you have to wrap your component with useMemo. useAnimationState is memoized for you, so this isn't a problem.