https://github.com/kristerkari/react-native-orientation-change-provider
Simple React Native Provider component that forces a re-render when orientation changes.
https://github.com/kristerkari/react-native-orientation-change-provider
orientation orientation-changes provider react-native
Last synced: 4 months ago
JSON representation
Simple React Native Provider component that forces a re-render when orientation changes.
- Host: GitHub
- URL: https://github.com/kristerkari/react-native-orientation-change-provider
- Owner: kristerkari
- License: mit
- Created: 2018-03-14T15:55:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-19T20:49:57.000Z (over 6 years ago)
- Last Synced: 2025-06-21T15:18:37.839Z (4 months ago)
- Topics: orientation, orientation-changes, provider, react-native
- Language: JavaScript
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Native Orientation Change Provider
Simple React Native Provider component that forces a re-render when orientation changes.
## Installation
```
npm install react-native-orientation-change-provider --save-dev
```or
```
yarn add react-native-orientation-change-provider --dev
```## Usage
Import `OrientationChangeProvider` and wrap your whole app with the provider:
```jsx
import { OrientationChangeProvider } from "react-native-orientation-change-provider";...
;
```Notice that using `OrientationChangeProvider` will force your app to re-render when the orientation changes. It causes all `this.state` from child components to reset. You can work around that by using a global state, for example [Redux](https://redux.js.org/).