2

If I use withCallback function on animation enter/exit or even when using the keyframe to create custom animation I get an error. Am I doing something wrong, or maybe missing something?

"react-native-reanimated": "^2.3.1",

<Animated.View
   entering={SlideInLeft.duration(animationDuration)}
   exiting={SlideOutRight.duration(animationDuration).withCallback(()=>{})}
>
   <View />
</Animated.View>

enter image description here

fristyr
  • 159
  • 1
  • 9

1 Answers1

4

Fixed with

const slideInLeft = SlideInLeft.withCallback((finished: boolean) => {
    'worklet';
    if (finished) {
     yourFoo(
    }
});

<Animated.View entering={slideInLeft} >
   ...
</Animated.View>

fristyr
  • 159
  • 1
  • 9