refactor: use the official useWindowDimensions hook#1494
refactor: use the official useWindowDimensions hook#1494LuisRodriguezLD wants to merge 1 commit into
Conversation
|
Hey @LuisRodriguezLD There was a motivation behind building a custom hook in particular: Even though these issues could be fixed in react-native, at the moment I support multiple RN versions and such update may introduce new issues for existing library users. What is the problem with rotation do you experience? I'm pretty sure I can fix it in the lib itself 🤞 |
|
@kirillzyusko, thanks for responding. The first time works fine (either portrait or landscape) but if I rotate the device then the hook reuses the same dimensions which causes either incorrect scroll (if going from landscape to portrait) or no scroll at all (if going from portrait to landscape) I created a patchfile which uses the official hook and it worked as expected instantly. [Let me know if you prefer a ticket instead] |
📜 Description
React Native has an official
useWindowDimensionshook, this PR updates the hooks to use it instead.https://reactnative.dev/docs/usewindowdimensions
💡 Motivation and Context
The problem with the current custom solution is that it may contain stale window dimensions creating unwanted side effects when rotating devices on complex layouts
📢 Changelog
useWindowDimensionshook🤔 How Has This Been Tested?
The jest tests already use the official hook
📝 Checklist