Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when locking the orientation to portait while device is held in landscape #2100

Open
Alarson93 opened this issue May 9, 2024 · 1 comment
Labels
platform: ios type: bug A confirmed bug report

Comments

@Alarson93
Copy link

Alarson93 commented May 9, 2024

Bug Report

Plugin(s)

"@capacitor/screen-orientation": "^6.0.0",

Capacitor Version

Installed Dependencies:

  @capacitor/cli: 5.6.0
  @capacitor/android: 5.6.0
  @capacitor/core: 5.6.0
  @capacitor/ios: 5.6.0

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:
capawesome-team/capacitor-plugins#100

@ionitron-bot ionitron-bot bot added the triage label May 9, 2024
@ionitron-bot ionitron-bot bot removed the triage label May 9, 2024
@IT-MikeS IT-MikeS added the type: bug A confirmed bug report label May 13, 2024
Copy link

ionitron-bot bot commented May 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ios type: bug A confirmed bug report
Projects
None yet
Development

No branches or pull requests

3 participants