'react native orientation issue not working

im developing app and orientation doesnt work at first my react project is version 63.3 i add following command to android manifest.xmln

 <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize"
    android:screenOrientation="portrait"
   >

then i used react-native-orientation-locker in App.js

import Orientation from 'react-native-orientation-locker'

Orientation.lockToPortrait()

but nothing happend

what try

i try changing app.json and add following command

"orientation":"portrait"

then i using useeEfect like this useEffect(() => { Orientation.lockToPortrait() }, [])

then i try to change android manifest tools:ignore="LockedOrientationActivity"

then add android:screenOrientation="portrait" to application tag in androidmanifest.xml

and try to add this in screens that i use navigationContainer and lock it with useEffect and without it but still the same problem

after all this update RN to version 64.2 but same problem appears

and in this case im locking to landscape to check the code is right application load with landscape and after loading application become portrait something cause this issue and i dont know how can i find it and when i use orientation.lockToPortrait() in the home or details screen it work with some issue but work did i miss something??



Sources

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

Source: Stack Overflow

Solution Source