Manish
Manish

Reputation: 393

How to make only camera screen orientation in both landscape and portrait while others being lock to portrait

I have successfully made all the screens of my app locked in portrait orientation but the problem is arising that the camera screen with which we have to take pics is also locked to portrait.

Currently I am using android:screenOrientation="portrait" under activity tag in AndroidManifest.xml to lock to portrait.

My question is, can we make camera screen orientation to both portrait and landscape while other screens be locked to portrait?

Upvotes: 2

Views: 2866

Answers (2)

Nerdragen
Nerdragen

Reputation: 3210

Using android:screenOrientation="portrait" in AndroidManifest.xml locks the entire app to portrait mode. If you want only one screen to be landscape, you'll either have to use the package @Chevol mentioned, or listen to width/height changes using onLayout for each screen and lock the orientation in manually.

Upvotes: 1

Chevol
Chevol

Reputation: 51

You can use something like this: react-native-orientation

This is what I have seen commonly used to lock orientation on a screen per screen basis.

Upvotes: 2

Related Questions