1.0.9 • Published 3 years ago

react-use-device-orientation v1.0.9

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

React useDeviceOrientation Hook

Install

npm i react-use-device-orientation

Usage

  1. Import useDeviceOrientation hook.
  2. Call requestAccess which prompts the use to grant permission on iOS.
  3. Use the orientation data.
import { useDeviceOrientation } from 'react-use-device-orientation'

// ...

const { orientation, requestAccess, revokeAccess, error } = useDeviceOrientation()

To obtain absolute orientation pass "absolute" to the hook as a parameter.

const { orientation, requestAccess, revokeAccess, error } = useDeviceOrientation('absolute')

More Info

https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent#browser_compatibility

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago