React Native hook for device orientation
yarn add @rnhooks/device-orientation
import useDeviceOrientation from '@rnhooks/device-orientation';
function App() {
const deviceOrientation = useDeviceOrientation();
return (
<View style={styles.container}>
<Text style={styles.type}>Device orientation is:</Text>
<Text style={styles.effectiveType}>{deviceOrientation}</Text>
</View>
);
}
Name | Values | Description |
---|---|---|
deviceOrientation | portrait , landscape |
possible values are portrait and landscape |