1.0.4 • Published 4 years ago
react-hook-screen-orientation v1.0.4
react-hook-screen-orientation :arrows_clockwise:
A React hook for detecting screen orientation.
Installation
Using npm:
npm install --save react-hook-screen-orientationUsing yarn:
yarn add react-hook-screen-orientationUsage
import React from 'react'
import useScreenOrientation from 'react-hook-screen-orientation'
const ComponentWithScreenOrientation = () => {
const screenOrientation = useScreenOrientation()
return (
<p>Screen orientation is: {screenOrientation}</p>
)
}Notes
The screenOrientation value provided by the hook is the type propery of a ScreenOrientation interface is always one of the following strings:
portrait-primaryportrait-secondary(meaning upside down)landscape-primarylandscape-secondary(meaning upside down)
Contributions
Contributions are welcome. File bug reports, create pull requests, feel free to reach out at tothab@gmail.com.
Licence
LGPL-3.0