expo-screen-orientation 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 4.1.1 — 2021-12-08
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
13
17
  ## 4.1.0 — 2021-12-03
14
18
 
15
19
  ### 💡 Others
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '4.1.0'
6
+ version = '4.1.1'
7
7
 
8
8
  buildscript {
9
9
  // Simple helper that allows the root project to override versions declared by this library.
@@ -57,7 +57,7 @@ android {
57
57
  minSdkVersion safeExtGet("minSdkVersion", 21)
58
58
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
59
59
  versionCode 7
60
- versionName '4.1.0'
60
+ versionName '4.1.1'
61
61
  }
62
62
  lintOptions {
63
63
  abortOnError false
@@ -3,12 +3,12 @@ import { Orientation, OrientationChangeEvent, OrientationChangeListener, Orienta
3
3
  export { Orientation, OrientationLock, PlatformOrientationInfo, OrientationChangeListener, OrientationChangeEvent, WebOrientationLock, WebOrientation, SizeClassIOS, ScreenOrientationInfo, Subscription, };
4
4
  /**
5
5
  * Lock the screen orientation to a particular `OrientationLock`.
6
- * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#screenorientationorientationlock)
6
+ * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#orientationlock)
7
7
  * enum for possible values.
8
8
  * @return Returns a promise with `void` value, which fulfils when the orientation is set.
9
9
  *
10
10
  * # Error codes
11
- * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#screenorientationorientationlock)
11
+ * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#orientationlock)
12
12
  * was passed in.
13
13
  * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the
14
14
  * orientation lock policy.
@@ -23,13 +23,13 @@ export { Orientation, OrientationLock, PlatformOrientationInfo, OrientationChang
23
23
  */
24
24
  export declare function lockAsync(orientationLock: OrientationLock): Promise<void>;
25
25
  /**
26
- * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)
26
+ * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#platformorientationinfo)
27
27
  * object type for the different platform formats.
28
28
  * @return Returns a promise with `void` value, resolving when the orientation is set and rejecting
29
29
  * if an invalid option or value is passed.
30
30
  *
31
31
  * # Error codes
32
- * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#screenorientationorientationlock)
32
+ * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#orientationlock)
33
33
  * was passed in.
34
34
  * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the
35
35
  * orientation lock policy.
@@ -58,7 +58,7 @@ export declare function unlockAsync(): Promise<void>;
58
58
  export declare function getOrientationAsync(): Promise<Orientation>;
59
59
  /**
60
60
  * Gets the current screen orientation lock type.
61
- * @return Returns a promise which fulfils with an [`OrientationLock`](#screenorientationorientationlock)
61
+ * @return Returns a promise which fulfils with an [`OrientationLock`](#orientationlock)
62
62
  * value.
63
63
  *
64
64
  * # Error codes
@@ -67,7 +67,7 @@ export declare function getOrientationAsync(): Promise<Orientation>;
67
67
  export declare function getOrientationLockAsync(): Promise<OrientationLock>;
68
68
  /**
69
69
  * Gets the platform specific screen orientation lock type.
70
- * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)
70
+ * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#platformorientationinfo)
71
71
  * value.
72
72
  *
73
73
  * # Error codes
@@ -76,7 +76,7 @@ export declare function getOrientationLockAsync(): Promise<OrientationLock>;
76
76
  */
77
77
  export declare function getPlatformOrientationLockAsync(): Promise<PlatformOrientationInfo>;
78
78
  /**
79
- * Returns whether the [`OrientationLock`](#screenorientationorientationlock) policy is supported on
79
+ * Returns whether the [`OrientationLock`](#orientationlock) policy is supported on
80
80
  * the device.
81
81
  * @param orientationLock
82
82
  * @return Returns a promise that resolves to a `boolean` value that reflects whether or not the
@@ -88,7 +88,7 @@ export declare function supportsOrientationLockAsync(orientationLock: Orientatio
88
88
  * or from `landscape` to `portrait`. For example, it won't be invoked when screen orientation
89
89
  * change from `portrait up` to `portrait down`, but it will be called when there was a change from
90
90
  * `portrait up` to `landscape left`.
91
- * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#screenorientationorientationchangeevent)
91
+ * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#orientationchangeevent)
92
92
  * to the listener.
93
93
  */
94
94
  export declare function addOrientationChangeListener(listener: OrientationChangeListener): Subscription;
@@ -8,12 +8,12 @@ let _lastOrientationLock = OrientationLock.UNKNOWN;
8
8
  // @needsAudit
9
9
  /**
10
10
  * Lock the screen orientation to a particular `OrientationLock`.
11
- * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#screenorientationorientationlock)
11
+ * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#orientationlock)
12
12
  * enum for possible values.
13
13
  * @return Returns a promise with `void` value, which fulfils when the orientation is set.
14
14
  *
15
15
  * # Error codes
16
- * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#screenorientationorientationlock)
16
+ * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#orientationlock)
17
17
  * was passed in.
18
18
  * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the
19
19
  * orientation lock policy.
@@ -42,13 +42,13 @@ export async function lockAsync(orientationLock) {
42
42
  }
43
43
  // @needsAudit @docsMissing
44
44
  /**
45
- * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)
45
+ * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#platformorientationinfo)
46
46
  * object type for the different platform formats.
47
47
  * @return Returns a promise with `void` value, resolving when the orientation is set and rejecting
48
48
  * if an invalid option or value is passed.
49
49
  *
50
50
  * # Error codes
51
- * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#screenorientationorientationlock)
51
+ * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#orientationlock)
52
52
  * was passed in.
53
53
  * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the
54
54
  * orientation lock policy.
@@ -126,7 +126,7 @@ export async function getOrientationAsync() {
126
126
  // @needsAudit
127
127
  /**
128
128
  * Gets the current screen orientation lock type.
129
- * @return Returns a promise which fulfils with an [`OrientationLock`](#screenorientationorientationlock)
129
+ * @return Returns a promise which fulfils with an [`OrientationLock`](#orientationlock)
130
130
  * value.
131
131
  *
132
132
  * # Error codes
@@ -141,7 +141,7 @@ export async function getOrientationLockAsync() {
141
141
  // @needsAudit
142
142
  /**
143
143
  * Gets the platform specific screen orientation lock type.
144
- * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)
144
+ * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#platformorientationinfo)
145
145
  * value.
146
146
  *
147
147
  * # Error codes
@@ -171,7 +171,7 @@ export async function getPlatformOrientationLockAsync() {
171
171
  }
172
172
  // @needsAudit @docsMissing
173
173
  /**
174
- * Returns whether the [`OrientationLock`](#screenorientationorientationlock) policy is supported on
174
+ * Returns whether the [`OrientationLock`](#orientationlock) policy is supported on
175
175
  * the device.
176
176
  * @param orientationLock
177
177
  * @return Returns a promise that resolves to a `boolean` value that reflects whether or not the
@@ -202,7 +202,7 @@ function getEventName() {
202
202
  * or from `landscape` to `portrait`. For example, it won't be invoked when screen orientation
203
203
  * change from `portrait up` to `portrait down`, but it will be called when there was a change from
204
204
  * `portrait up` to `landscape left`.
205
- * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#screenorientationorientationchangeevent)
205
+ * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#orientationchangeevent)
206
206
  * to the listener.
207
207
  */
208
208
  export function addOrientationChangeListener(listener) {
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenOrientation.js","sourceRoot":"","sources":["../src/ScreenOrientation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE9F,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,WAAW,EAGX,eAAe,EAEf,kBAAkB,EAClB,cAAc,EACd,YAAY,GAEb,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,WAAW,EACX,eAAe,EAIf,kBAAkB,EAClB,cAAc,EACd,YAAY,GAGb,CAAC;AAEF,MAAM,yBAAyB,GAAG,IAAI,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAC1E,IAAI,6BAA6B,GAAmB,EAAE,CAAC;AAEvD,IAAI,oBAAoB,GAAoB,eAAe,CAAC,OAAO,CAAC;AAEpE,cAAc;AACd;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,eAAgC;IAC9D,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE;QACpC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;KACjE;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxD,IAAI,CAAC,g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ACpD,UAAU,CAAC,MAAM,EAAE,CAAC;QAEpB,wCAAwC;QACxC,6BAA6B,CAAC,GAAG,EAAE,CAAC;KACrC;AACH,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,YAA0B;IACxE,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACzC,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;KAC1D;IACD,YAAY,CAAC,MAAM,EAAE,CAAC;IACtB,6BAA6B,GAAG,6BAA6B,CAAC,MAAM,CAClE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,YAAY,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { EventEmitter, Platform, Subscription, UnavailabilityError } from 'expo-modules-core';\n\nimport ExpoScreenOrientation from './ExpoScreenOrientation';\nimport {\n Orientation,\n OrientationChangeEvent,\n OrientationChangeListener,\n OrientationLock,\n PlatformOrientationInfo,\n WebOrientationLock,\n WebOrientation,\n SizeClassIOS,\n ScreenOrientationInfo,\n} from './ScreenOrientation.types';\n\nexport {\n Orientation,\n OrientationLock,\n PlatformOrientationInfo,\n OrientationChangeListener,\n OrientationChangeEvent,\n WebOrientationLock,\n WebOrientation,\n SizeClassIOS,\n ScreenOrientationInfo,\n Subscription,\n};\n\nconst _orientationChangeEmitter = new EventEmitter(ExpoScreenOrientation);\nlet _orientationChangeSubscribers: Subscription[] = [];\n\nlet _lastOrientationLock: OrientationLock = OrientationLock.UNKNOWN;\n\n// @needsAudit\n/**\n * Lock the screen orientation to a particular `OrientationLock`.\n * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#screenorientationorientationlock)\n * enum for possible values.\n * @return Returns a promise with `void` value, which fulfils when the orientation is set.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#screenorientationorientationlock)\n * was passed in.\n * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the\n * orientation lock policy.\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n *\n * @example\n * ```ts\n * async function changeScreenOrientation() {\n * await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE_LEFT);\n * }\n * ```\n */\nexport async function lockAsync(orientationLock: OrientationLock): Promise<void> {\n if (!ExpoScreenOrientation.lockAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'lockAsync');\n }\n\n const orientationLocks = Object.values(OrientationLock);\n if (!orientationLocks.includes(orientationLock)) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n\n if (orientationLock === OrientationLock.OTHER) {\n return;\n }\n\n await ExpoScreenOrientation.lockAsync(orientationLock);\n _lastOrientationLock = orientationLock;\n}\n\n// @needsAudit @docsMissing\n/**\n * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)\n * object type for the different platform formats.\n * @return Returns a promise with `void` value, resolving when the orientation is set and rejecting\n * if an invalid option or value is passed.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#screenorientationorientationlock)\n * was passed in.\n * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the\n * orientation lock policy.\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n *\n */\nexport async function lockPlatformAsync(options: PlatformOrientationInfo): Promise<void> {\n if (!ExpoScreenOrientation.lockPlatformAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'lockPlatformAsync');\n }\n\n const { screenOrientationConstantAndroid, screenOrientationArrayIOS, screenOrientationLockWeb } =\n options;\n let platformOrientationParam: any;\n if (Platform.OS === 'android' && screenOrientationConstantAndroid) {\n if (isNaN(screenOrientationConstantAndroid)) {\n throw new TypeError(\n `lockPlatformAsync Android platform: screenOrientationConstantAndroid cannot be called with ${screenOrientationConstantAndroid}`\n );\n }\n platformOrientationParam = screenOrientationConstantAndroid;\n } else if (Platform.OS === 'ios' && screenOrientationArrayIOS) {\n if (!Array.isArray(screenOrientationArrayIOS)) {\n throw new TypeError(\n `lockPlatformAsync iOS platform: screenOrientationArrayIOS cannot be called with ${screenOrientationArrayIOS}`\n );\n }\n\n const orientations = Object.values(Orientation);\n for (const orientation of screenOrientationArrayIOS) {\n if (!orientations.includes(orientation)) {\n throw new TypeError(\n `lockPlatformAsync iOS platform: ${orientation} is not a valid Orientation`\n );\n }\n }\n platformOrientationParam = screenOrientationArrayIOS;\n } else if (Platform.OS === 'web' && screenOrientationLockWeb) {\n const webOrientationLocks = Object.values(WebOrientationLock);\n if (!webOrientationLocks.includes(screenOrientationLockWeb)) {\n throw new TypeError(`Invalid Web Orientation Lock: ${screenOrientationLockWeb}`);\n }\n platformOrientationParam = screenOrientationLockWeb;\n }\n\n if (!platformOrientationParam) {\n throw new TypeError('lockPlatformAsync cannot be called with undefined option properties');\n }\n await ExpoScreenOrientation.lockPlatformAsync(platformOrientationParam);\n _lastOrientationLock = OrientationLock.OTHER;\n}\n\n// @needsAudit\n/**\n * Sets the screen orientation back to the `OrientationLock.DEFAULT` policy.\n * @return Returns a promise with `void` value, which fulfils when the orientation is set.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function unlockAsync(): Promise<void> {\n if (!ExpoScreenOrientation.lockAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'lockAsync');\n }\n await ExpoScreenOrientation.lockAsync(OrientationLock.DEFAULT);\n}\n\n// @needsAudit\n/**\n * Gets the current screen orientation.\n * @return Returns a promise that fulfils with an [`Orientation`](#screenorientationorientation)\n * value that reflects the current screen orientation.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_GET_ORIENTATION_LOCK` - __Android Only.__ An unknown error occurred\n * when trying to get the system lock.\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function getOrientationAsync(): Promise<Orientation> {\n if (!ExpoScreenOrientation.getOrientationAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'getOrientationAsync');\n }\n return await ExpoScreenOrientation.getOrientationAsync();\n}\n\n// @needsAudit\n/**\n * Gets the current screen orientation lock type.\n * @return Returns a promise which fulfils with an [`OrientationLock`](#screenorientationorientationlock)\n * value.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function getOrientationLockAsync(): Promise<OrientationLock> {\n if (!ExpoScreenOrientation.getOrientationLockAsync) {\n return _lastOrientationLock;\n }\n return await ExpoScreenOrientation.getOrientationLockAsync();\n}\n\n// @needsAudit\n/**\n * Gets the platform specific screen orientation lock type.\n * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)\n * value.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_GET_PLATFORM_ORIENTATION_LOCK`\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function getPlatformOrientationLockAsync(): Promise<PlatformOrientationInfo> {\n const platformOrientationLock = await ExpoScreenOrientation.getPlatformOrientationLockAsync();\n if (Platform.OS === 'android') {\n return {\n screenOrientationConstantAndroid: platformOrientationLock,\n };\n } else if (Platform.OS === 'ios') {\n return {\n screenOrientationArrayIOS: platformOrientationLock,\n };\n } else if (Platform.OS === 'web') {\n return {\n screenOrientationLockWeb: platformOrientationLock,\n };\n } else {\n return {};\n }\n}\n\n// @needsAudit @docsMissing\n/**\n * Returns whether the [`OrientationLock`](#screenorientationorientationlock) policy is supported on\n * the device.\n * @param orientationLock\n * @return Returns a promise that resolves to a `boolean` value that reflects whether or not the\n * orientationLock is supported.\n */\nexport async function supportsOrientationLockAsync(\n orientationLock: OrientationLock\n): Promise<boolean> {\n if (!ExpoScreenOrientation.supportsOrientationLockAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'supportsOrientationLockAsync');\n }\n\n const orientationLocks = Object.values(OrientationLock);\n if (!orientationLocks.includes(orientationLock)) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n\n return await ExpoScreenOrientation.supportsOrientationLockAsync(orientationLock);\n}\n\n// Determine the event name lazily so Jest can set up mocks in advance\nfunction getEventName(): string {\n return Platform.OS === 'ios' || Platform.OS === 'web'\n ? 'expoDidUpdateDimensions'\n : 'didUpdateDimensions';\n}\n\n// We rely on RN to emit `didUpdateDimensions`\n// If this method no longer works, it's possible that the underlying RN implementation has changed\n// see https://github.com/facebook/react-native/blob/c31f79fe478b882540d7fd31ee37b53ddbd60a17/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java#L90\n// @needsAudit\n/**\n * Invokes the `listener` function when the screen orientation changes from `portrait` to `landscape`\n * or from `landscape` to `portrait`. For example, it won't be invoked when screen orientation\n * change from `portrait up` to `portrait down`, but it will be called when there was a change from\n * `portrait up` to `landscape left`.\n * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#screenorientationorientationchangeevent)\n * to the listener.\n */\nexport function addOrientationChangeListener(listener: OrientationChangeListener): Subscription {\n if (typeof listener !== 'function') {\n throw new TypeError(`addOrientationChangeListener cannot be called with ${listener}`);\n }\n const subscription = _orientationChangeEmitter.addListener(\n getEventName(),\n async (update: OrientationChangeEvent) => {\n let orientationInfo, orientationLock;\n if (Platform.OS === 'ios' || Platform.OS === 'web') {\n // For iOS, RN relies on statusBarOrientation (deprecated) to emit `didUpdateDimensions`\n // event, so we emit our own `expoDidUpdateDimensions` event instead\n orientationLock = update.orientationLock;\n orientationInfo = update.orientationInfo;\n } else {\n // We rely on the RN Dimensions to emit the `didUpdateDimensions` event on Android\n let orientation;\n [orientationLock, orientation] = await Promise.all([\n getOrientationLockAsync(),\n getOrientationAsync(),\n ]);\n orientationInfo = { orientation };\n }\n listener({ orientationInfo, orientationLock });\n }\n );\n _orientationChangeSubscribers.push(subscription);\n return subscription;\n}\n\n// We need to keep track of our own subscribers because EventEmitter uses a shared subscriber\n// from NativeEventEmitter that is registered to the same eventTypes as us. Directly calling\n// removeAllListeners(eventName) will remove other module's subscribers.\n// @needsAudit\n/**\n * Removes all listeners subscribed to orientation change updates.\n */\nexport function removeOrientationChangeListeners(): void {\n // Remove listener by subscription instead of eventType to avoid clobbering Dimension module's subscription of didUpdateDimensions\n let i = _orientationChangeSubscribers.length;\n while (i--) {\n const subscriber = _orientationChangeSubscribers[i];\n subscriber.remove();\n\n // remove after a successful unsubscribe\n _orientationChangeSubscribers.pop();\n }\n}\n\n// @needsAudit\n/**\n * Unsubscribes the listener associated with the `Subscription` object from all orientation change\n * updates.\n * @param subscription A subscription object that manages the updates passed to a listener function\n * on an orientation change.\n */\nexport function removeOrientationChangeListener(subscription: Subscription): void {\n if (!subscription || !subscription.remove) {\n throw new TypeError(`Must pass in a valid subscription`);\n }\n subscription.remove();\n _orientationChangeSubscribers = _orientationChangeSubscribers.filter(\n (sub) => sub !== subscription\n );\n}\n"]}
1
+ {"version":3,"file":"ScreenOrientation.js","sourceRoot":"","sources":["../src/ScreenOrientation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE9F,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,WAAW,EAGX,eAAe,EAEf,kBAAkB,EAClB,cAAc,EACd,YAAY,GAEb,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,WAAW,EACX,eAAe,EAIf,kBAAkB,EAClB,cAAc,EACd,YAAY,GAGb,CAAC;AAEF,MAAM,yBAAyB,GAAG,IAAI,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAC1E,IAAI,6BAA6B,GAAmB,E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CAAC;IACjD,CAAC,CACF,CAAC;IACF,6BAA6B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,6FAA6F;AAC7F,4FAA4F;AAC5F,wEAAwE;AACxE,cAAc;AACd;;GAEG;AACH,MAAM,UAAU,gCAAgC;IAC9C,kIAAkI;IAClI,IAAI,CAAC,GAAG,6BAA6B,CAAC,MAAM,CAAC;IAC7C,OAAO,CAAC,EAAE,EAAE;QACV,MAAM,UAAU,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC;QACpD,UAAU,CAAC,MAAM,EAAE,CAAC;QAEpB,wCAAwC;QACxC,6BAA6B,CAAC,GAAG,EAAE,CAAC;KACrC;AACH,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,YAA0B;IACxE,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACzC,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;KAC1D;IACD,YAAY,CAAC,MAAM,EAAE,CAAC;IACtB,6BAA6B,GAAG,6BAA6B,CAAC,MAAM,CAClE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,YAAY,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { EventEmitter, Platform, Subscription, UnavailabilityError } from 'expo-modules-core';\n\nimport ExpoScreenOrientation from './ExpoScreenOrientation';\nimport {\n Orientation,\n OrientationChangeEvent,\n OrientationChangeListener,\n OrientationLock,\n PlatformOrientationInfo,\n WebOrientationLock,\n WebOrientation,\n SizeClassIOS,\n ScreenOrientationInfo,\n} from './ScreenOrientation.types';\n\nexport {\n Orientation,\n OrientationLock,\n PlatformOrientationInfo,\n OrientationChangeListener,\n OrientationChangeEvent,\n WebOrientationLock,\n WebOrientation,\n SizeClassIOS,\n ScreenOrientationInfo,\n Subscription,\n};\n\nconst _orientationChangeEmitter = new EventEmitter(ExpoScreenOrientation);\nlet _orientationChangeSubscribers: Subscription[] = [];\n\nlet _lastOrientationLock: OrientationLock = OrientationLock.UNKNOWN;\n\n// @needsAudit\n/**\n * Lock the screen orientation to a particular `OrientationLock`.\n * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#orientationlock)\n * enum for possible values.\n * @return Returns a promise with `void` value, which fulfils when the orientation is set.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#orientationlock)\n * was passed in.\n * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the\n * orientation lock policy.\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n *\n * @example\n * ```ts\n * async function changeScreenOrientation() {\n * await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE_LEFT);\n * }\n * ```\n */\nexport async function lockAsync(orientationLock: OrientationLock): Promise<void> {\n if (!ExpoScreenOrientation.lockAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'lockAsync');\n }\n\n const orientationLocks = Object.values(OrientationLock);\n if (!orientationLocks.includes(orientationLock)) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n\n if (orientationLock === OrientationLock.OTHER) {\n return;\n }\n\n await ExpoScreenOrientation.lockAsync(orientationLock);\n _lastOrientationLock = orientationLock;\n}\n\n// @needsAudit @docsMissing\n/**\n * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#platformorientationinfo)\n * object type for the different platform formats.\n * @return Returns a promise with `void` value, resolving when the orientation is set and rejecting\n * if an invalid option or value is passed.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#orientationlock)\n * was passed in.\n * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the\n * orientation lock policy.\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n *\n */\nexport async function lockPlatformAsync(options: PlatformOrientationInfo): Promise<void> {\n if (!ExpoScreenOrientation.lockPlatformAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'lockPlatformAsync');\n }\n\n const { screenOrientationConstantAndroid, screenOrientationArrayIOS, screenOrientationLockWeb } =\n options;\n let platformOrientationParam: any;\n if (Platform.OS === 'android' && screenOrientationConstantAndroid) {\n if (isNaN(screenOrientationConstantAndroid)) {\n throw new TypeError(\n `lockPlatformAsync Android platform: screenOrientationConstantAndroid cannot be called with ${screenOrientationConstantAndroid}`\n );\n }\n platformOrientationParam = screenOrientationConstantAndroid;\n } else if (Platform.OS === 'ios' && screenOrientationArrayIOS) {\n if (!Array.isArray(screenOrientationArrayIOS)) {\n throw new TypeError(\n `lockPlatformAsync iOS platform: screenOrientationArrayIOS cannot be called with ${screenOrientationArrayIOS}`\n );\n }\n\n const orientations = Object.values(Orientation);\n for (const orientation of screenOrientationArrayIOS) {\n if (!orientations.includes(orientation)) {\n throw new TypeError(\n `lockPlatformAsync iOS platform: ${orientation} is not a valid Orientation`\n );\n }\n }\n platformOrientationParam = screenOrientationArrayIOS;\n } else if (Platform.OS === 'web' && screenOrientationLockWeb) {\n const webOrientationLocks = Object.values(WebOrientationLock);\n if (!webOrientationLocks.includes(screenOrientationLockWeb)) {\n throw new TypeError(`Invalid Web Orientation Lock: ${screenOrientationLockWeb}`);\n }\n platformOrientationParam = screenOrientationLockWeb;\n }\n\n if (!platformOrientationParam) {\n throw new TypeError('lockPlatformAsync cannot be called with undefined option properties');\n }\n await ExpoScreenOrientation.lockPlatformAsync(platformOrientationParam);\n _lastOrientationLock = OrientationLock.OTHER;\n}\n\n// @needsAudit\n/**\n * Sets the screen orientation back to the `OrientationLock.DEFAULT` policy.\n * @return Returns a promise with `void` value, which fulfils when the orientation is set.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function unlockAsync(): Promise<void> {\n if (!ExpoScreenOrientation.lockAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'lockAsync');\n }\n await ExpoScreenOrientation.lockAsync(OrientationLock.DEFAULT);\n}\n\n// @needsAudit\n/**\n * Gets the current screen orientation.\n * @return Returns a promise that fulfils with an [`Orientation`](#screenorientationorientation)\n * value that reflects the current screen orientation.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_GET_ORIENTATION_LOCK` - __Android Only.__ An unknown error occurred\n * when trying to get the system lock.\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function getOrientationAsync(): Promise<Orientation> {\n if (!ExpoScreenOrientation.getOrientationAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'getOrientationAsync');\n }\n return await ExpoScreenOrientation.getOrientationAsync();\n}\n\n// @needsAudit\n/**\n * Gets the current screen orientation lock type.\n * @return Returns a promise which fulfils with an [`OrientationLock`](#orientationlock)\n * value.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function getOrientationLockAsync(): Promise<OrientationLock> {\n if (!ExpoScreenOrientation.getOrientationLockAsync) {\n return _lastOrientationLock;\n }\n return await ExpoScreenOrientation.getOrientationLockAsync();\n}\n\n// @needsAudit\n/**\n * Gets the platform specific screen orientation lock type.\n * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#platformorientationinfo)\n * value.\n *\n * # Error codes\n * - `ERR_SCREEN_ORIENTATION_GET_PLATFORM_ORIENTATION_LOCK`\n * - `ERR_SCREEN_ORIENTATION_MISSING_ACTIVITY` - __Android Only.__ Could not get the current activity.\n */\nexport async function getPlatformOrientationLockAsync(): Promise<PlatformOrientationInfo> {\n const platformOrientationLock = await ExpoScreenOrientation.getPlatformOrientationLockAsync();\n if (Platform.OS === 'android') {\n return {\n screenOrientationConstantAndroid: platformOrientationLock,\n };\n } else if (Platform.OS === 'ios') {\n return {\n screenOrientationArrayIOS: platformOrientationLock,\n };\n } else if (Platform.OS === 'web') {\n return {\n screenOrientationLockWeb: platformOrientationLock,\n };\n } else {\n return {};\n }\n}\n\n// @needsAudit @docsMissing\n/**\n * Returns whether the [`OrientationLock`](#orientationlock) policy is supported on\n * the device.\n * @param orientationLock\n * @return Returns a promise that resolves to a `boolean` value that reflects whether or not the\n * orientationLock is supported.\n */\nexport async function supportsOrientationLockAsync(\n orientationLock: OrientationLock\n): Promise<boolean> {\n if (!ExpoScreenOrientation.supportsOrientationLockAsync) {\n throw new UnavailabilityError('ScreenOrientation', 'supportsOrientationLockAsync');\n }\n\n const orientationLocks = Object.values(OrientationLock);\n if (!orientationLocks.includes(orientationLock)) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n\n return await ExpoScreenOrientation.supportsOrientationLockAsync(orientationLock);\n}\n\n// Determine the event name lazily so Jest can set up mocks in advance\nfunction getEventName(): string {\n return Platform.OS === 'ios' || Platform.OS === 'web'\n ? 'expoDidUpdateDimensions'\n : 'didUpdateDimensions';\n}\n\n// We rely on RN to emit `didUpdateDimensions`\n// If this method no longer works, it's possible that the underlying RN implementation has changed\n// see https://github.com/facebook/react-native/blob/c31f79fe478b882540d7fd31ee37b53ddbd60a17/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java#L90\n// @needsAudit\n/**\n * Invokes the `listener` function when the screen orientation changes from `portrait` to `landscape`\n * or from `landscape` to `portrait`. For example, it won't be invoked when screen orientation\n * change from `portrait up` to `portrait down`, but it will be called when there was a change from\n * `portrait up` to `landscape left`.\n * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#orientationchangeevent)\n * to the listener.\n */\nexport function addOrientationChangeListener(listener: OrientationChangeListener): Subscription {\n if (typeof listener !== 'function') {\n throw new TypeError(`addOrientationChangeListener cannot be called with ${listener}`);\n }\n const subscription = _orientationChangeEmitter.addListener(\n getEventName(),\n async (update: OrientationChangeEvent) => {\n let orientationInfo, orientationLock;\n if (Platform.OS === 'ios' || Platform.OS === 'web') {\n // For iOS, RN relies on statusBarOrientation (deprecated) to emit `didUpdateDimensions`\n // event, so we emit our own `expoDidUpdateDimensions` event instead\n orientationLock = update.orientationLock;\n orientationInfo = update.orientationInfo;\n } else {\n // We rely on the RN Dimensions to emit the `didUpdateDimensions` event on Android\n let orientation;\n [orientationLock, orientation] = await Promise.all([\n getOrientationLockAsync(),\n getOrientationAsync(),\n ]);\n orientationInfo = { orientation };\n }\n listener({ orientationInfo, orientationLock });\n }\n );\n _orientationChangeSubscribers.push(subscription);\n return subscription;\n}\n\n// We need to keep track of our own subscribers because EventEmitter uses a shared subscriber\n// from NativeEventEmitter that is registered to the same eventTypes as us. Directly calling\n// removeAllListeners(eventName) will remove other module's subscribers.\n// @needsAudit\n/**\n * Removes all listeners subscribed to orientation change updates.\n */\nexport function removeOrientationChangeListeners(): void {\n // Remove listener by subscription instead of eventType to avoid clobbering Dimension module's subscription of didUpdateDimensions\n let i = _orientationChangeSubscribers.length;\n while (i--) {\n const subscriber = _orientationChangeSubscribers[i];\n subscriber.remove();\n\n // remove after a successful unsubscribe\n _orientationChangeSubscribers.pop();\n }\n}\n\n// @needsAudit\n/**\n * Unsubscribes the listener associated with the `Subscription` object from all orientation change\n * updates.\n * @param subscription A subscription object that manages the updates passed to a listener function\n * on an orientation change.\n */\nexport function removeOrientationChangeListener(subscription: Subscription): void {\n if (!subscription || !subscription.remove) {\n throw new TypeError(`Must pass in a valid subscription`);\n }\n subscription.remove();\n _orientationChangeSubscribers = _orientationChangeSubscribers.filter(\n (sub) => sub !== subscription\n );\n}\n"]}
@@ -24,7 +24,7 @@ export declare enum Orientation {
24
24
  * An enum whose values can be passed to the [`lockAsync`](#screenorientationlockasyncorientationlock)
25
25
  * method.
26
26
  * > __Note:__ `OrientationLock.ALL` and `OrientationLock.PORTRAIT` are invalid on devices which
27
- * don't support `OrientationLock.PORTRAIT_DOWN`.
27
+ * > don't support `OrientationLock.PORTRAIT_DOWN`.
28
28
  */
29
29
  export declare enum OrientationLock {
30
30
  /**
@@ -81,7 +81,7 @@ export declare enum SizeClassIOS {
81
81
  /**
82
82
  * An enum representing the lock policies that can be applied on the web platform, modelled after
83
83
  * the [W3C specification](https://w3c.github.io/screen-orientation/#dom-orientationlocktype).
84
- * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncplatforminfo)
84
+ * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncoptions)
85
85
  * method.
86
86
  */
87
87
  export declare enum WebOrientationLock {
@@ -27,7 +27,7 @@ export var Orientation;
27
27
  * An enum whose values can be passed to the [`lockAsync`](#screenorientationlockasyncorientationlock)
28
28
  * method.
29
29
  * > __Note:__ `OrientationLock.ALL` and `OrientationLock.PORTRAIT` are invalid on devices which
30
- * don't support `OrientationLock.PORTRAIT_DOWN`.
30
+ * > don't support `OrientationLock.PORTRAIT_DOWN`.
31
31
  */
32
32
  export var OrientationLock;
33
33
  (function (OrientationLock) {
@@ -88,7 +88,7 @@ export var SizeClassIOS;
88
88
  /**
89
89
  * An enum representing the lock policies that can be applied on the web platform, modelled after
90
90
  * the [W3C specification](https://w3c.github.io/screen-orientation/#dom-orientationlocktype).
91
- * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncplatforminfo)
91
+ * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncoptions)
92
92
  * method.
93
93
  */
94
94
  export var WebOrientationLock;
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenOrientation.types.js","sourceRoot":"","sources":["../src/ScreenOrientation.types.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;OAEG;IACH,mDAAW,CAAA;IACX;;OAEG;IACH,2DAAe,CAAA;IACf;;OAEG;IACH,+DAAiB,CAAA;IACjB;;OAEG;IACH,iEAAkB,CAAA;IAClB;;OAEG;IACH,mEAAmB,CAAA;AACrB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAN,IAAY,eA0CX;AA1CD,WAAY,eAAe;IACzB;;;OAGG;IACH,2DAAW,CAAA;IACX;;OAEG;IACH,mDAAO,CAAA;IACP;;OAEG;IACH,6DAAY,CAAA;IACZ;;OAEG;IACH,mEAAe,CAAA;IACf;;OAEG;IACH,uEAAiB,CAAA;IACjB;;OAEG;IACH,+DAAa,CAAA;IACb;;OAEG;IACH,yEAAkB,CAAA;IAClB;;OAEG;IACH,2EAAmB,CAAA;IACnB;;OAEG;IACH,uDAAS,CAAA;IACT;;OAEG;IACH,2DAAW,CAAA;AACb,CAAC,EA1CW,eAAe,KAAf,eAAe,QA0C1B;AAED,cAAc;AACd;;;GAGG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,qDAAW,CAAA;IACX,qDAAW,CAAA;AACb,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,2DAAqC,CAAA;IACrC,+DAAyC,CAAA;IACzC,2CAAqB,CAAA;IACrB,6DAAuC,CAAA;IACvC,iEAA2C,CAAA;IAC3C,6CAAuB,CAAA;IACvB,iCAAW,CAAA;IACX,yCAAmB,CAAA;IACnB,yCAAmB,CAAA;AACrB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED,eAAe;AACf,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,uDAAqC,CAAA;IACrC,2DAAyC,CAAA;IACzC,yDAAuC,CAAA;IACvC,6DAA2C,CAAA;AAC7C,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB","sourcesContent":["// @needsAudit\nexport enum Orientation {\n /**\n * An unknown screen orientation. For example, the device is flat, perhaps on a table.\n */\n UNKNOWN = 0,\n /**\n * Right-side up portrait interface orientation.\n */\n PORTRAIT_UP = 1,\n /**\n * Upside down portrait interface orientation.\n */\n PORTRAIT_DOWN = 2,\n /**\n * Left landscape interface orientation.\n */\n LANDSCAPE_LEFT = 3,\n /**\n * Right landscape interface orientation.\n */\n LANDSCAPE_RIGHT = 4,\n}\n\n// @needsAudit\n/**\n * An enum whose values can be passed to the [`lockAsync`](#screenorientationlockasyncorientationlock)\n * method.\n * > __Note:__ `OrientationLock.ALL` and `OrientationLock.PORTRAIT` are invalid on devices which\n * don't support `OrientationLock.PORTRAIT_DOWN`.\n */\nexport enum OrientationLock {\n /**\n * The default orientation. On iOS, this will allow all orientations except `Orientation.PORTRAIT_DOWN`.\n * On Android, this lets the system decide the best orientation.\n */\n DEFAULT = 0,\n /**\n * All four possible orientations\n */\n ALL = 1,\n /**\n * Any portrait orientation.\n */\n PORTRAIT = 2,\n /**\n * Right-side up portrait only.\n */\n PORTRAIT_UP = 3,\n /**\n * Upside down portrait only.\n */\n PORTRAIT_DOWN = 4,\n /**\n * Any landscape orientation.\n */\n LANDSCAPE = 5,\n /**\n * Left landscape only.\n */\n LANDSCAPE_LEFT = 6,\n /**\n * Right landscape only.\n */\n LANDSCAPE_RIGHT = 7,\n /**\n * A platform specific orientation. This is not a valid policy that can be applied in [`lockAsync`](#screenorientationlockasyncorientationlock).\n */\n OTHER = 8,\n /**\n * An unknown screen orientation lock. This is not a valid policy that can be applied in [`lockAsync`](#screenorientationlockasyncorientationlock).\n */\n UNKNOWN = 9,\n}\n\n// @needsAudit\n/**\n * Each iOS device has a default set of [size classes](https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html)\n * that you can use as a guide when designing your interface.\n */\nexport enum SizeClassIOS {\n REGULAR = 0,\n COMPACT = 1,\n UNKNOWN = 2,\n}\n\n// @needsAudit\n/**\n * An enum representing the lock policies that can be applied on the web platform, modelled after\n * the [W3C specification](https://w3c.github.io/screen-orientation/#dom-orientationlocktype).\n * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncplatforminfo)\n * method.\n */\nexport enum WebOrientationLock {\n PORTRAIT_PRIMARY = 'portrait-primary',\n PORTRAIT_SECONDARY = 'portrait-secondary',\n PORTRAIT = 'portrait',\n LANDSCAPE_PRIMARY = 'landscape-primary',\n LANDSCAPE_SECONDARY = 'landscape-secondary',\n LANDSCAPE = 'landscape',\n ANY = 'any',\n NATURAL = 'natural',\n UNKNOWN = 'unknown',\n}\n\n// @docsMissing\nexport enum WebOrientation {\n PORTRAIT_PRIMARY = 'portrait-primary',\n PORTRAIT_SECONDARY = 'portrait-secondary',\n LANDSCAPE_PRIMARY = 'landscape-primary',\n LANDSCAPE_SECONDARY = 'landscape-secondary',\n}\n\n// @needsAudit\nexport type PlatformOrientationInfo = {\n /**\n * A constant to set using the Android native [API](https://developer.android.com/reference/android/R.attr.html#screenOrientation).\n * For example, in order to set the lock policy to [unspecified](https://developer.android.com/reference/android/content/pm/ActivityInfo.html#SCREEN_ORIENTATION_UNSPECIFIED),\n * `-1` should be passed in.\n * @platform android\n */\n screenOrientationConstantAndroid?: number;\n /**\n * An array of orientations to allow on the iOS platform.\n * @platform ios\n */\n screenOrientationArrayIOS?: Orientation[];\n /**\n * A web orientation lock to apply in the browser.\n * @platform web\n */\n screenOrientationLockWeb?: WebOrientationLock;\n};\n\n// @needsAudit\nexport type ScreenOrientationInfo = {\n /**\n * The current orientation of the device.\n */\n orientation: Orientation;\n /**\n * The [vertical size class](https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html)\n * of the device.\n * @platform ios\n */\n verticalSizeClass?: SizeClassIOS;\n /**\n * The [horizontal size class](https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html)\n * of the device.\n * @platform ios\n */\n horizontalSizeClass?: SizeClassIOS;\n};\n\nexport type OrientationChangeListener = (event: OrientationChangeEvent) => void;\n\n// @needsAudit\nexport type OrientationChangeEvent = {\n /**\n * The current `OrientationLock` of the device.\n */\n orientationLock: OrientationLock;\n /**\n * The current `ScreenOrientationInfo` of the device.\n */\n orientationInfo: ScreenOrientationInfo;\n};\n"]}
1
+ {"version":3,"file":"ScreenOrientation.types.js","sourceRoot":"","sources":["../src/ScreenOrientation.types.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;OAEG;IACH,mDAAW,CAAA;IACX;;OAEG;IACH,2DAAe,CAAA;IACf;;OAEG;IACH,+DAAiB,CAAA;IACjB;;OAEG;IACH,iEAAkB,CAAA;IAClB;;OAEG;IACH,mEAAmB,CAAA;AACrB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAN,IAAY,eA0CX;AA1CD,WAAY,eAAe;IACzB;;;OAGG;IACH,2DAAW,CAAA;IACX;;OAEG;IACH,mDAAO,CAAA;IACP;;OAEG;IACH,6DAAY,CAAA;IACZ;;OAEG;IACH,mEAAe,CAAA;IACf;;OAEG;IACH,uEAAiB,CAAA;IACjB;;OAEG;IACH,+DAAa,CAAA;IACb;;OAEG;IACH,yEAAkB,CAAA;IAClB;;OAEG;IACH,2EAAmB,CAAA;IACnB;;OAEG;IACH,uDAAS,CAAA;IACT;;OAEG;IACH,2DAAW,CAAA;AACb,CAAC,EA1CW,eAAe,KAAf,eAAe,QA0C1B;AAED,cAAc;AACd;;;GAGG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,qDAAW,CAAA;IACX,qDAAW,CAAA;AACb,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,2DAAqC,CAAA;IACrC,+DAAyC,CAAA;IACzC,2CAAqB,CAAA;IACrB,6DAAuC,CAAA;IACvC,iEAA2C,CAAA;IAC3C,6CAAuB,CAAA;IACvB,iCAAW,CAAA;IACX,yCAAmB,CAAA;IACnB,yCAAmB,CAAA;AACrB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED,eAAe;AACf,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,uDAAqC,CAAA;IACrC,2DAAyC,CAAA;IACzC,yDAAuC,CAAA;IACvC,6DAA2C,CAAA;AAC7C,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB","sourcesContent":["// @needsAudit\nexport enum Orientation {\n /**\n * An unknown screen orientation. For example, the device is flat, perhaps on a table.\n */\n UNKNOWN = 0,\n /**\n * Right-side up portrait interface orientation.\n */\n PORTRAIT_UP = 1,\n /**\n * Upside down portrait interface orientation.\n */\n PORTRAIT_DOWN = 2,\n /**\n * Left landscape interface orientation.\n */\n LANDSCAPE_LEFT = 3,\n /**\n * Right landscape interface orientation.\n */\n LANDSCAPE_RIGHT = 4,\n}\n\n// @needsAudit\n/**\n * An enum whose values can be passed to the [`lockAsync`](#screenorientationlockasyncorientationlock)\n * method.\n * > __Note:__ `OrientationLock.ALL` and `OrientationLock.PORTRAIT` are invalid on devices which\n * > don't support `OrientationLock.PORTRAIT_DOWN`.\n */\nexport enum OrientationLock {\n /**\n * The default orientation. On iOS, this will allow all orientations except `Orientation.PORTRAIT_DOWN`.\n * On Android, this lets the system decide the best orientation.\n */\n DEFAULT = 0,\n /**\n * All four possible orientations\n */\n ALL = 1,\n /**\n * Any portrait orientation.\n */\n PORTRAIT = 2,\n /**\n * Right-side up portrait only.\n */\n PORTRAIT_UP = 3,\n /**\n * Upside down portrait only.\n */\n PORTRAIT_DOWN = 4,\n /**\n * Any landscape orientation.\n */\n LANDSCAPE = 5,\n /**\n * Left landscape only.\n */\n LANDSCAPE_LEFT = 6,\n /**\n * Right landscape only.\n */\n LANDSCAPE_RIGHT = 7,\n /**\n * A platform specific orientation. This is not a valid policy that can be applied in [`lockAsync`](#screenorientationlockasyncorientationlock).\n */\n OTHER = 8,\n /**\n * An unknown screen orientation lock. This is not a valid policy that can be applied in [`lockAsync`](#screenorientationlockasyncorientationlock).\n */\n UNKNOWN = 9,\n}\n\n// @needsAudit\n/**\n * Each iOS device has a default set of [size classes](https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html)\n * that you can use as a guide when designing your interface.\n */\nexport enum SizeClassIOS {\n REGULAR = 0,\n COMPACT = 1,\n UNKNOWN = 2,\n}\n\n// @needsAudit\n/**\n * An enum representing the lock policies that can be applied on the web platform, modelled after\n * the [W3C specification](https://w3c.github.io/screen-orientation/#dom-orientationlocktype).\n * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncoptions)\n * method.\n */\nexport enum WebOrientationLock {\n PORTRAIT_PRIMARY = 'portrait-primary',\n PORTRAIT_SECONDARY = 'portrait-secondary',\n PORTRAIT = 'portrait',\n LANDSCAPE_PRIMARY = 'landscape-primary',\n LANDSCAPE_SECONDARY = 'landscape-secondary',\n LANDSCAPE = 'landscape',\n ANY = 'any',\n NATURAL = 'natural',\n UNKNOWN = 'unknown',\n}\n\n// @docsMissing\nexport enum WebOrientation {\n PORTRAIT_PRIMARY = 'portrait-primary',\n PORTRAIT_SECONDARY = 'portrait-secondary',\n LANDSCAPE_PRIMARY = 'landscape-primary',\n LANDSCAPE_SECONDARY = 'landscape-secondary',\n}\n\n// @needsAudit\nexport type PlatformOrientationInfo = {\n /**\n * A constant to set using the Android native [API](https://developer.android.com/reference/android/R.attr.html#screenOrientation).\n * For example, in order to set the lock policy to [unspecified](https://developer.android.com/reference/android/content/pm/ActivityInfo.html#SCREEN_ORIENTATION_UNSPECIFIED),\n * `-1` should be passed in.\n * @platform android\n */\n screenOrientationConstantAndroid?: number;\n /**\n * An array of orientations to allow on the iOS platform.\n * @platform ios\n */\n screenOrientationArrayIOS?: Orientation[];\n /**\n * A web orientation lock to apply in the browser.\n * @platform web\n */\n screenOrientationLockWeb?: WebOrientationLock;\n};\n\n// @needsAudit\nexport type ScreenOrientationInfo = {\n /**\n * The current orientation of the device.\n */\n orientation: Orientation;\n /**\n * The [vertical size class](https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html)\n * of the device.\n * @platform ios\n */\n verticalSizeClass?: SizeClassIOS;\n /**\n * The [horizontal size class](https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html)\n * of the device.\n * @platform ios\n */\n horizontalSizeClass?: SizeClassIOS;\n};\n\nexport type OrientationChangeListener = (event: OrientationChangeEvent) => void;\n\n// @needsAudit\nexport type OrientationChangeEvent = {\n /**\n * The current `OrientationLock` of the device.\n */\n orientationLock: OrientationLock;\n /**\n * The current `ScreenOrientationInfo` of the device.\n */\n orientationInfo: ScreenOrientationInfo;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-screen-orientation",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Expo universal module for managing device's screen orientation",
5
5
  "main": "build/ScreenOrientation.js",
6
6
  "types": "build/ScreenOrientation.d.ts",
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "2e5c6983b86d5ecfca028ba64002897d8adc2cc4"
47
+ "gitHead": "cf8e7fde1b19e10dd9b74a8af0e9362ae8e14001"
48
48
  }
@@ -34,12 +34,12 @@ let _lastOrientationLock: OrientationLock = OrientationLock.UNKNOWN;
34
34
  // @needsAudit
35
35
  /**
36
36
  * Lock the screen orientation to a particular `OrientationLock`.
37
- * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#screenorientationorientationlock)
37
+ * @param orientationLock The orientation lock to apply. See the [`OrientationLock`](#orientationlock)
38
38
  * enum for possible values.
39
39
  * @return Returns a promise with `void` value, which fulfils when the orientation is set.
40
40
  *
41
41
  * # Error codes
42
- * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#screenorientationorientationlock)
42
+ * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - An invalid [`OrientationLock`](#orientationlock)
43
43
  * was passed in.
44
44
  * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the
45
45
  * orientation lock policy.
@@ -72,13 +72,13 @@ export async function lockAsync(orientationLock: OrientationLock): Promise<void>
72
72
 
73
73
  // @needsAudit @docsMissing
74
74
  /**
75
- * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)
75
+ * @param options The platform specific lock to apply. See the [`PlatformOrientationInfo`](#platformorientationinfo)
76
76
  * object type for the different platform formats.
77
77
  * @return Returns a promise with `void` value, resolving when the orientation is set and rejecting
78
78
  * if an invalid option or value is passed.
79
79
  *
80
80
  * # Error codes
81
- * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#screenorientationorientationlock)
81
+ * - `ERR_SCREEN_ORIENTATION_INVALID_ORIENTATION_LOCK` - __iOS Only.__ An invalid [`OrientationLock`](#orientationlock)
82
82
  * was passed in.
83
83
  * - `ERR_SCREEN_ORIENTATION_UNSUPPORTED_ORIENTATION_LOCK` - The platform does not support the
84
84
  * orientation lock policy.
@@ -167,7 +167,7 @@ export async function getOrientationAsync(): Promise<Orientation> {
167
167
  // @needsAudit
168
168
  /**
169
169
  * Gets the current screen orientation lock type.
170
- * @return Returns a promise which fulfils with an [`OrientationLock`](#screenorientationorientationlock)
170
+ * @return Returns a promise which fulfils with an [`OrientationLock`](#orientationlock)
171
171
  * value.
172
172
  *
173
173
  * # Error codes
@@ -183,7 +183,7 @@ export async function getOrientationLockAsync(): Promise<OrientationLock> {
183
183
  // @needsAudit
184
184
  /**
185
185
  * Gets the platform specific screen orientation lock type.
186
- * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#screenorientationplatformorientationinfo)
186
+ * @return Returns a promise which fulfils with a [`PlatformOrientationInfo`](#platformorientationinfo)
187
187
  * value.
188
188
  *
189
189
  * # Error codes
@@ -211,7 +211,7 @@ export async function getPlatformOrientationLockAsync(): Promise<PlatformOrienta
211
211
 
212
212
  // @needsAudit @docsMissing
213
213
  /**
214
- * Returns whether the [`OrientationLock`](#screenorientationorientationlock) policy is supported on
214
+ * Returns whether the [`OrientationLock`](#orientationlock) policy is supported on
215
215
  * the device.
216
216
  * @param orientationLock
217
217
  * @return Returns a promise that resolves to a `boolean` value that reflects whether or not the
@@ -248,7 +248,7 @@ function getEventName(): string {
248
248
  * or from `landscape` to `portrait`. For example, it won't be invoked when screen orientation
249
249
  * change from `portrait up` to `portrait down`, but it will be called when there was a change from
250
250
  * `portrait up` to `landscape left`.
251
- * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#screenorientationorientationchangeevent)
251
+ * @param listener Each orientation update will pass an object with the new [`OrientationChangeEvent`](#orientationchangeevent)
252
252
  * to the listener.
253
253
  */
254
254
  export function addOrientationChangeListener(listener: OrientationChangeListener): Subscription {
@@ -27,7 +27,7 @@ export enum Orientation {
27
27
  * An enum whose values can be passed to the [`lockAsync`](#screenorientationlockasyncorientationlock)
28
28
  * method.
29
29
  * > __Note:__ `OrientationLock.ALL` and `OrientationLock.PORTRAIT` are invalid on devices which
30
- * don't support `OrientationLock.PORTRAIT_DOWN`.
30
+ * > don't support `OrientationLock.PORTRAIT_DOWN`.
31
31
  */
32
32
  export enum OrientationLock {
33
33
  /**
@@ -88,7 +88,7 @@ export enum SizeClassIOS {
88
88
  /**
89
89
  * An enum representing the lock policies that can be applied on the web platform, modelled after
90
90
  * the [W3C specification](https://w3c.github.io/screen-orientation/#dom-orientationlocktype).
91
- * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncplatforminfo)
91
+ * These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncoptions)
92
92
  * method.
93
93
  */
94
94
  export enum WebOrientationLock {