Posts

Showing posts from October, 2023

How to Set Orientation in React Native App Without using any package

Controlling Orientation on Android For Android, you can control the orientation of your React Native app by modifying the AndroidManifest.xml file located in the android/app/src/main directory of your project. Follow these steps: Open the AndroidManifest.xml file. Locate the <activity> tag for your main activity, which is typically named .MainActivity . To set your app to landscape mode, add the following attribute to the <activity> tag: xml android:screenOrientation="landscape" Your <activity> tag should now look something like this: xml < activity android:name = ".MainActivity" android:label = "@string/app_name" android:configChanges = "keyboard|keyboardHidden|orientation|screenSize|uiMode" android:screenOrientation = "landscape" android:windowSoftInputMode = "adjustResize" > To set your app to portrait mode, simply change the value of android:screenOrientation to "portrait