Simply put, layout animations differ in React Native and React Native Web.
This gist is a simple approach to let you use one component to power layout animations across both platforms.
<LayoutView> <Text>Lay me out</Text> </LayoutView>
You can use the
layout prop to pass
false, or a framer motion value. You can also pass reanimated
Layout here (which will be the default, unless you pass
<LayoutView layout="size" layoutId="indicator"> <View /> </LayoutView>
You can also use
layoutId, although this will only work on Web. On Native, you'd need to use the component's
key and ensure that the component stays in the same place in the tree.