Skip to content

Can I animate non-list layout changes? #5757

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

You must be logged in to vote

As far as I know, layout animations don't support animated dimensions changes. You would have to measure the error component yourself and apply the animation once it is measured.

I used the following component in my project to achieve this behavior in an easy way:

import { useEffect, useRef } from 'react';
import { StyleSheet } from 'react-native';
import Animated, {
  Easing,
  interpolate,
  useAnimatedReaction,
  useAnimatedStyle,
  useSharedValue,
  withTiming
} from 'react-native-reanimated';

const animationConfig = {
  duration: 300,
  easing: Easing.inOut(Easing.ease)
};

export default function ExpandableView({
  children
}: {
  children: React.ReactNode;
}) {
  const prevChildRef =

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by MatiPl01
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