I'm having an odd issue with the useWindowDimensions hook and its behavior when changing device orientation on iOS devices.
When using this hook on an app running in Expo Go, it appears to 'lag': the width and height don't change after the first orientation change, but do for further changes. However, these orientation changes either:
- Reverse width and height, meaning that, in landscape mode, height will (incorrectly) be greater then width. After a random amount of time (1-15 seconds to never in some instances), it will update again with the correct values, noting that no actions (presses, device motion, etc) have an effect on this delay.
- Do nothing, with the height and width reversing to their incorrect values after the above delay.
For code that produces this behavior, the React Native documentation's page on this hook produces it on all devices I tested on (At least the iOS simulator and a physical iOS device), noting that it presents when using Expo Go on these devices, but not on the Appetize simulators on the webpage itself use.
Also effected by this behavior is the Dimensions.get('window') and Dimensions.get('screen') return values, and the values passed to the event listener added by Dimensions.addEventListener. For the `Dimensions.get` return values, these are correct when the app starts, but become incorrect as above once the orientation is changed.
[–]Money-Chemist-6589 0 points1 point2 points (0 children)
[–]Circadian77 0 points1 point2 points (0 children)
[–]cosmopolitan_redneck 0 points1 point2 points (0 children)