Replies: 1 comment 6 replies
-
You aren't using the shared value properly. If you want to use reanimated shared values to style components, you would have to use the See this example: import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
function Child() {
const width = useSharedValue(100);
const animatedStyle = useAnimatedStyle(() => ({
width: width.value
});
return (
<View>
<Button>Click</Button>
<Animated.View style={animatedStyle} />
</View>
);
} Please let me know if it fixes your issue. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a simple component below with width useSharedValue
But when the child component rerenders (because the parent gets rerender) the width is not equal to 100 (value from useSharedValue)
Is it a bug or behavior? Anyone can help me explain
Beta Was this translation helpful? Give feedback.
All reactions