react-native orientation events and control / lock
npm install react-native-mo-orientationLets you query and lock the device orientation
``ts
import { Orientation, OrientationConsumer, OrientationLock } from 'react-native-mo-orientation';
console.log(Orientation.interfaceOrientation.value);
const sub = Orientation.interfaceOrientation.subscribe((orientation) => {
});
// ...
sub.release();
return (
);
return (
{(orientation) => (
)}
)
``
- On iPad/universal apps the orientation locking only works for full screen apps
- Android cannot handle orientation locks like portrait + landscapeleft. A
console.warn will be given in dev mode.