Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

prevent-orientation

nghiepit2.7kMIT2.1.0TypeScript support: included

Prevent orientation mode on mobile device

orientation, landscape, portrait

readme

prevent-orientation

Prevent orientation mode on mobile device

NPM version NPM yearly download

screenshots

Installation

$ yarn add prevent-orientation

or

<script src="//unpkg.com/prevent-orientation"></script>

Usage

import {PreventOrientation} from 'prevent-orientation';

// Prevent to portrait orientation
new PreventOrientation().preventPortrait();

// Prevent to landscape orientation
new PreventOrientation().preventLandscape();

Customize

new PreventOrientation({
  text: 'Sorry, this device orientation is not supported',
  color: 'rgb(90, 90, 90)',
  background:
    'linear-gradient(to right, rgb(255, 175, 189), rgb(255, 195, 160))',
  fontSize: '1.2rem',
}).preventOrientationToAngle(0);

License

MIT