@capacitor/screen-orientation: iOS: orientation() and screenOrientationChange event report orientation change although orientation is locked
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- ios, swift, typescript
- Domain
- mobile
Research direction
Reproduce the issue on iOS using @capacitor/[email protected], starting with the ScreenOrientation.lock(), orientation(), and screenOrientationChange entry points described here. Compare reported values after locking to portrait-primary and rotating the device; done means the listener and orientation() reflect the locked screen orientation, without changing the documented Android behavior.
Written by the indexing model from the issue text.
Description
Bug Report
Plugin(s)
@capacitor/[email protected]
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 4.7.0
@capacitor/core: 4.7.0
@capacitor/android: 4.7.0
@capacitor/ios: 4.7.0
Installed Dependencies:
@capacitor/core: 4.7.0
@capacitor/cli: 4.7.0
@capacitor/ios: 4.7.0
@capacitor/android: 4.7.0
[success] iOS looking great! 👌
Platform(s)
- iOS
Current Behavior
After locking the orientation
await ScreenOrientation.lock({orientation: "portrait-primary"})
the screenOrientationChange listener still reports changed orientations when the device is rotated as if the orientation was not locked. Calling
const {type} = await ScreenOrientation.orientation()
also returns the orientation as if the screen orientation was not locked.
The document orientation itself is locked correctly though, no matter how the device is rotated.
Expected Behavior
The screenOrientationChange listener should only report changes when the screen orientation is actually changed, not when the device is rotated while the screen orientation is locked. Likewise ScreenOrientation.orientation() should return the correct screen orientation when it is locked, no matter how the device is rotated.
This does not seem to be an issue on Android. There the screenOrientationChange listener gets only called after ScreenOrientation.lock() if it actually changed the screen orientation. ScreenOrientation.orientation() also returns the correct screen orientation after ScreenOrientation.lock() was called.
Code Reproduction
Other Technical Details
Additional Context
- Dominant language
- Java
- Stars
- 682
- Forks
- 689
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/capacitor-plugins
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguageOpentriage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ionic-team/capacitor-plugins#2604 ·
-
platform: ios
Difficulty 4/5 3-5 days Newbie friendliness 58/100
ionic-team/capacitor-plugins#2603 · 1 comment ·
-
platform: android
Difficulty 3/5 1-2 days Newbie friendliness 76/100
ionic-team/capacitor-plugins#2599 ·
-
platform: ios
Difficulty 3/5 1-2 days Newbie friendliness 68/100
ionic-team/capacitor-plugins#2595 · 2 reactions ·
-
platform: android triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
ionic-team/capacitor-plugins#2593 ·
All issues in ionic-team/capacitor-plugins
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
geonetwork/geonetwork#227 ·
Maintainers usually reply within 3 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Netcracker/qubership-testing-platform-tdm3#138 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
synthetichealth/synthea#1726 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bisq-network/bisq#8097 ·
Maintainers usually reply within 1 day
-
area/frontend good first issue kind/cooldown
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day