useOrientation

function useOrientation(source: 
  | OrientationSource
  | undefined): 
  | CameraOrientation
  | undefined

Reactively use the current source CameraOrientation.

  • 'interface' will listen to UI-orientation.
  • 'device' will listen to physical phone orientation.
  • undefined will return undefined and not listen to anything.

Example

const orientation = useOrientation('device')
// orientation: 'up' | 'right' | 'down' | 'left' | undefined

On this page

No Headings