@m31271n/react-norotation
v0.2.1
Published
Do not rotate your device, ok?
Downloads
2
Readme
react-norotation
Do not rotate your device, ok?
Install
$ npm install @m31271n/react-norotation
Usage
import React from 'react';
import NoRotation from '@m31271n/react-norotation';
class App extends React.Component {
onPortrait = () => {};
onLandscape = () => {};
render() {
return (
<NoRotation
desiredOrientation="portrait"
adjustMethod="auto"
onPortrait={this.onPortrait}
onLandscape={this.onLandscape}
>
// children
</NoRotation>
);
}
}
Available Props
| props | type | description |
| -------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| desiredOrientation
| String | Orientation you desired. Available value: "portrait" / "landscape". |
| adjustMethod
| String | Ajust method to use when current orientation is not equal to desiredORientation
. Available value: "manual" / "auto". |
| onPortrait
| Function | Callback executed when current orienttation switchs to portrait. |
| onLandscape
| Function | Callback executed when current orienttation switchs to landscape. |
TODO
- fix broken test