I lock the orientation to Portrait from the root component. I want the user to sign their name via the in-app browser (via the Browser plugin), so I unlock the orientation before presenting that screen. I have a browserFinished that locks the device to portrait once the user dismisses the in-app browser.
Everything functions as expected - other screens are locked in portrait but the user can rotate the device when viewing the signing screen. Dismissing the in-app browser while in landscape orientation brings us back to the main web app and switches the orientation to portrait.
However, I do get the following error:
None of the requested orientations are supported by the view controller. Requested: portrait; Supported: landscapeLeft
This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.
Bug Report
Plugin(s)
"@capacitor/screen-orientation": "^6.0.0",
Capacitor Version
Platform(s)
iOS
Current Behavior
I lock the orientation to Portrait from the root component. I want the user to sign their name via the in-app browser (via the Browser plugin), so I unlock the orientation before presenting that screen. I have a
browserFinished
that locks the device to portrait once the user dismisses the in-app browser.Everything functions as expected - other screens are locked in portrait but the user can rotate the device when viewing the signing screen. Dismissing the in-app browser while in landscape orientation brings us back to the main web app and switches the orientation to portrait.
However, I do get the following error:
None of the requested orientations are supported by the view controller. Requested: portrait; Supported: landscapeLeft
Expected Behavior
I would expect to not get the error.
Code Reproduction
await screenOrientationPluginWrapper.lock({ orientation: 'portrait' })
But only while the device is rotated.
Other Technical Details
Commenting out this line seems to resolve the issue: https://github.com/ionic-team/capacitor-plugins/blob/20b9e26b1b0b10228c85049b4093a5ed9cfe64c5/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift#L37C1-L39C22
Additional Context
This issue sound very similar to this issue from Capawesome's version of the plugin: https://github.com/capawesome-team/capacitor-plugins/issues/100