[
https://issues.apache.org/jira/browse/CB-14079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16467110#comment-16467110
]
Wojciech Trocki edited comment on CB-14079 at 5/8/18 9:14 AM:
--------------------------------------------------------------
[~zabojad] If you do something like this:
{code}
function onDeviceReady(){
window.orientation.lock('portrait')
}
function onPortraitPageLoaded(){
window.orientation.unlock()
}
{code}
Please let me know if that works for you?
I'm trying to replicate this issue.
EDIT:
I think I managed to figure out how this works.
This line of code is responsible for mentioned behavior:
https://github.com/apache/cordova-plugin-screen-orientation/blob/master/src/ios/CDVOrientation.m#L74
Plugin is not getting actual orientation. That's why calling unlock twice works.
>From the code I'm getting that plugin assumes that orientation needs to be
>locked first in order to unlock it after. Other platforms do not have this
>assumption.
Simply removing this if will resolve this issue, but I'm not 100 % sure what
were intentions behind it. Going to create PR with proposed fix and test it on
the various devices.
was (Author: wtrocki):
[~zabojad] If you do something like this:
{code}
function onDeviceReady(){
window.orientation.lock('portrait')
}
function onPortraitPageLoaded(){
window.orientation.unlock()
}
{code}
Please let me know if that works for you?
I'm trying to replicate this issue.
EDIT:
I think I managed to figure out how this works.
This line of code is responsible for mentioned behavior:
https://github.com/apache/cordova-plugin-screen-orientation/blob/master/src/ios/CDVOrientation.m#L74
However I'm not sure if that is a bug because plugin just did not get actual
orientation set.
>From the code I'm getting that plugin assumes that orientation needs to be
>locked first in order to unlock it after. Simply removing this if will resolve
>this issue, but I'm not 100 % sure what were intentions behind it. Going to
>create PR with proposed fix.
> window.screen.orientation.unlock() not working correctly in iOS 11
> ------------------------------------------------------------------
>
> Key: CB-14079
> URL: https://issues.apache.org/jira/browse/CB-14079
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-screen-orientation
> Reporter: Thomas Fétiveau
> Priority: Major
>
> Hi !
> I'm having the following problem on iOS 11 + wkwebview +
> cordova-plugin-screen-orientation v3.0.1:
> My app is by default in portait mode. One page in my application call
> `window.screen.orientation.unlock()` when it shows up. This won't work until
> I go to the system settings to unlock orientation and call
> `window.screen.orientation.unlock()` once again...
> Calling once again `window.screen.orientation.unlock()` should not be
> necessary!
> Can you please fix it?
> Thanks
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]