1.0.9 • Published 8 months ago

react-use-device-orientation v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months 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

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago