- Hooks
- Sensors hooks
- useOrientation
useOrientation
Manage and respond to changes in device orientation with useOrientation.
use-orientation.tsx
Installation
Copy and paste the following code into your project.
use-orientation.ts
Update the import paths to match your project setup.
Paramaters
The useOrientation hook does not accept any parameters.
Return values
Name | Type | Description |
---|---|---|
angle | number | The current orientation angle of the device in degrees. |
type | string | The current orientation type of the device (e.g., ‘portrait-primary’, ‘landscape-primary’, ‘portrait-secondary’, ‘landscape-secondary’). If the type cannot be determined, it is ‘UNKNOWN’. |