-
Notifications
You must be signed in to change notification settings - Fork 604
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
feat(@capacitor/screen-orientation): Orientation 'landscape' lock should use current held landscape if any #2039
Comments
Updating the issue as a feature request as you can achieve explicit "landscape right" by using the |
@IT-MikeS To clarify, the issue is not that the app cant be locked to "landscape right", its that the "landscape" option in the plugin is defined as just "landscape left" instead of both "landscape left" and "landscape right". |
Understood, Im going to leave it as a feature request as it changes current behaviour of the plugin, however I agree that |
This issue would be resolved by making a separate case statement for "landscape" here: capacitor-plugins/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift Line 87 in be3dd68
And returning UIInterfaceOrientationMask.landscape |
For Android I would suggest using SCREEN_ORIENTATION_SENSOR_LANDSCAPE (https://stackoverflow.com/a/35669103/16687547). |
Me and my colleague created a fix for this issue |
Hi all, any idea when this pull request will be reviewed? |
This is an essential function. is anything else happening here? |
@jansgescheit we tmp fixed this by using our own fork (based on v5)
|
Hi @denesh-r, that is a good solution when you want to lock the orientation all the time. But we have an app where the orientation switches depending per page. And when flipping back to locked landscape it produces the error which @codepip55 fixed in the pull request. |
Bug Report
Plugin(s)
@capacitor/screen-orientation 5.0.7
Capacitor Version
Platform(s)
Android and iOS
Current Behavior
When locking the screen orientation to 'landscape' it locks it to landscape left. Meaning that if I'm holding my phone in landscape right mode, the view rotates 180 degrees and locks there. (Same goes for android with landscape and landscape reverse).
You can see this is how its configured in the plugin code:
iOS:
capacitor-plugins/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift
Line 87 in be3dd68
Android:
capacitor-plugins/screen-orientation/android/src/main/java/com/capacitorjs/plugins/screenorientation/ScreenOrientation.java
Line 62 in be3dd68
Expected Behavior
If the phone is physically held in either landscape left or right (normal or reverse for android), when locking the orientation to 'landscape' it should lock the current orientation without rotating anything.
Code Reproduction
This simple app by WIStudent reproduces the problem: https://github.com/WIStudent/capacitor-screen-orientation-issue-reproduction-app/tree/main
Other Technical Details
Additional Context
The text was updated successfully, but these errors were encountered: