Figure out orientation of device

Hello everyone!
Someone knows how I can figure out the orientation of the device when I locked the screen to portrait?

I’m try to replicate the behavior of instagram camera.the screen is locked and when you put your device in landscap posiition the picture is rotate.

this might help? - ScreenOrientation - Expo Documentation

I saw this documentation but my screen is locked in Portrait so when my device is in horizontal position he don’t change the height and width!
So I don’t want recognize when my screen is in landscap but my hardware. Instagran has this behavior, the screen don’t change but they rotate the picture after take one.

@rrapozo ohh thanks for clarifying your problem a bit more.

You could try adding an event listener to “Dimensions” found in this article - https://shellmonger.com/2017/07/26/handling-orientation-changes-in-react-native/

@jm90mm thanks for your reply I saw this article too and I try to use but the problem is:

In normal mobile utilization my height = 100 and width = 30 for example when I move my hardware to take a landscape picture the height and width don’t chang because I locked my orientation to portrait.
I don’t want recognize the screen but the hardware.
The goal is when someone take a picture in normal way ok I save the picture but if someone change the orientation of the hardware to landscape i need rotate the picture first.

@rrapozo thanks for clarifying your problem a bit more, I’m not an expert at this but one way you can do this (I think), might be to try not locking your app in portrait mode so that the normal dimension listeners work and just manually lock all your screen components that you want to portrait mode

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.