0.2.1 • Published 6 years ago

@m31271n/react-norotation v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

react-norotation

code style: prettier Dependency Status DevDependency Status Travis Build Status NPM Downloads

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

propstypedescription
desiredOrientationStringOrientation you desired. Available value: "portrait" / "landscape".
adjustMethodStringAjust method to use when current orientation is not equal to desiredORientation. Available value: "manual" / "auto".
onPortraitFunctionCallback executed when current orienttation switchs to portrait.
onLandscapeFunctionCallback executed when current orienttation switchs to landscape.

TODO

  • fix broken test
0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago