UNPKG

@react-hookz/web

Version:

React hooks done right, for browser and SSR.

15 lines (14 loc) 555 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useScreenOrientation = void 0; var __1 = require(".."); /** * Checks if screen is in `portrait` or `landscape` orientation. * * As `Screen Orientation API` is still experimental and not supported by Safari, this * hook uses CSS3 `orientation` media-query to check screen orientation. */ function useScreenOrientation() { return (0, __1.useMediaQuery)('(orientation: portrait)') ? 'portrait' : 'landscape'; } exports.useScreenOrientation = useScreenOrientation;