You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
Can anybody, please, help to understand what wrong with shared value and component renders.
I will show problem on examples, this will be more understandable.
So, I have one hierarchy of components, where updating shared value by function in custom hook works like a charm and component re-renders(translateY visually changes):
const MiniScreen: FC = () => {
<View style={styles.container}>
// layout of MiniScreen
</View>
}
And also have exactly? the same components but with another hierarchy and where hook function called from nested component. In this variant function close is called, but there are no visual changes, and it looks like the root component isn't re-render
const MiniScreen: FC = () => {
const { close } = useAnimation()
return (
<View style={styles.container}>
// layout of MiniScreen
<Button title="Click to animate" onPress={() => close()} />
</View>
)
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
Can anybody, please, help to understand what wrong with shared value and component renders.
I will show problem on examples, this will be more understandable.
So, I have one hierarchy of components, where updating shared value by function in custom hook works like a charm and component re-renders(translateY visually changes):
And also have exactly? the same components but with another hierarchy and where hook function called from nested component. In this variant function close is called, but there are no visual changes, and it looks like the root component isn't re-render
And the hook, that doing the job. These are just code samples, in a real application it's a bit more complicated, but the essence is the same
If you're still here, thank you so much for reading, I really hope you can help
Beta Was this translation helpful? Give feedback.
All reactions