Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13393

Cordova-screen-plugin fails to rotate viewport to orientation when locked and device rotated to that orientation previously

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.4.0
    • None
    • None
    • iOS

    Description

      For simplicity, I'll use only one combination of portrait and landscape to describe the issue.

      1. Begin with the device locked in Portrait (screen.orientation.lock('portrait') has been invoked).
      2. Physically rotate the device to landscape. Observe that the viewport does not rotate (correct function).
      3. invoke screen.orientation.lock('landscape')
      4. Observe that the viewport does not rotate to landscape, although the device's orientation remains locked.

      This can be reproduced by reversing landscape and portrait as well. Observed on iOS 11 with cordova engine 4.4.0, screen-orientation 2.0.1, and statusbar 2.2.3.

      The attached cordova project will reproduce this issue. It begins by unlocking the orientation. After 5 seconds, it locks the orientation to landscape. When this happens, physically rotate the device to portrait. After 5 seconds, it will attempt to lock itself to portrait, but fail to do so. It might take a couple tries to get the timing right. If needed, I can attach a video of the bug.

      The current workaround seems to be to re-invoke a lock to the device's currently locked orientation prior to locking to the new orientation - see the "fixed" project for an example of that.

      Attachments

        1. hello.zip
          16.12 MB
          Nick Marsh
        2. hellofixed.zip
          16.12 MB
          Nick Marsh

        Activity

          People

            vishalmishra Vishal Mishra
            nick.marsh Nick Marsh
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: