expo-screen-orientation 9.0.9-canary-20260105-6b962e6 → 9.0.9-canary-20260113-0ce2b9c
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 +1 -0
- package/android/build.gradle +2 -2
- package/build/ExpoScreenOrientation.web.d.ts +1 -2
- package/build/ExpoScreenOrientation.web.d.ts.map +1 -1
- package/build/ExpoScreenOrientation.web.js +9 -11
- package/build/ExpoScreenOrientation.web.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/ScreenOrientationRegistry.swift +1 -4
- package/ios/ScreenOrientationViewController.swift +7 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.module → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.module} +7 -7
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.pom → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.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 +9 -11
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6-sources.jar → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6-sources.jar.md5 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6-sources.jar.sha1 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6-sources.jar.sha256 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6-sources.jar.sha512 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c-sources.jar.sha512} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.aar → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.aar.md5 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.aar.sha1 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.aar.sha256 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/{9.0.9-canary-20260105-6b962e6/expo.modules.screenorientation-9.0.9-canary-20260105-6b962e6.aar.sha512 → 9.0.9-canary-20260113-0ce2b9c/expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
### 🐛 Bug fixes
|
|
10
10
|
|
|
11
11
|
- [web] fix undeclared `listener` reference ([#41441](https://github.com/expo/expo/pull/41441) by [@vonovak](https://github.com/vonovak))
|
|
12
|
+
- [iOS] Remove use of deprecated API `UIApplication.shared.windows`. ([#40881](https://github.com/expo/expo/pull/40881) by [@bwallberg](https://github.com/bwallberg))
|
|
12
13
|
|
|
13
14
|
### 💡 Others
|
|
14
15
|
|
package/android/build.gradle
CHANGED
|
@@ -4,12 +4,12 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '9.0.9-canary-
|
|
7
|
+
version = '9.0.9-canary-20260113-0ce2b9c'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.screenorientation"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 7
|
|
13
|
-
versionName '9.0.9-canary-
|
|
13
|
+
versionName '9.0.9-canary-20260113-0ce2b9c'
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -11,8 +11,7 @@ declare global {
|
|
|
11
11
|
}
|
|
12
12
|
declare class ExpoScreenOrientation extends NativeModule<ExpoOrientationEvents> {
|
|
13
13
|
orientation: ScreenOrientation | null;
|
|
14
|
-
|
|
15
|
-
emitOrientationEvent(): Promise<void>;
|
|
14
|
+
emitOrientationEvent: () => Promise<void>;
|
|
16
15
|
startObserving(): void;
|
|
17
16
|
stopObserving(): void;
|
|
18
17
|
supportsOrientationLockAsync(orientationLock: OrientationLock): Promise<boolean>;
|
|
@@ -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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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"}
|
|
@@ -63,8 +63,7 @@ class ExpoScreenOrientation extends NativeModule {
|
|
|
63
63
|
orientation = Platform.canUseViewport
|
|
64
64
|
? screen.orientation || screen.msOrientation || null
|
|
65
65
|
: null;
|
|
66
|
-
|
|
67
|
-
async emitOrientationEvent() {
|
|
66
|
+
emitOrientationEvent = async () => {
|
|
68
67
|
const [orientationLock, orientation] = await Promise.all([
|
|
69
68
|
getOrientationLockAsync(),
|
|
70
69
|
getOrientationAsync(),
|
|
@@ -73,25 +72,24 @@ class ExpoScreenOrientation extends NativeModule {
|
|
|
73
72
|
orientationLock,
|
|
74
73
|
orientationInfo: { orientation },
|
|
75
74
|
});
|
|
76
|
-
}
|
|
75
|
+
};
|
|
77
76
|
startObserving() {
|
|
78
|
-
this.listener = () => this.emitOrientationEvent();
|
|
79
77
|
if (Platform.canUseEventListeners) {
|
|
80
|
-
if (this.orientation
|
|
81
|
-
this.orientation.addEventListener('change', this.
|
|
78
|
+
if (this.orientation?.addEventListener) {
|
|
79
|
+
this.orientation.addEventListener('change', this.emitOrientationEvent);
|
|
82
80
|
}
|
|
83
81
|
else {
|
|
84
|
-
window.addEventListener('orientationchange', this.
|
|
82
|
+
window.addEventListener('orientationchange', this.emitOrientationEvent);
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
stopObserving() {
|
|
89
|
-
if (Platform.canUseEventListeners
|
|
90
|
-
if (this.orientation
|
|
91
|
-
this.orientation.removeEventListener('change', this.
|
|
87
|
+
if (Platform.canUseEventListeners) {
|
|
88
|
+
if (this.orientation?.removeEventListener) {
|
|
89
|
+
this.orientation.removeEventListener('change', this.emitOrientationEvent);
|
|
92
90
|
}
|
|
93
91
|
else {
|
|
94
|
-
window.removeEventListener('orientationchange', this.
|
|
92
|
+
window.removeEventListener('orientationchange', this.emitOrientationEvent);
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
}
|
|
@@ -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,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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AAM,IAAI,SAAS,CAAC,6BAA6B,eAAe,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,MAAM,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,iBAAiB,CAAC,kBAAsC;QAC5D,MAAM,UAAU,CAAC,kBAAkB,CAAC,CAAC;QACrC,uBAAuB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IACD,KAAK,CAAC,WAAW;QACf,oCAAoC;QACpC,iFAAiF;QACjF,IACE,MAAM,CAAC,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 listener: (() => void) | undefined;\n\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 && this.listener) {\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"]}
|
|
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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AM,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\n emitOrientationEvent = async () => {\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 if (Platform.canUseEventListeners) {\n if (this.orientation?.addEventListener) {\n this.orientation.addEventListener('change', this.emitOrientationEvent);\n } else {\n window.addEventListener('orientationchange', this.emitOrientationEvent);\n }\n }\n }\n stopObserving(): void {\n if (Platform.canUseEventListeners) {\n if (this.orientation?.removeEventListener) {\n this.orientation.removeEventListener('change', this.emitOrientationEvent);\n } else {\n window.removeEventListener('orientationchange', this.emitOrientationEvent);\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
|
@@ -57,10 +57,7 @@ public class ScreenOrientationRegistry: NSObject, UIApplicationDelegate {
|
|
|
57
57
|
Called by ScreenOrientationAppDelegate in order to set initial interface orientation.
|
|
58
58
|
*/
|
|
59
59
|
public func updateCurrentScreenOrientation() {
|
|
60
|
-
|
|
61
|
-
if !windows.isEmpty {
|
|
62
|
-
self.currentScreenOrientation = windows[0].windowScene?.interfaceOrientation ?? .unknown
|
|
63
|
-
}
|
|
60
|
+
self.currentScreenOrientation = rootViewController?.view.window?.windowScene?.interfaceOrientation ?? .unknown
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
deinit {
|
|
@@ -9,7 +9,13 @@ class ScreenOrientationViewController: UIViewController {
|
|
|
9
9
|
private var defaultOrientationMask: UIInterfaceOrientationMask
|
|
10
10
|
private var previousInterfaceOrientation: UIInterfaceOrientation = .unknown
|
|
11
11
|
private var windowInterfaceOrientation: UIInterfaceOrientation? {
|
|
12
|
-
|
|
12
|
+
let keyWindow = UIApplication
|
|
13
|
+
.shared
|
|
14
|
+
.connectedScenes
|
|
15
|
+
.flatMap { ($0 as? UIWindowScene)?.windows ?? [] }
|
|
16
|
+
.last { $0.isKeyWindow }
|
|
17
|
+
|
|
18
|
+
return keyWindow?.windowScene?.interfaceOrientation
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
init(defaultOrientationMask: UIInterfaceOrientationMask = doesDeviceHaveNotch ? .allButUpsideDown : .all) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.screenorientation",
|
|
6
|
-
"version": "9.0.9-canary-
|
|
6
|
+
"version": "9.0.9-canary-20260113-0ce2b9c",
|
|
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-9.0.9-canary-
|
|
28
|
-
"url": "expo.modules.screenorientation-9.0.9-canary-
|
|
27
|
+
"name": "expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar",
|
|
28
|
+
"url": "expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar",
|
|
29
29
|
"size": 36365,
|
|
30
30
|
"sha512": "79b78c175584bffc9070c529309e89373b6a0296abeecfb2153b23662326ef1d045f940985aaf4fad2b31941c5157974b79c2836cdfc66b05ed574d681028eee",
|
|
31
31
|
"sha256": "d6772ad24c27669f8d32e5179d91f63854c9f04fdb856021a918f2b41af6653d",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
],
|
|
54
54
|
"files": [
|
|
55
55
|
{
|
|
56
|
-
"name": "expo.modules.screenorientation-9.0.9-canary-
|
|
57
|
-
"url": "expo.modules.screenorientation-9.0.9-canary-
|
|
56
|
+
"name": "expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar",
|
|
57
|
+
"url": "expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c.aar",
|
|
58
58
|
"size": 36365,
|
|
59
59
|
"sha512": "79b78c175584bffc9070c529309e89373b6a0296abeecfb2153b23662326ef1d045f940985aaf4fad2b31941c5157974b79c2836cdfc66b05ed574d681028eee",
|
|
60
60
|
"sha256": "d6772ad24c27669f8d32e5179d91f63854c9f04fdb856021a918f2b41af6653d",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"files": [
|
|
75
75
|
{
|
|
76
|
-
"name": "expo.modules.screenorientation-9.0.9-canary-
|
|
77
|
-
"url": "expo.modules.screenorientation-9.0.9-canary-
|
|
76
|
+
"name": "expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c-sources.jar",
|
|
77
|
+
"url": "expo.modules.screenorientation-9.0.9-canary-20260113-0ce2b9c-sources.jar",
|
|
78
78
|
"size": 5194,
|
|
79
79
|
"sha512": "e06be0d0236539250b81b1d5670d89f70600b03c82fa53c245602afdcb2bab06d04d42e6dd85e9686867d069a8b09dd3fbc04f562bc1760e33f68ea614b2ec42",
|
|
80
80
|
"sha256": "d63ace679c73e409ffd1706ac43973134e9151254bf644d73a33c27539db1037",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a97218b617a949cac5e00f4ff6022301
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9bc789262ebf1717bac821e8b641517507dfae88
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ef5da9b156a39f0917593197b6f0f9d673ff8cdc0721daa0bad35a7f2aaa434b
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cc36e1e9d718ff4268dbda5679a1783a2a911a6b8661f7226bde460caacefb4f8a9ad5ccb30fe1a77f824ddedb5e979ef7565262b603b1229b4fa9f651a324ab
|
|
@@ -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>9.0.9-canary-
|
|
12
|
+
<version>9.0.9-canary-20260113-0ce2b9c</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
|
+
c4629f091c75e7d20fbda2e846b71b4c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8b7c0cb17402ab26f0ace34c62c788316ed0dfe1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5921679dcaadae31d3a9efa9e1b7e248d4edc793823e703d4d267099efca2a01
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c582e268a11a278201692c5ff70cf43c3e6f1fb81d44dd0a2906f25cb443997348814deea110d9c142699d1b3f9b3982ec43ce340764ab606c7a13aa74db592a
|
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>9.0.9-canary-
|
|
7
|
-
<release>9.0.9-canary-
|
|
6
|
+
<latest>9.0.9-canary-20260113-0ce2b9c</latest>
|
|
7
|
+
<release>9.0.9-canary-20260113-0ce2b9c</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>9.0.9-canary-
|
|
9
|
+
<version>9.0.9-canary-20260113-0ce2b9c</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260113181535</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
|
+
97fac0209aff2b70ca55348f5ab473dc
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha1
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4410a2b2a6b6c81714058de16ff2196b3447b80f
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
ddf7e665d60c545d31c7521620dd21bdc0e601e19631a7338247e6894826b3c2
|
package/local-maven-repo/host/exp/exponent/expo.modules.screenorientation/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
87e8f89e125b94d733036ecc28122c108242b793d3fcb4a56990030a4eb2c70dad59aaf227f46a5116232e20cc19cc42f0bcbe10bcc4d33cb9ad7915b7af027f
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-screen-orientation",
|
|
3
|
-
"version": "9.0.9-canary-
|
|
3
|
+
"version": "9.0.9-canary-20260113-0ce2b9c",
|
|
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,10 +36,10 @@
|
|
|
36
36
|
"preset": "expo-module-scripts"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"expo-module-scripts": "5.1.0-canary-
|
|
39
|
+
"expo-module-scripts": "5.1.0-canary-20260113-0ce2b9c"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"expo": "55.0.0-canary-
|
|
42
|
+
"expo": "55.0.0-canary-20260113-0ce2b9c",
|
|
43
43
|
"react-native": "*"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -110,9 +110,8 @@ class ExpoScreenOrientation extends NativeModule<ExpoOrientationEvents> {
|
|
|
110
110
|
orientation: ScreenOrientation | null = Platform.canUseViewport
|
|
111
111
|
? screen.orientation || (screen as any).msOrientation || null
|
|
112
112
|
: null;
|
|
113
|
-
listener: (() => void) | undefined;
|
|
114
113
|
|
|
115
|
-
async
|
|
114
|
+
emitOrientationEvent = async () => {
|
|
116
115
|
const [orientationLock, orientation] = await Promise.all([
|
|
117
116
|
getOrientationLockAsync(),
|
|
118
117
|
getOrientationAsync(),
|
|
@@ -121,23 +120,22 @@ class ExpoScreenOrientation extends NativeModule<ExpoOrientationEvents> {
|
|
|
121
120
|
orientationLock,
|
|
122
121
|
orientationInfo: { orientation },
|
|
123
122
|
});
|
|
124
|
-
}
|
|
123
|
+
};
|
|
125
124
|
startObserving() {
|
|
126
|
-
this.listener = () => this.emitOrientationEvent();
|
|
127
125
|
if (Platform.canUseEventListeners) {
|
|
128
|
-
if (this.orientation
|
|
129
|
-
this.orientation.addEventListener('change', this.
|
|
126
|
+
if (this.orientation?.addEventListener) {
|
|
127
|
+
this.orientation.addEventListener('change', this.emitOrientationEvent);
|
|
130
128
|
} else {
|
|
131
|
-
window.addEventListener('orientationchange', this.
|
|
129
|
+
window.addEventListener('orientationchange', this.emitOrientationEvent);
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
stopObserving(): void {
|
|
136
|
-
if (Platform.canUseEventListeners
|
|
137
|
-
if (this.orientation
|
|
138
|
-
this.orientation.removeEventListener('change', this.
|
|
134
|
+
if (Platform.canUseEventListeners) {
|
|
135
|
+
if (this.orientation?.removeEventListener) {
|
|
136
|
+
this.orientation.removeEventListener('change', this.emitOrientationEvent);
|
|
139
137
|
} else {
|
|
140
|
-
window.removeEventListener('orientationchange', this.
|
|
138
|
+
window.removeEventListener('orientationchange', this.emitOrientationEvent);
|
|
141
139
|
}
|
|
142
140
|
}
|
|
143
141
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a2df9abcc2797b3b6bb9f6a274cb46c3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0f6bab90bfe43f8832dbad0c297fdc7428cfbd16
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bcdad03d7d7a7a6b501a193e3a3a22731fea25e7ca1f943e784320dfe33d1077
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c02de752d3927b92346a3855e6e856bad7201c7264ba8351fdd33081feb853f696942047ec3fb11b37d14e568551e880509adda5a895666d903589f6b95445c9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e91d52ee88ad1607e32e3d36c2ed7049
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
319988e28a606fd802c55567c86321eb337b39c0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
931a837689ed1a349b68080ccb2a036255b5fb5cd4f9a229b54248462c002ba2
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9013557a29fc855dd9579fd40b944b0773a6156febdf0e5881cadbae5528548bbf3c87a2e2f09d5999f8408c3d3918e82911784fe7dd1019b12dc93b62eeb3d6
|