ScreenOrientation issue on IOS sdk 37

Please provide the following:

  1. SDK Version: 37
  2. Platforms(Android/iOS/web/all): IOS (iPhone XR) (Works fine on Android)

In my app I have screen that the user can enable ‘full screen mode’, which is portrait by default but should change to landscape (left or right) when the user tilts their screen.

I was able to achieve this with SDK 35 using OrientationLock.ALL_BUT_UPSIDE_DOWN) but it seems this has been removed in SDK 37.

I’ve tried using ScreenOrientation.OrientationLock.ALL) but I get the following error:
Error: This device does not support the requested orientation 1

As an attempted work around I’ve tried the following code but nothing happens when I tilt my screen:
ScreenOrientation.lockPlatformAsync({screenOrientationArrayIOS: [‘PORTRAIT_UP’,‘LANDSCAPE_LEFT’,‘LANDSCAPE_RIGHT’]})

I would appreciate if somebody from the Expo team could guide me on this.

I was able to fix my issue by replacing

ScreenOrientation.lockPlatformAsync({screenOrientationArrayIOS: [‘PORTRAIT_UP’,‘LANDSCAPE_LEFT’,‘LANDSCAPE_RIGHT’]})

with

ScreenOrientation.lockPlatformAsync({screenOrientationArrayIOS: [1, 3, 4]})

However this introduced a new issue. Whenever my app is in landscape mode there is a white bar that spans across the top of the screen. It looks like the same height/width as the status bar. How can I remove it?

I found the root cause of the white bar issue. I was using version 2 of react-navigation. I was able to fix the white bar issue by upgrading to react-navigation v4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.