apache / apache/cordova-plugin-screen-orientation

Wrong lock/unlock orientation behaviour on iOS Devices

Open
#80 6 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
219
Forks
234
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

## Problem

### What is expected to happen?
-screenOrientation is locked in whole applicaction to screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY

-User enter into a page that **can be rotated.**(ex. a photo viewer)

-screenOrientation is unlocked and the user rotate the device to landscape mode.

-Users decide to close the page and the close method execute (when is already in landscape mode) :

`screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY);`

-the ui returns to the previous page and rotates to portrait

-Then in portrait mode, user decides to enter again into the page that can be rotated:

-the page does `screenOrientation.unlock();`

**The orientation should keep on Portrait mode.**

### What does actually happen?

After locked ui into `this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY` being in landscape orientation if unlock the orientation being in vertical orientation the ui returns to landscape mode automatically.

## Information
-Same code works fine on Android
-Tested on iOS devices 12 and 14

### Environment, Platform, Device
iOS devices 12, ,13, 14 versions

### Version information
```
Ionic CLI : 6.12.3 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.2.3
@angular-devkit/build-angular : 0.1000.3
@angular-devkit/schematics : 10.0.3
@angular/cli : 10.0.3
@ionic/angular-toolkit : 2.3.3

Cordova CLI : 10.0.0
Cordova Platforms : ios 5.1.1
Cordova Plugins : "cordova-plugin-screen-orientation": "3.0.2",
```

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Reproduce the lock, landscape rotation, portrait relock, and subsequent unlock sequence on the iOS implementation using the versions and devices described. Read the plugin's iOS handling for screenOrientation.lock and unlock first; done means unlocking after the relock keeps the UI in portrait, as it does on Android.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.