Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70442

Detect device rotation/orientation in Ionic 4 without rotating app

$
0
0

@sshipsey wrote:

Is it possible to detect rotation in an Ionic4 app without actually rotating the entire app?
I’m using this:


I’d like to enter some callback on device rotation, not necessarily rotating the entire app. If I lock orientation, i lose the screenOrientation.onChange() emits. If I unlock rotation, my screenOrientation.onChange() emits, but the app also rotates. Attempting something like this:

this.screenOrientation.unlock();
this.screenOrientation.onChange().subscribe(ev => {
        this.screenOrientation.lock(
          this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY
        );
        // Do other stuff
});

makes the rotation jump between the two which looks bad. Been fighting this for a while, any ideas are appreciated :confused:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70442

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>