Replies: 2 comments 8 replies
-
My assumption would be yes, simply because a transform/opacity animation lives in isolation and doesn't affect the layout of other elements. I'm not the expert on this, but I would assume transforms are a safer bet on average. |
Beta Was this translation helpful? Give feedback.
3 replies
-
If this can help someone: I achieved much better performance with this method when animating the width of a container, for example: const C: React.FC<{ shrinked: boolean; }> = ({ shrinked, children }) => {
const animatedStyle = useAnimatedStyle(() => ({
width: shrinked ? 100 : 250,
}));
return (
<Animated.View style={animatedStyle} layout={LinearTransition}>
{children}
</Animated.View>
);
} |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋
I'm wondering if there is a performance loss when animating layout properties such as
left
,top
,height
, orwidth
instead of usingtransform
. I'm asking this because with the vanillaAnimated
API fromreact-native
this is clear. Only some properties are supported by the native driver. I know there are similar concerns on web with CSS.My question really boils down to.. Which one of these will perform better?
Option A
Option B
I've started to notice some hitches in my reanimated animations lately, and they are almost exclusively implemented using non-transform properties.
Thanks for all the hardwork on the project, I really love it!
Beta Was this translation helpful? Give feedback.
All reactions