Please provide the following:
- SDK Version: 37
- Platforms(Android/iOS/web/all): Android/iOS
i want to allow users to use the app in landscape on a tablet, but only in portrait on a phone.
in app.json, i have
i installed expo-screen-orientation
i tried two different methods of implementing this and am getting the same problem with both versions:
I launch in landscape on iPhone and see the splash screen in landscape, then it switches to portrait as I’d hope for, but the status bar height offset (using expo constant) doesn’t work.
change app.json to
in App.js, I added:
!isWideScreen && ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
change app.json back to
in App.js, I added
isWideScreen && ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.DEFAULT);
I would expect Version 2 to behave exactly as the app did before messing with orientation at all on a phone, but i still get the statusbar height issue.
Any thoughts would be appreciated, also happy to provide more info if needed.
Edit: I just thought of a third way to do it, by keeping
"orientation": "portrait" in app.json and changing the function in App.js to
isWideScreen && ScreenOrientation.unlockAsync(); Will update with results.
Edit: This third version has the same issue. I’m stumped.