1.0.0 • Published 1 year ago

react-native-fast-orientation v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

React Native Orientation

In React Native applications, monitor changes in device orientation and programmatically set the preferred orientation for each screen. works on iOS and Android.

Installation

$ npm install react-native-fast-orientation —save

Usage

Use the Orientation module in your codebase if you want to use the react-native-fast-orientation package :

$ import UseOrientation from 'react-native-fast-orientation'
const App = () => {
  const orientation = UseOrientation();
  return (
   // ...
      <View
        style={{
          height: orientation.isPortrait ? 200 : 100,
          width: orientation.isPortrait ? 200 : 100,
          backgroundColor: 'black',
        }}
      />
   // ...
  );
};

export default App;