I want to lock the orientation of my camera screen.
<Stack.Screen name="Camera" component={Camera} options={{ headerShown:false,orientation:'landscape'}}/>
This works fine in android but does not work on ios devices. Is there a way to solve this problem?
CodePudding user response:
You can use below plugin for that https://www.npmjs.com/package/react-native-orientation-locker
Set up plugin and configure as mention in their doc and in react native side add below code which you want to Lock Screen portrait or landscape
import Orientation from 'react-native-orientation-locker';
useEffect(()=>{
Orientation.lockToPortrait(); //this will lock the view to Portrait
Orientation.lockToLandscape(); //this will lock the view to Landscape
})