![]() ![]() Let’s create new folders inside android/app/src/main/res* along with a new. Next step would be to add another few config files. ![]() What you need to do is to update every activity tag so it either has android:screenOrientation="unspecified" set or no such option at all ( unspecified is the default value), like so: ![]() when you added a custom splash screen already, you would have e.g. If you have just initialized your React Native app, you should have only one activity tag, but e.g. To start with, we need to update our activities setup in AndroidManifest.xml in android folder ( android/app/src/main/AndroidManifest.xml). Now let’s handle the Android for a change. On an iPad on the other hand, it will be changing the orientations: Now, when we run the app on an iPhone, it will be set to portrait only at all times: Let’s do so by selecting it from the project navigator:Īnd update its content by setting the Supported interface orientations key to an array with only portrait value and add Supported interface orientations (iPad) key with the array containing desired orientations for tablets as the value: With this being done, the second thing we need to do is to update the ist file. This way the app will fill up the entire screen □. We need to append the target device types by iPad option and select the Requires full screen option. Let’s open the iOS project in XCode to setup everything.įrom our root project directory let’s run:įirst thing to do would be to update the Deployment Info. screenOrientation:"portrait", screenOrientation:"landscape" or screenOrientation:"reversePortrait" - more on it here: Android | activity element It is fairly simple to block this behaviour either inside XCode (in case of iOS) by selecting desired options in Deployment Info or inside AndroidManifest.xml (in case of Android) file (located in /android/app/src/main/AndroidManifest.xml) by editing/adding android:screenOrientation="X"* to your tags. react-native CLI switch their orientation whenever the device is rotated. And although it is true, while researching, I had to visit a few pages and learn how to do it separatly for iOS and Android.Īfter handling it, I decided that it would be cool to collect these few tips in one single article of some sort and share it with the rest of the world □! Let’s setup our apps!īy default, all apps created with e.g. It is not some kind of rocket science knowledge and all this information can easily be found on the internet. Recently, I was tasked with setting up the app in such a way that it is available only in portrait mode on mobile phones and in both landscape AND portrait on tablets. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |