henninghall / react-native-screen-orientation-listener

Detects screen orientation changes in React Native without making changes in native code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native Screen Orientation Listener

Detects screen orientation changes in React Native without making changes in native code.

Installation

yarn add react-native-screen-orientation-listener

or

npm install react-native-screen-orientation-listener --save

Usage

import { ScreenOrientation } from 'react-native-screen-orientation-listener';

<ScreenOrientation onChange={onChange}>
    {/* Your app root */}
</ScreenOrientation>

const onChange = orientation => console.log("New screen orientation: " orientation)

Additional functions

import { isPortrait, isLandscape, getScreenOrientation } from 'react-native-screen-orientation-listener';

About

Detects screen orientation changes in React Native without making changes in native code.


Languages

Language:TypeScript 100.0%