Skip to content

Callback for custom exiting animation #3640

Answered by neiker
Tobbb asked this question in Q&A
Discussion options

You must be logged in to vote

This is an old question, but in case someone is looking for an answer, here it is:

function SomeAwesomeComponent() {
  return (
    <Animated.View
      collapsable={false}
      entering={CustomEnteringAnimation(() => {
        // your callback
      })}
    >
      {/*  Your content */}
    </Animated.View>
  );
}


function CustomEnteringAnimation(callback: () => void) {
  return () => {
    "worklet";

    return {
      animations: {
        opacity: withTiming(1),
        transform: [
          {
            scale: withTiming(1)
          },
          {
            translateY: withTiming(1)
          }
        ]
      },
      initialValues: {
        transform: [{ scale: 0 }, { tra…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Tobbb
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tomekzaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants