jpudysz / react-native-unistyles

Level up your React Native StyleSheet

Home Page:https://unistyl.es

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[iOS] UnistylesRuntime.screen.height return value equal to width

rkuhcvark opened this issue · comments

Description

With UISupportedInterfaceOrientations support, when the iOS phone has a locked portrait orientation, the UnistylesRuntime.screen.height is equal to the UnistylesRuntime.screen.width. After unlocking the orientation the values seem to update properly. But still, with the unlocked orientation, the bug is reproducible initially until the phone's gyroscope values change (move a bit in any direction)

<key>UISupportedInterfaceOrientations</key>
<array>
	<string>UIInterfaceOrientationLandscapeLeft</string>
	<string>UIInterfaceOrientationLandscapeRight</string>
	<string>UIInterfaceOrientationPortrait</string>
	<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
2024-01-23.11.55.44.mp4

Steps to reproduce

  1. Setup the unistyles according to the doc
  2. Into the Info.plist add the UISupportedInterfaceOrientations key with all possible orientations
  3. Lock the Portait orientation in the phone settings
  4. In the App.tsx retrieve the width and height from the UnistylesRuntime.screen, and display some layout accordingly

Snack or a link to a repository (optional)

No response

Unistyles version

2.1.0

React Native version

0.72.6

Platforms

iOS

Engine

Hermes

Architecture

Fabric (new)

That's interesting, I will try to debug it later today. Nevertheless its about initial values 🤔

Damn, it's because I refactored the code while I was adding support for macOS. I passed twice the width 🤐

Released as 2.1.1