Bug Report
Plugin(s)
@capacitor/screen-orientation@4.1.0
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)
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
Bug Report
Plugin(s)
@capacitor/screen-orientation@4.1.0Capacitor Version
Platform(s)
Current Behavior
After locking the orientation
the
screenOrientationChangelistener still reports changed orientations when the device is rotated as if the orientation was not locked. Callingalso 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
screenOrientationChangelistener should only report changes when the screen orientation is actually changed, not when the device is rotated while the screen orientation is locked. LikewiseScreenOrientation.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
screenOrientationChangelistener gets only called afterScreenOrientation.lock()if it actually changed the screen orientation.ScreenOrientation.orientation()also returns the correct screen orientation afterScreenOrientation.lock()was called.Code Reproduction
Other Technical Details
Additional Context