From 0871a736a75bc43fd019eb1ef15df66140a9cfc2 Mon Sep 17 00:00:00 2001 From: Damian Tarnawsky <84595830+dtarnawsky@users.noreply.github.com> Date: Tue, 23 Jan 2024 06:52:36 -0800 Subject: [PATCH] fix(screen-orientation): Add OrientationLockType (#1914) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Dan Giralté <97970732+giralte-ionic@users.noreply.github.com> Co-authored-by: jcesarmobile --- screen-orientation/README.md | 15 ++++++++++++--- screen-orientation/src/definitions.ts | 13 +++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/screen-orientation/README.md b/screen-orientation/README.md index 5eb1a0cce..418b5ea3a 100644 --- a/screen-orientation/README.md +++ b/screen-orientation/README.md @@ -39,6 +39,7 @@ By default, an iPad allows Multitasking and its orientation cannot be locked. If * [`addListener('screenOrientationChange', ...)`](#addlistenerscreenorientationchange) * [`removeAllListeners()`](#removealllisteners) * [Interfaces](#interfaces) +* [Type Aliases](#type-aliases) @@ -135,9 +136,9 @@ Removes all listeners. #### OrientationLockOptions -| Prop | Type | -| ----------------- | -------------------------------- | -| **`orientation`** | OrientationLockType | +| Prop | Type | Description | +| ----------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| **`orientation`** | OrientationLockType | Note: Typescript v5.2+ users should import OrientationLockType from @capacitor/screen-orientation. | #### PluginListenerHandle @@ -146,4 +147,12 @@ Removes all listeners. | ------------ | ----------------------------------------- | | **`remove`** | () => Promise<void> | + +### Type Aliases + + +#### OrientationLockType + +'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary' + diff --git a/screen-orientation/src/definitions.ts b/screen-orientation/src/definitions.ts index bb6ac99f2..d41217d47 100644 --- a/screen-orientation/src/definitions.ts +++ b/screen-orientation/src/definitions.ts @@ -1,9 +1,22 @@ import type { PluginListenerHandle } from '@capacitor/core'; export interface OrientationLockOptions { + /** + * Note: Typescript v5.2+ users should import OrientationLockType from @capacitor/screen-orientation. + */ orientation: OrientationLockType; } +export type OrientationLockType = + | 'any' + | 'natural' + | 'landscape' + | 'portrait' + | 'portrait-primary' + | 'portrait-secondary' + | 'landscape-primary' + | 'landscape-secondary'; + export interface ScreenOrientationResult { type: OrientationType; }