expo-screen-orientation 8.1.1 → 8.1.3
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 +8 -0
- package/android/build.gradle +2 -2
- package/build/ExpoScreenOrientation.web.d.ts +9 -0
- package/build/ExpoScreenOrientation.web.d.ts.map +1 -1
- package/build/ExpoScreenOrientation.web.js +31 -25
- package/build/ExpoScreenOrientation.web.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1.module → 8.1.3/expo.modules.screenorientation-8.1.3.module} +7 -7
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1.pom → 8.1.3/expo.modules.screenorientation-8.1.3.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.3/expo.modules.screenorientation-8.1.3.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha512 +1 -1
- package/package.json +3 -3
- package/src/ExpoScreenOrientation.web.ts +63 -34
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/8.1.1/expo.modules.screenorientation-8.1.1.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1-sources.jar → 8.1.3/expo.modules.screenorientation-8.1.3-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1-sources.jar.md5 → 8.1.3/expo.modules.screenorientation-8.1.3-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1-sources.jar.sha1 → 8.1.3/expo.modules.screenorientation-8.1.3-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1-sources.jar.sha256 → 8.1.3/expo.modules.screenorientation-8.1.3-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1-sources.jar.sha512 → 8.1.3/expo.modules.screenorientation-8.1.3-sources.jar.sha512} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1.aar → 8.1.3/expo.modules.screenorientation-8.1.3.aar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1.aar.md5 → 8.1.3/expo.modules.screenorientation-8.1.3.aar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1.aar.sha1 → 8.1.3/expo.modules.screenorientation-8.1.3.aar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1.aar.sha256 → 8.1.3/expo.modules.screenorientation-8.1.3.aar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{8.1.1/expo.modules.screenorientation-8.1.1.aar.sha512 → 8.1.3/expo.modules.screenorientation-8.1.3.aar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 8.1.3 — 2025-04-14
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 8.1.2 — 2025-04-11
|
|
18
|
+
|
|
19
|
+
_This version does not introduce any user-facing changes._
|
|
20
|
+
|
|
13
21
|
## 8.1.1 — 2025-04-09
|
|
14
22
|
|
|
15
23
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { NativeModule } from 'expo-modules-core';
|
|
2
2
|
import { Orientation, OrientationLock, WebOrientationLock, ExpoOrientationEvents } from './ScreenOrientation.types';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Screen {
|
|
5
|
+
msOrientation?: Screen['orientation']['type'];
|
|
6
|
+
mozOrientation?: Screen['orientation'];
|
|
7
|
+
mozUnlockOrientation?(): boolean | undefined;
|
|
8
|
+
msUnlockOrientation?(): boolean | undefined;
|
|
9
|
+
unlockOrientation?(): boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
declare class ExpoScreenOrientation extends NativeModule<ExpoOrientationEvents> {
|
|
4
13
|
orientation: ScreenOrientation | null;
|
|
5
14
|
emitOrientationEvent(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoScreenOrientation.web.d.ts","sourceRoot":"","sources":["../src/ExpoScreenOrientation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,EAElB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoScreenOrientation.web.d.ts","sourceRoot":"","sources":["../src/ExpoScreenOrientation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,EAElB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AA2CnC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,aAAa,CAAC,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;QAC9C,cAAc,CAAC,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;QAEvC,oBAAoB,CAAC,IAAI,OAAO,GAAG,SAAS,CAAC;QAC7C,mBAAmB,CAAC,IAAI,OAAO,GAAG,SAAS,CAAC;QAC5C,iBAAiB,CAAC,IAAI,OAAO,GAAG,SAAS,CAAC;KAC3C;CACF;AA+CD,cAAM,qBAAsB,SAAQ,YAAY,CAAC,qBAAqB,CAAC;IACrE,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAE5B;IACH,oBAAoB;IAU1B,cAAc;IAUd,aAAa,IAAI,IAAI;IASf,4BAA4B,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAGhF,+BAA+B,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAG9D,mBAAmB,IAAI,OAAO,CAAC,WAAW,CAAC;IAQ3C,SAAS,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1D,iBAAiB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CA8BnC;;AAED,wBAAiF"}
|
|
@@ -34,25 +34,29 @@ async function _lockAsync(webOrientationLock) {
|
|
|
34
34
|
if (webOrientationLock === WebOrientationLock.UNKNOWN) {
|
|
35
35
|
throw new Error(`expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock that can be applied to the device.`);
|
|
36
36
|
}
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
// Handle modern lock screen web API
|
|
38
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock
|
|
39
|
+
if (screen.orientation &&
|
|
40
|
+
'lock' in screen.orientation &&
|
|
41
|
+
typeof screen.orientation.lock === 'function') {
|
|
40
42
|
await screen.orientation.lock(webOrientationLock);
|
|
43
|
+
return;
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
|
|
46
|
+
const _legacyLockUniversal =
|
|
47
|
+
// @ts-expect-error - These legacy APIs are removed from the types
|
|
48
|
+
screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation;
|
|
49
|
+
// Fallback to outdated legacy web API
|
|
50
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
|
|
51
|
+
if (typeof _legacyLockUniversal === 'function') {
|
|
45
52
|
const legacyLock = _convertToLegacyOrientationLock(webOrientationLock);
|
|
46
|
-
const
|
|
47
|
-
// correct `this` context must be passed in otherwise method call is disallowed by browser
|
|
48
|
-
const isSuccess = lockOrientation.call(screen, legacyLock);
|
|
53
|
+
const isSuccess = _legacyLockUniversal.call(screen, legacyLock);
|
|
49
54
|
if (!isSuccess) {
|
|
50
55
|
throw new Error(`Applying orientation lock: ${JSON.stringify(webOrientationLock)} to device was denied`);
|
|
51
56
|
}
|
|
57
|
+
return;
|
|
52
58
|
}
|
|
53
|
-
|
|
54
|
-
throw new Error(`expo-screen-orientation: The browser doesn't support locking screen orientation.`);
|
|
55
|
-
}
|
|
59
|
+
throw new Error(`expo-screen-orientation: The browser doesn't support locking screen orientation.`);
|
|
56
60
|
}
|
|
57
61
|
let _lastWebOrientationLock = WebOrientationLock.UNKNOWN;
|
|
58
62
|
class ExpoScreenOrientation extends NativeModule {
|
|
@@ -115,25 +119,27 @@ class ExpoScreenOrientation extends NativeModule {
|
|
|
115
119
|
_lastWebOrientationLock = webOrientationLock;
|
|
116
120
|
}
|
|
117
121
|
async unlockAsync() {
|
|
118
|
-
|
|
122
|
+
// Handle modern lock screen web API
|
|
123
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/unlock
|
|
124
|
+
if (screen.orientation &&
|
|
125
|
+
'unlock' in screen.orientation &&
|
|
126
|
+
typeof screen.orientation.unlock === 'function') {
|
|
119
127
|
screen.orientation.unlock();
|
|
128
|
+
return;
|
|
120
129
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// correct `this` context must be passed in otherwise method call is disallowed by browser
|
|
128
|
-
const isSuccess = unlockOrientation.call(screen);
|
|
130
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/unlockOrientation
|
|
131
|
+
const _legacyUnlockUniversal = screen.unlockOrientation || screen.mozUnlockOrientation || screen.msUnlockOrientation;
|
|
132
|
+
// Fallback to outdated legacy web API
|
|
133
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/unlockOrientation
|
|
134
|
+
if (typeof _legacyUnlockUniversal === 'function') {
|
|
135
|
+
const isSuccess = _legacyUnlockUniversal.call(screen);
|
|
129
136
|
if (!isSuccess) {
|
|
130
137
|
throw new Error(`Unlocking screen orientation on device was denied`);
|
|
131
138
|
}
|
|
139
|
+
return;
|
|
132
140
|
}
|
|
133
|
-
|
|
134
|
-
throw new Error(`expo-screen-orientation: The browser doesn't support unlocking screen orientation.`);
|
|
135
|
-
}
|
|
141
|
+
throw new Error(`expo-screen-orientation: The browser doesn't support unlocking screen orientation.`);
|
|
136
142
|
}
|
|
137
143
|
}
|
|
138
|
-
export default registerWebModule(ExpoScreenOrientation);
|
|
144
|
+
export default registerWebModule(ExpoScreenOrientation, 'ExpoScreenOrientation');
|
|
139
145
|
//# sourceMappingURL=ExpoScreenOrientation.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoScreenOrientation.web.js","sourceRoot":"","sources":["../src/ExpoScreenOrientation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAC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AqB,CAAC,CAAC;YAChC,0FAA0F;YAC1F,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { NativeModule, Platform, registerWebModule } from 'expo-modules-core';\n\nimport { getOrientationLockAsync, getOrientationAsync } from './ScreenOrientation';\nimport {\n Orientation,\n OrientationLock,\n WebOrientationLock,\n WebOrientation,\n ExpoOrientationEvents,\n} from './ScreenOrientation.types';\n\nconst OrientationLockAPIToWeb: {\n [lock: string]: WebOrientationLock;\n} = {\n [OrientationLock.DEFAULT]: WebOrientationLock.NATURAL,\n [OrientationLock.ALL]: WebOrientationLock.ANY,\n [OrientationLock.PORTRAIT]: WebOrientationLock.PORTRAIT,\n [OrientationLock.PORTRAIT_UP]: WebOrientationLock.PORTRAIT_PRIMARY,\n [OrientationLock.PORTRAIT_DOWN]: WebOrientationLock.PORTRAIT_SECONDARY,\n [OrientationLock.LANDSCAPE]: WebOrientationLock.LANDSCAPE,\n [OrientationLock.LANDSCAPE_LEFT]: WebOrientationLock.LANDSCAPE_PRIMARY,\n [OrientationLock.LANDSCAPE_RIGHT]: WebOrientationLock.LANDSCAPE_SECONDARY,\n};\n\nconst OrientationWebToAPI: {\n [orientationWeb: string]: Orientation;\n} = {\n [WebOrientation.PORTRAIT_PRIMARY]: Orientation.PORTRAIT_UP,\n [WebOrientation.PORTRAIT_SECONDARY]: Orientation.PORTRAIT_DOWN,\n [WebOrientation.LANDSCAPE_PRIMARY]: Orientation.LANDSCAPE_LEFT,\n [WebOrientation.LANDSCAPE_SECONDARY]: Orientation.LANDSCAPE_RIGHT,\n};\n\ndeclare const window: Window;\n\nconst screen: Screen = Platform.canUseViewport ? window.screen : ({} as Screen);\n\nfunction _convertToLegacyOrientationLock(orientationLock: WebOrientationLock): string | string[] {\n switch (orientationLock) {\n case WebOrientationLock.UNKNOWN:\n throw new Error(\n `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock to be converted.`\n );\n case WebOrientationLock.ANY:\n return ['portrait', 'landscape'];\n case WebOrientationLock.NATURAL:\n return 'default';\n default:\n return orientationLock;\n }\n}\n\nasync function _lockAsync(webOrientationLock: WebOrientationLock): Promise<void> {\n if (webOrientationLock === WebOrientationLock.UNKNOWN) {\n throw new Error(\n `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock that can be applied to the device.`\n );\n }\n // @ts-ignore-error: This is missing in the TypeScript definitions\n if (screen.orientation && screen.orientation.lock) {\n // @ts-ignore-error\n await screen.orientation.lock(webOrientationLock);\n } else if (\n screen['lockOrientation'] ||\n screen['mozLockOrientation'] ||\n screen['msLockOrientation']\n ) {\n const legacyLock = _convertToLegacyOrientationLock(webOrientationLock);\n const lockOrientation =\n screen['lockOrientation'] || screen['mozLockOrientation'] || screen['msLockOrientation'];\n // correct `this` context must be passed in otherwise method call is disallowed by browser\n const isSuccess = lockOrientation.call(screen, legacyLock);\n if (!isSuccess) {\n throw new Error(\n `Applying orientation lock: ${JSON.stringify(webOrientationLock)} to device was denied`\n );\n }\n } else {\n throw new Error(\n `expo-screen-orientation: The browser doesn't support locking screen orientation.`\n );\n }\n}\n\nlet _lastWebOrientationLock: WebOrientationLock = WebOrientationLock.UNKNOWN;\n\nclass ExpoScreenOrientation extends NativeModule<ExpoOrientationEvents> {\n orientation: ScreenOrientation | null = Platform.canUseViewport\n ? screen.orientation || (screen as any).msOrientation || null\n : null;\n async emitOrientationEvent() {\n const [orientationLock, orientation] = await Promise.all([\n getOrientationLockAsync(),\n getOrientationAsync(),\n ]);\n this.emit('expoDidUpdateDimensions', {\n orientationLock,\n orientationInfo: { orientation },\n });\n }\n startObserving() {\n this.listener = () => this.emitOrientationEvent();\n if (Platform.canUseEventListeners) {\n if (this.orientation && this.orientation.addEventListener) {\n this.orientation.addEventListener('change', this.listener);\n } else {\n window.addEventListener('orientationchange', this.listener);\n }\n }\n }\n stopObserving(): void {\n if (Platform.canUseEventListeners) {\n if (this.orientation && this.orientation.removeEventListener) {\n this.orientation.removeEventListener('change', this.listener);\n } else {\n window.removeEventListener('orientationchange', this.listener);\n }\n }\n }\n async supportsOrientationLockAsync(orientationLock: OrientationLock): Promise<boolean> {\n return orientationLock in OrientationLockAPIToWeb;\n }\n async getPlatformOrientationLockAsync(): Promise<WebOrientationLock> {\n return _lastWebOrientationLock;\n }\n async getOrientationAsync(): Promise<Orientation> {\n const webOrientation =\n screen['msOrientation'] || (screen.orientation || screen['mozOrientation'] || {}).type;\n if (!webOrientation) {\n return Orientation.UNKNOWN;\n }\n return OrientationWebToAPI[webOrientation];\n }\n async lockAsync(orientationLock: OrientationLock): Promise<void> {\n const webOrientationLock = OrientationLockAPIToWeb[orientationLock];\n if (!webOrientationLock) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n await _lockAsync(webOrientationLock);\n }\n async lockPlatformAsync(webOrientationLock: WebOrientationLock): Promise<void> {\n await _lockAsync(webOrientationLock);\n _lastWebOrientationLock = webOrientationLock;\n }\n async unlockAsync(): Promise<void> {\n if (screen.orientation && screen.orientation.unlock) {\n screen.orientation.unlock();\n } else if (\n screen['unlockOrientation'] ||\n screen['mozUnlockOrientation'] ||\n screen['msUnlockOrientation']\n ) {\n const unlockOrientation =\n screen['unlockOrientation'] ||\n screen['mozUnlockOrientation'] ||\n screen['msUnlockOrientation'];\n // correct `this` context must be passed in otherwise method call is disallowed by browser\n const isSuccess = unlockOrientation.call(screen);\n if (!isSuccess) {\n throw new Error(`Unlocking screen orientation on device was denied`);\n }\n } else {\n throw new Error(\n `expo-screen-orientation: The browser doesn't support unlocking screen orientation.`\n );\n }\n }\n}\n\nexport default registerWebModule(ExpoScreenOrientation);\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoScreenOrientation.web.js","sourceRoot":"","sources":["../src/ExpoScreenOrientation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAEnC,MAAM,uBAAuB,GAEzB;IACF,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO;IACrD,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,GAAG;IAC7C,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,QAAQ;IACvD,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC,gBAAgB;IAClE,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC,kBAAkB;IACtE,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,SAAS;IACzD,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,iBAAiB;IACtE,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,kBAAkB,CAAC,mBAAmB;CAC1E,CAAC;AAEF,MAAM,mBAAmB,GAErB;IACF,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,WAAW;IAC1D,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC,aAAa;IAC9D,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,WAAW,CAAC,cAAc;IAC9D,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,WAAW,CAAC,eAAe;CAClE,CAAC;AAIF,MAAM,MAAM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WAAW;YAClB,QAAQ,IAAI,MAAM,CAAC,WAAW;YAC9B,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,UAAU,EAC/C,CAAC;YACD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAC5B,OAAO;QACT,CAAC;QAED,iFAAiF;QACjF,MAAM,sBAAsB,GAC1B,MAAM,CAAC,iBAAiB,IAAI,MAAM,CAAC,oBAAoB,IAAI,MAAM,CAAC,mBAAmB,CAAC;QAExF,sCAAsC;QACtC,iFAAiF;QACjF,IAAI,OAAO,sBAAsB,KAAK,UAAU,EAAE,CAAC;YACjD,MAAM,SAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACvE,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { NativeModule, Platform, registerWebModule } from 'expo-modules-core';\n\nimport { getOrientationLockAsync, getOrientationAsync } from './ScreenOrientation';\nimport {\n Orientation,\n OrientationLock,\n WebOrientationLock,\n WebOrientation,\n ExpoOrientationEvents,\n} from './ScreenOrientation.types';\n\nconst OrientationLockAPIToWeb: {\n [lock: string]: WebOrientationLock;\n} = {\n [OrientationLock.DEFAULT]: WebOrientationLock.NATURAL,\n [OrientationLock.ALL]: WebOrientationLock.ANY,\n [OrientationLock.PORTRAIT]: WebOrientationLock.PORTRAIT,\n [OrientationLock.PORTRAIT_UP]: WebOrientationLock.PORTRAIT_PRIMARY,\n [OrientationLock.PORTRAIT_DOWN]: WebOrientationLock.PORTRAIT_SECONDARY,\n [OrientationLock.LANDSCAPE]: WebOrientationLock.LANDSCAPE,\n [OrientationLock.LANDSCAPE_LEFT]: WebOrientationLock.LANDSCAPE_PRIMARY,\n [OrientationLock.LANDSCAPE_RIGHT]: WebOrientationLock.LANDSCAPE_SECONDARY,\n};\n\nconst OrientationWebToAPI: {\n [orientationWeb: string]: Orientation;\n} = {\n [WebOrientation.PORTRAIT_PRIMARY]: Orientation.PORTRAIT_UP,\n [WebOrientation.PORTRAIT_SECONDARY]: Orientation.PORTRAIT_DOWN,\n [WebOrientation.LANDSCAPE_PRIMARY]: Orientation.LANDSCAPE_LEFT,\n [WebOrientation.LANDSCAPE_SECONDARY]: Orientation.LANDSCAPE_RIGHT,\n};\n\ndeclare const window: Window;\n\nconst screen: Screen = Platform.canUseViewport ? window.screen : ({} as Screen);\n\nfunction _convertToLegacyOrientationLock(orientationLock: WebOrientationLock) {\n switch (orientationLock) {\n case WebOrientationLock.UNKNOWN:\n throw new Error(\n `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock to be converted.`\n );\n case WebOrientationLock.ANY:\n return ['portrait', 'landscape'];\n case WebOrientationLock.NATURAL:\n return 'default';\n default:\n return orientationLock;\n }\n}\n\ndeclare global {\n interface Screen {\n msOrientation?: Screen['orientation']['type'];\n mozOrientation?: Screen['orientation'];\n\n mozUnlockOrientation?(): boolean | undefined;\n msUnlockOrientation?(): boolean | undefined;\n unlockOrientation?(): boolean | undefined;\n }\n}\n\nasync function _lockAsync(webOrientationLock: WebOrientationLock): Promise<void> {\n if (webOrientationLock === WebOrientationLock.UNKNOWN) {\n throw new Error(\n `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock that can be applied to the device.`\n );\n }\n\n // Handle modern lock screen web API\n // See: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock\n if (\n screen.orientation &&\n 'lock' in screen.orientation &&\n typeof screen.orientation.lock === 'function'\n ) {\n await screen.orientation.lock(webOrientationLock);\n return;\n }\n\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation\n const _legacyLockUniversal:\n | undefined\n | ((orientation: ReturnType<typeof _convertToLegacyOrientationLock>) => boolean) =\n // @ts-expect-error - These legacy APIs are removed from the types\n screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation;\n\n // Fallback to outdated legacy web API\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation\n if (typeof _legacyLockUniversal === 'function') {\n const legacyLock = _convertToLegacyOrientationLock(webOrientationLock);\n const isSuccess = _legacyLockUniversal.call(screen, legacyLock);\n if (!isSuccess) {\n throw new Error(\n `Applying orientation lock: ${JSON.stringify(webOrientationLock)} to device was denied`\n );\n }\n return;\n }\n\n throw new Error(\n `expo-screen-orientation: The browser doesn't support locking screen orientation.`\n );\n}\n\nlet _lastWebOrientationLock: WebOrientationLock = WebOrientationLock.UNKNOWN;\n\nclass ExpoScreenOrientation extends NativeModule<ExpoOrientationEvents> {\n orientation: ScreenOrientation | null = Platform.canUseViewport\n ? screen.orientation || (screen as any).msOrientation || null\n : null;\n async emitOrientationEvent() {\n const [orientationLock, orientation] = await Promise.all([\n getOrientationLockAsync(),\n getOrientationAsync(),\n ]);\n this.emit('expoDidUpdateDimensions', {\n orientationLock,\n orientationInfo: { orientation },\n });\n }\n startObserving() {\n this.listener = () => this.emitOrientationEvent();\n if (Platform.canUseEventListeners) {\n if (this.orientation && this.orientation.addEventListener) {\n this.orientation.addEventListener('change', this.listener);\n } else {\n window.addEventListener('orientationchange', this.listener);\n }\n }\n }\n stopObserving(): void {\n if (Platform.canUseEventListeners) {\n if (this.orientation && this.orientation.removeEventListener) {\n this.orientation.removeEventListener('change', this.listener);\n } else {\n window.removeEventListener('orientationchange', this.listener);\n }\n }\n }\n async supportsOrientationLockAsync(orientationLock: OrientationLock): Promise<boolean> {\n return orientationLock in OrientationLockAPIToWeb;\n }\n async getPlatformOrientationLockAsync(): Promise<WebOrientationLock> {\n return _lastWebOrientationLock;\n }\n async getOrientationAsync(): Promise<Orientation> {\n const webOrientation =\n screen['msOrientation'] || (screen.orientation || screen['mozOrientation'] || {}).type;\n if (!webOrientation) {\n return Orientation.UNKNOWN;\n }\n return OrientationWebToAPI[webOrientation];\n }\n async lockAsync(orientationLock: OrientationLock): Promise<void> {\n const webOrientationLock = OrientationLockAPIToWeb[orientationLock];\n if (!webOrientationLock) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n await _lockAsync(webOrientationLock);\n }\n async lockPlatformAsync(webOrientationLock: WebOrientationLock): Promise<void> {\n await _lockAsync(webOrientationLock);\n _lastWebOrientationLock = webOrientationLock;\n }\n async unlockAsync(): Promise<void> {\n // Handle modern lock screen web API\n // See: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/unlock\n if (\n screen.orientation &&\n 'unlock' in screen.orientation &&\n typeof screen.orientation.unlock === 'function'\n ) {\n screen.orientation.unlock();\n return;\n }\n\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/unlockOrientation\n const _legacyUnlockUniversal: undefined | (() => boolean | undefined) =\n screen.unlockOrientation || screen.mozUnlockOrientation || screen.msUnlockOrientation;\n\n // Fallback to outdated legacy web API\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/unlockOrientation\n if (typeof _legacyUnlockUniversal === 'function') {\n const isSuccess = _legacyUnlockUniversal.call(screen);\n if (!isSuccess) {\n throw new Error(`Unlocking screen orientation on device was denied`);\n }\n return;\n }\n\n throw new Error(\n `expo-screen-orientation: The browser doesn't support unlocking screen orientation.`\n );\n }\n}\n\nexport default registerWebModule(ExpoScreenOrientation, 'ExpoScreenOrientation');\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.screenorientation",
|
|
6
|
-
"version": "8.1.
|
|
6
|
+
"version": "8.1.3",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.screenorientation-8.1.
|
|
28
|
-
"url": "expo.modules.screenorientation-8.1.
|
|
27
|
+
"name": "expo.modules.screenorientation-8.1.3.aar",
|
|
28
|
+
"url": "expo.modules.screenorientation-8.1.3.aar",
|
|
29
29
|
"size": 36475,
|
|
30
30
|
"sha512": "a4b3c18f9651ead41fb1fe22c1e6b790b9d7c68491d80e58e790f6c1171f398fb4156ef115553a155f1ef7aa77b452271e03427c0f10baae2e2a141f6e10da7b",
|
|
31
31
|
"sha256": "c60d4a82ab38a0ee50e0e163b0b070b1428604a0c9eb88122459bb788eeff98b",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
],
|
|
54
54
|
"files": [
|
|
55
55
|
{
|
|
56
|
-
"name": "expo.modules.screenorientation-8.1.
|
|
57
|
-
"url": "expo.modules.screenorientation-8.1.
|
|
56
|
+
"name": "expo.modules.screenorientation-8.1.3.aar",
|
|
57
|
+
"url": "expo.modules.screenorientation-8.1.3.aar",
|
|
58
58
|
"size": 36475,
|
|
59
59
|
"sha512": "a4b3c18f9651ead41fb1fe22c1e6b790b9d7c68491d80e58e790f6c1171f398fb4156ef115553a155f1ef7aa77b452271e03427c0f10baae2e2a141f6e10da7b",
|
|
60
60
|
"sha256": "c60d4a82ab38a0ee50e0e163b0b070b1428604a0c9eb88122459bb788eeff98b",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"files": [
|
|
75
75
|
{
|
|
76
|
-
"name": "expo.modules.screenorientation-8.1.
|
|
77
|
-
"url": "expo.modules.screenorientation-8.1.
|
|
76
|
+
"name": "expo.modules.screenorientation-8.1.3-sources.jar",
|
|
77
|
+
"url": "expo.modules.screenorientation-8.1.3-sources.jar",
|
|
78
78
|
"size": 5194,
|
|
79
79
|
"sha512": "e06be0d0236539250b81b1d5670d89f70600b03c82fa53c245602afdcb2bab06d04d42e6dd85e9686867d069a8b09dd3fbc04f562bc1760e33f68ea614b2ec42",
|
|
80
80
|
"sha256": "d63ace679c73e409ffd1706ac43973134e9151254bf644d73a33c27539db1037",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aa5df2e44d7e2a565a0e84a9fd22e7e4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f51e07c9d3adeb33f778f073c51e51c2321d45ae
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
38e215ebd25a9a7d45ff400c7bce0534434fdfa797c355e24dc8dd284d5d2344
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
221253328fed36c152aa5dae8e4bb07aca505d3dc97cca1c11967e921a908cc828ebdbf76f25da674ed2792b1ebe085dc6bb1cde65f1092d8aa28f9b6a21b9d0
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.screenorientation</artifactId>
|
|
12
|
-
<version>8.1.
|
|
12
|
+
<version>8.1.3</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.screenorientation</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
68afad167aeac67a9f0bb21242b5710d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f94dc4247d51ea24b20e352120d3905ebe8b1d9d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
652bbf6492af7a3f4d115450e2c4d5bde4bf9aeaecafcf4998233d2e2bf1ecd9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dd2bac19e5e5fb7bb0679690503dc7ac98b3a6bb3c59004361bd29ce20c40a56f47cbc63475a597f7191474936a7050fbcb3c4226c8db04d1fce85df3d5e39fb
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.screenorientation</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>8.1.
|
|
7
|
-
<release>8.1.
|
|
6
|
+
<latest>8.1.3</latest>
|
|
7
|
+
<release>8.1.3</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>8.1.
|
|
9
|
+
<version>8.1.3</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250414184111</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.md5
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1352cc4fe58812efc4855272406d455c
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha1
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3c83bc1ab38ac6a01705d6b85cf0420ba3260cd3
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
221ac3a4f845adf18302ca12b37628e2783a2a825a64044bf61228b6e101dfd8
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1474ca54c89f74f75620aefeff6483fae36fd68fd4a98abbdfe2469b082cee7824d5e598af5c44e28d190d398801ef1738e41d3aee81aa984da6a87c6d6bad1a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-screen-orientation",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.3",
|
|
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",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"preset": "expo-module-scripts"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"expo-module-scripts": "^4.1.
|
|
39
|
+
"expo-module-scripts": "^4.1.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"expo": "*",
|
|
43
43
|
"react-native": "*"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "335e9312f5caf634097354a230f0d4bbbfb9b0ba"
|
|
46
46
|
}
|
|
@@ -35,7 +35,7 @@ declare const window: Window;
|
|
|
35
35
|
|
|
36
36
|
const screen: Screen = Platform.canUseViewport ? window.screen : ({} as Screen);
|
|
37
37
|
|
|
38
|
-
function _convertToLegacyOrientationLock(orientationLock: WebOrientationLock)
|
|
38
|
+
function _convertToLegacyOrientationLock(orientationLock: WebOrientationLock) {
|
|
39
39
|
switch (orientationLock) {
|
|
40
40
|
case WebOrientationLock.UNKNOWN:
|
|
41
41
|
throw new Error(
|
|
@@ -50,36 +50,58 @@ function _convertToLegacyOrientationLock(orientationLock: WebOrientationLock): s
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
declare global {
|
|
54
|
+
interface Screen {
|
|
55
|
+
msOrientation?: Screen['orientation']['type'];
|
|
56
|
+
mozOrientation?: Screen['orientation'];
|
|
57
|
+
|
|
58
|
+
mozUnlockOrientation?(): boolean | undefined;
|
|
59
|
+
msUnlockOrientation?(): boolean | undefined;
|
|
60
|
+
unlockOrientation?(): boolean | undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
53
64
|
async function _lockAsync(webOrientationLock: WebOrientationLock): Promise<void> {
|
|
54
65
|
if (webOrientationLock === WebOrientationLock.UNKNOWN) {
|
|
55
66
|
throw new Error(
|
|
56
67
|
`expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock that can be applied to the device.`
|
|
57
68
|
);
|
|
58
69
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
screen
|
|
66
|
-
screen['msLockOrientation']
|
|
70
|
+
|
|
71
|
+
// Handle modern lock screen web API
|
|
72
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock
|
|
73
|
+
if (
|
|
74
|
+
screen.orientation &&
|
|
75
|
+
'lock' in screen.orientation &&
|
|
76
|
+
typeof screen.orientation.lock === 'function'
|
|
67
77
|
) {
|
|
78
|
+
await screen.orientation.lock(webOrientationLock);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
|
|
83
|
+
const _legacyLockUniversal:
|
|
84
|
+
| undefined
|
|
85
|
+
| ((orientation: ReturnType<typeof _convertToLegacyOrientationLock>) => boolean) =
|
|
86
|
+
// @ts-expect-error - These legacy APIs are removed from the types
|
|
87
|
+
screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation;
|
|
88
|
+
|
|
89
|
+
// Fallback to outdated legacy web API
|
|
90
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
|
|
91
|
+
if (typeof _legacyLockUniversal === 'function') {
|
|
68
92
|
const legacyLock = _convertToLegacyOrientationLock(webOrientationLock);
|
|
69
|
-
const
|
|
70
|
-
screen['lockOrientation'] || screen['mozLockOrientation'] || screen['msLockOrientation'];
|
|
71
|
-
// correct `this` context must be passed in otherwise method call is disallowed by browser
|
|
72
|
-
const isSuccess = lockOrientation.call(screen, legacyLock);
|
|
93
|
+
const isSuccess = _legacyLockUniversal.call(screen, legacyLock);
|
|
73
94
|
if (!isSuccess) {
|
|
74
95
|
throw new Error(
|
|
75
96
|
`Applying orientation lock: ${JSON.stringify(webOrientationLock)} to device was denied`
|
|
76
97
|
);
|
|
77
98
|
}
|
|
78
|
-
|
|
79
|
-
throw new Error(
|
|
80
|
-
`expo-screen-orientation: The browser doesn't support locking screen orientation.`
|
|
81
|
-
);
|
|
99
|
+
return;
|
|
82
100
|
}
|
|
101
|
+
|
|
102
|
+
throw new Error(
|
|
103
|
+
`expo-screen-orientation: The browser doesn't support locking screen orientation.`
|
|
104
|
+
);
|
|
83
105
|
}
|
|
84
106
|
|
|
85
107
|
let _lastWebOrientationLock: WebOrientationLock = WebOrientationLock.UNKNOWN;
|
|
@@ -143,28 +165,35 @@ class ExpoScreenOrientation extends NativeModule<ExpoOrientationEvents> {
|
|
|
143
165
|
_lastWebOrientationLock = webOrientationLock;
|
|
144
166
|
}
|
|
145
167
|
async unlockAsync(): Promise<void> {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
screen
|
|
150
|
-
|
|
151
|
-
screen
|
|
168
|
+
// Handle modern lock screen web API
|
|
169
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/unlock
|
|
170
|
+
if (
|
|
171
|
+
screen.orientation &&
|
|
172
|
+
'unlock' in screen.orientation &&
|
|
173
|
+
typeof screen.orientation.unlock === 'function'
|
|
152
174
|
) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
175
|
+
screen.orientation.unlock();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/unlockOrientation
|
|
180
|
+
const _legacyUnlockUniversal: undefined | (() => boolean | undefined) =
|
|
181
|
+
screen.unlockOrientation || screen.mozUnlockOrientation || screen.msUnlockOrientation;
|
|
182
|
+
|
|
183
|
+
// Fallback to outdated legacy web API
|
|
184
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/unlockOrientation
|
|
185
|
+
if (typeof _legacyUnlockUniversal === 'function') {
|
|
186
|
+
const isSuccess = _legacyUnlockUniversal.call(screen);
|
|
159
187
|
if (!isSuccess) {
|
|
160
188
|
throw new Error(`Unlocking screen orientation on device was denied`);
|
|
161
189
|
}
|
|
162
|
-
|
|
163
|
-
throw new Error(
|
|
164
|
-
`expo-screen-orientation: The browser doesn't support unlocking screen orientation.`
|
|
165
|
-
);
|
|
190
|
+
return;
|
|
166
191
|
}
|
|
192
|
+
|
|
193
|
+
throw new Error(
|
|
194
|
+
`expo-screen-orientation: The browser doesn't support unlocking screen orientation.`
|
|
195
|
+
);
|
|
167
196
|
}
|
|
168
197
|
}
|
|
169
198
|
|
|
170
|
-
export default registerWebModule(ExpoScreenOrientation);
|
|
199
|
+
export default registerWebModule(ExpoScreenOrientation, 'ExpoScreenOrientation');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
23364b01bd5651e2f10722f2607ca814
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f76c64c740eafbd0bc9f3ba69c179d0ace9c7c07
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3a7218eb3efe236f788f456b1efb9d99e4050210879167c4f8bd940fd30635ba
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a123b53748bcca45b1a7f861499c778be5f62b45aa09cea7a2f815deb6b8755b22440358d20146cb781557734be516861ab3be23b293662517b0642c089d8399
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d6bc096cdcf3a342f370d2f8e2ac4f3b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4c9249aa414a18f6b9300516dd9c657454d7d480
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ac37720eeec646618c5d07e032bdc193c07f161e83b0309606fc64a4d21f3f31
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6102ea4d07fb077d90fba544fbffb3eae7895c6e2cf8caabfb77400f7c124567d50b31dea1db90629c5d55de831830cf6801f55de0d26b0bc80a62e83eae688d
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|