I have a project in React Native, and I need lock a orientation a specific view in landscape orientation. But, the code don't work and the screen loop tilting. I find one answer for the problem very similar with mine. But, the solution propose don't work. I already search very hard for one solution.
Sorry for bad english. Someone can help-me?
This is my code
import Orientation from 'react-native-orientation-locker';
const App: () => React$Node = () => {
function _onOrientationDidChange(orientation) {
if (orientation == 'PORTRAIT') {
Orientation.lockToLandscapeLeft();
}
console.log(orientation);
}
React.useEffect(a => {
Orientation.lockToLandscapeLeft();
Orientation.addOrientationListener(_onOrientationDidChange);
}, []);
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
...
</SafeAreaView>
</>
);
};