react-native-orient

1.3.3 • Public • Published

Install

npm install --save react-native-orient

Usage

import { makeResponsive, getDimensions } from 'react-native-orient'

export class PortraitLockedComponent extends React.Component {
  static orientation = 'portrait';
  render() {
    const dim = getDimensions(PortraitLockedComponent)
    return (
      // ...
    )
  }
}

class ResponsiveComponent extends React.Component {
  render() {
    // will rerender when orientation / dimensions change
    // this.props = {
    //   .. 
    //   orientation: 'portrait', // or 'landscape'
    //   dimensions: { width, height }
    // }
    const dim = this.props.dimensions
    return (
      // ...
    )
  }
}

ResponsiveComponent = makeResponsive(ResponsiveComponent)
export ResponsiveComponent

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-orient

Weekly Downloads

0

Version

1.3.3

License

MIT

Last publish

Collaborators

  • tenaciousmv