'React-native Android Set only Portrait Mobile Phones Otherwise tablets shows landScape and Portrait

I have a small problem in this case in my app I set default Portrait.But now this time i want show Portrait and landScape in Tabs not only Mobile phone .In mobile phones show only Portrait(Force Update to Portrait).

I followed this link but I am getting this error and i dd't understand how can we create folders where can we place the data. I followed this link: but i didn't get

Android: allow portrait and landscape for tablets, but force portrait on phone?



Solution 1:[1]

1.Go to the Android folder inside your RN Project,add values-sw600dp and values-xlarge to the following path:

android/app/src/main/res/values-sw600dp
android/app/src/main/res/values-xlarge

then add bools.xml to values,values-sw600dp,values-xlarge. the result:

enter image description here

2.Add code to MainActivity.java in the path android/app/src/main/java/com/[your project name]/MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getResources().getBoolean(R.bool.portrait_only)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ufxmeng