software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.87k stars 1.3k forks source link

Add safer refresh on InteractiveExample #6057

Closed patrycjakalinska closed 4 months ago

patrycjakalinska commented 4 months ago

Before when page was loading, there was a chance that width value wouldn't be passed to component in InteractiveComponent - in other words the width will be passed to component before it had become something other than null, and there won't be a rerender after width gets a number value. After this change, with useEffect hook, we monitor if width has changed and if so, we trigger a rerender that guarantees our component will always get correct width.