Just upgraded "react-native-reanimated" to v3.6.1 and now all my Keyframe animations make the app crash without showing any error even on emulator.
export const SampleKeyframe = new Keyframe({
from: {
transform: [{ rotate: '0deg' }],
},
to: {
transform: [{ rotate: '45deg' }],
},
});
Using it in a simple animated view
UPDATE: It seems that "transform" is whats causing the crash as using other props like "opacity" works. Still can’t figure out why transform doesn’t.
2
Answers
I have the same issue, which blocks me to upgrade from Expo v49 to v50 with all related libs. Still figuring out.
I have rewritten some animations using
useAnimatedStyle
instead ofKeyframe
, so some issues gone (even with usingtransform
), but I don’t want to abandon all Keyframe usages at all, that’s not a soluion.if you add ‘worklet’ in makeKeyframeKey function, it will resolve your crash.
File: Reanimated/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts
function makeKeyframeKey(index: number, transformProp: string) {
‘worklet’;
return
${index}_transform:${transformProp}
;}