Skip to content

Entering/Exiting animations for animatedProps #6419

Answered by MatiPl01
vovacodes asked this question in Q&A
Discussion options

You must be logged in to vote

Hey!
Unfortunately, layout animations work only with style properties. To animate animatedProps when component mounts, you would have to use useAnimatedProps.

The easiest way to achieve layout animation like behavior is to use withSequence with withTiming(0, {duration: 0}), which sets the initial value of the intensity and withTiming(60, {duration: 1000}), which animates to the desired value.

const animatedProps = useAnimatedProps(() => ({
  intensity: withSequence(
    withTiming(0, {duration: 0}),
    withTiming(60, {duration: 1000}),
  ),
}));
...

<AnimatedBlurView
  animatedProps={animatedProps}
  tint="light"
  style={StyleSheet.absoluteFill}
/>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vovacodes
Comment options

@MatiPl01
Comment options

Answer selected by vovacodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants