React Native Hook for Device Orientation

@rnhooks/device-orientation

React Native hook for device orientation

Demo

Installation

yarn add @rnhooks/device-orientation

Usage

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>
  );
}

Output

Name Values Description
deviceOrientation portrait, landscape possible values are portrait and landscape

Download Details:

Author: react-native-hooks

Demo: https://github.com/react-native-hooks/device-orientation/blob/master/demo-orientation.gif

Source Code: https://github.com/react-native-hooks/device-orientation

#react-native #react #mobile-apps

React Native Hook for Device Orientation
9.30 GEEK