react-native-orientation-director 1.0.0

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.
Files changed (103) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +87 -0
  3. package/android/build.gradle +120 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/AndroidManifestNew.xml +2 -0
  7. package/android/src/main/java/com/orientationdirector/OrientationDirectorModule.kt +50 -0
  8. package/android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt +35 -0
  9. package/android/src/main/java/com/orientationdirector/implementation/Orientation.kt +12 -0
  10. package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorImpl.kt +117 -0
  11. package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorUtilsImpl.kt +65 -0
  12. package/android/src/main/java/com/orientationdirector/implementation/OrientationEventManager.kt +42 -0
  13. package/android/src/main/java/com/orientationdirector/implementation/OrientationLifecycleListener.kt +33 -0
  14. package/android/src/main/java/com/orientationdirector/implementation/OrientationSensorListener.kt +26 -0
  15. package/android/src/newarch/OrientationDirectorSpec.kt +7 -0
  16. package/android/src/oldarch/OrientationDirectorSpec.kt +16 -0
  17. package/ios/OrientationDirector.h +22 -0
  18. package/ios/OrientationDirector.mm +121 -0
  19. package/ios/implementation/Orientation.swift +12 -0
  20. package/ios/implementation/OrientationDirectorImpl.swift +126 -0
  21. package/ios/implementation/OrientationDirectorUtils.swift +111 -0
  22. package/ios/implementation/OrientationEventManager.swift +56 -0
  23. package/ios/implementation/OrientationSensorListener.swift +37 -0
  24. package/ios/react-native-orientation-director-Bridging-Header.h +6 -0
  25. package/lib/commonjs/NativeOrientationDirector.js +9 -0
  26. package/lib/commonjs/NativeOrientationDirector.js.map +1 -0
  27. package/lib/commonjs/RNOrientationDirector.js +49 -0
  28. package/lib/commonjs/RNOrientationDirector.js.map +1 -0
  29. package/lib/commonjs/hooks/useDeviceOrientation.hook.js +39 -0
  30. package/lib/commonjs/hooks/useDeviceOrientation.hook.js.map +1 -0
  31. package/lib/commonjs/hooks/useInterfaceOrientation.hook.js +39 -0
  32. package/lib/commonjs/hooks/useInterfaceOrientation.hook.js.map +1 -0
  33. package/lib/commonjs/index.js +31 -0
  34. package/lib/commonjs/index.js.map +1 -0
  35. package/lib/commonjs/module.js +23 -0
  36. package/lib/commonjs/module.js.map +1 -0
  37. package/lib/commonjs/types/Event.enum.js +13 -0
  38. package/lib/commonjs/types/Event.enum.js.map +1 -0
  39. package/lib/commonjs/types/InterfaceOrientationToLocalizedStringProvider.type.js +6 -0
  40. package/lib/commonjs/types/InterfaceOrientationToLocalizedStringProvider.type.js.map +1 -0
  41. package/lib/commonjs/types/LockableOrientation.type.js +6 -0
  42. package/lib/commonjs/types/LockableOrientation.type.js.map +1 -0
  43. package/lib/commonjs/types/Orientation.enum.js +17 -0
  44. package/lib/commonjs/types/Orientation.enum.js.map +1 -0
  45. package/lib/commonjs/types/OrientationEvent.interface.js +6 -0
  46. package/lib/commonjs/types/OrientationEvent.interface.js.map +1 -0
  47. package/lib/module/NativeOrientationDirector.js +3 -0
  48. package/lib/module/NativeOrientationDirector.js.map +1 -0
  49. package/lib/module/RNOrientationDirector.js +40 -0
  50. package/lib/module/RNOrientationDirector.js.map +1 -0
  51. package/lib/module/hooks/useDeviceOrientation.hook.js +31 -0
  52. package/lib/module/hooks/useDeviceOrientation.hook.js.map +1 -0
  53. package/lib/module/hooks/useInterfaceOrientation.hook.js +31 -0
  54. package/lib/module/hooks/useInterfaceOrientation.hook.js.map +1 -0
  55. package/lib/module/index.js +8 -0
  56. package/lib/module/index.js.map +1 -0
  57. package/lib/module/module.js +17 -0
  58. package/lib/module/module.js.map +1 -0
  59. package/lib/module/types/Event.enum.js +7 -0
  60. package/lib/module/types/Event.enum.js.map +1 -0
  61. package/lib/module/types/InterfaceOrientationToLocalizedStringProvider.type.js +2 -0
  62. package/lib/module/types/InterfaceOrientationToLocalizedStringProvider.type.js.map +1 -0
  63. package/lib/module/types/LockableOrientation.type.js +2 -0
  64. package/lib/module/types/LockableOrientation.type.js.map +1 -0
  65. package/lib/module/types/Orientation.enum.js +11 -0
  66. package/lib/module/types/Orientation.enum.js.map +1 -0
  67. package/lib/module/types/OrientationEvent.interface.js +2 -0
  68. package/lib/module/types/OrientationEvent.interface.js.map +1 -0
  69. package/lib/typescript/src/NativeOrientationDirector.d.ts +12 -0
  70. package/lib/typescript/src/NativeOrientationDirector.d.ts.map +1 -0
  71. package/lib/typescript/src/RNOrientationDirector.d.ts +17 -0
  72. package/lib/typescript/src/RNOrientationDirector.d.ts.map +1 -0
  73. package/lib/typescript/src/hooks/useDeviceOrientation.hook.d.ts +8 -0
  74. package/lib/typescript/src/hooks/useDeviceOrientation.hook.d.ts.map +1 -0
  75. package/lib/typescript/src/hooks/useInterfaceOrientation.hook.d.ts +8 -0
  76. package/lib/typescript/src/hooks/useInterfaceOrientation.hook.d.ts.map +1 -0
  77. package/lib/typescript/src/index.d.ts +8 -0
  78. package/lib/typescript/src/index.d.ts.map +1 -0
  79. package/lib/typescript/src/module.d.ts +6 -0
  80. package/lib/typescript/src/module.d.ts.map +1 -0
  81. package/lib/typescript/src/types/Event.enum.d.ts +6 -0
  82. package/lib/typescript/src/types/Event.enum.d.ts.map +1 -0
  83. package/lib/typescript/src/types/InterfaceOrientationToLocalizedStringProvider.type.d.ts +3 -0
  84. package/lib/typescript/src/types/InterfaceOrientationToLocalizedStringProvider.type.d.ts.map +1 -0
  85. package/lib/typescript/src/types/LockableOrientation.type.d.ts +3 -0
  86. package/lib/typescript/src/types/LockableOrientation.type.d.ts.map +1 -0
  87. package/lib/typescript/src/types/Orientation.enum.d.ts +10 -0
  88. package/lib/typescript/src/types/Orientation.enum.d.ts.map +1 -0
  89. package/lib/typescript/src/types/OrientationEvent.interface.d.ts +5 -0
  90. package/lib/typescript/src/types/OrientationEvent.interface.d.ts.map +1 -0
  91. package/package.json +178 -0
  92. package/react-native-orientation-director.podspec +41 -0
  93. package/src/NativeOrientationDirector.ts +14 -0
  94. package/src/RNOrientationDirector.ts +64 -0
  95. package/src/hooks/useDeviceOrientation.hook.ts +40 -0
  96. package/src/hooks/useInterfaceOrientation.hook.ts +40 -0
  97. package/src/index.tsx +10 -0
  98. package/src/module.ts +30 -0
  99. package/src/types/Event.enum.ts +6 -0
  100. package/src/types/InterfaceOrientationToLocalizedStringProvider.type.ts +6 -0
  101. package/src/types/LockableOrientation.type.ts +7 -0
  102. package/src/types/Orientation.enum.ts +11 -0
  103. package/src/types/OrientationEvent.interface.ts +5 -0
package/package.json ADDED
@@ -0,0 +1,178 @@
1
+ {
2
+ "name": "react-native-orientation-director",
3
+ "version": "1.0.0",
4
+ "description": "A Modern React Native library that allows you to access orientation",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/src/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "scripts": {
29
+ "example": "yarn workspace react-native-orientation-director-example",
30
+ "test": "jest",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
34
+ "prepare": "bob build",
35
+ "release": "release-it"
36
+ },
37
+ "keywords": [
38
+ "react-native",
39
+ "ios",
40
+ "android"
41
+ ],
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/gladiuscode/react-native-orientation-director.git"
45
+ },
46
+ "author": "gladius <gladiusservices@protonmail.com> (https://github.com/gladiuscode)",
47
+ "license": "MIT",
48
+ "bugs": {
49
+ "url": "https://github.com/gladiuscode/react-native-orientation-director/issues"
50
+ },
51
+ "homepage": "https://github.com/gladiuscode/react-native-orientation-director#readme",
52
+ "publishConfig": {
53
+ "registry": "https://registry.npmjs.org/"
54
+ },
55
+ "devDependencies": {
56
+ "@commitlint/config-conventional": "^17.0.2",
57
+ "@evilmartians/lefthook": "^1.5.0",
58
+ "@react-native/eslint-config": "^0.73.1",
59
+ "@release-it/conventional-changelog": "^5.0.0",
60
+ "@types/jest": "^29.5.5",
61
+ "@types/react": "^18.2.44",
62
+ "commitlint": "^17.0.2",
63
+ "del-cli": "^5.1.0",
64
+ "eslint": "^8.51.0",
65
+ "eslint-config-prettier": "^9.0.0",
66
+ "eslint-plugin-prettier": "^5.0.1",
67
+ "jest": "^29.7.0",
68
+ "prettier": "^3.0.3",
69
+ "react": "18.2.0",
70
+ "react-native": "0.74.1",
71
+ "react-native-builder-bob": "^0.23.2",
72
+ "release-it": "^15.0.0",
73
+ "turbo": "^1.10.7",
74
+ "typescript": "^5.2.2"
75
+ },
76
+ "resolutions": {
77
+ "@types/react": "^18.2.44"
78
+ },
79
+ "peerDependencies": {
80
+ "react": "*",
81
+ "react-native": "*"
82
+ },
83
+ "workspaces": [
84
+ "example"
85
+ ],
86
+ "packageManager": "yarn@3.6.1",
87
+ "jest": {
88
+ "preset": "react-native",
89
+ "modulePathIgnorePatterns": [
90
+ "<rootDir>/example/node_modules",
91
+ "<rootDir>/lib/"
92
+ ]
93
+ },
94
+ "commitlint": {
95
+ "extends": [
96
+ "@commitlint/config-conventional"
97
+ ]
98
+ },
99
+ "release-it": {
100
+ "git": {
101
+ "commitMessage": "chore: release ${version}",
102
+ "tagName": "v${version}"
103
+ },
104
+ "npm": {
105
+ "publish": true
106
+ },
107
+ "github": {
108
+ "release": true
109
+ },
110
+ "plugins": {
111
+ "@release-it/conventional-changelog": {
112
+ "infile": "CHANGELOG.md",
113
+ "preset": {
114
+ "name": "angular",
115
+ "types": [
116
+ {
117
+ "type": "feat",
118
+ "section": "🚀 Features"
119
+ },
120
+ {
121
+ "type": "fix",
122
+ "section": "🔨 Bug Fixes"
123
+ }
124
+ ]
125
+ }
126
+ }
127
+ }
128
+ },
129
+ "eslintConfig": {
130
+ "root": true,
131
+ "extends": [
132
+ "@react-native",
133
+ "prettier"
134
+ ],
135
+ "rules": {
136
+ "prettier/prettier": [
137
+ "error",
138
+ {
139
+ "quoteProps": "consistent",
140
+ "singleQuote": true,
141
+ "tabWidth": 2,
142
+ "trailingComma": "es5",
143
+ "useTabs": false
144
+ }
145
+ ]
146
+ }
147
+ },
148
+ "eslintIgnore": [
149
+ "node_modules/",
150
+ "lib/"
151
+ ],
152
+ "prettier": {
153
+ "quoteProps": "consistent",
154
+ "singleQuote": true,
155
+ "tabWidth": 2,
156
+ "trailingComma": "es5",
157
+ "useTabs": false
158
+ },
159
+ "react-native-builder-bob": {
160
+ "source": "src",
161
+ "output": "lib",
162
+ "targets": [
163
+ "commonjs",
164
+ "module",
165
+ [
166
+ "typescript",
167
+ {
168
+ "project": "tsconfig.build.json"
169
+ }
170
+ ]
171
+ ]
172
+ },
173
+ "codegenConfig": {
174
+ "name": "RNOrientationDirectorSpec",
175
+ "type": "modules",
176
+ "jsSrcsDir": "src"
177
+ }
178
+ }
@@ -0,0 +1,41 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "react-native-orientation-director"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => min_ios_version_supported }
15
+ s.source = { :git => "https://github.com/gladiuscode/react-native-orientation-director.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
18
+
19
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21
+ if respond_to?(:install_modules_dependencies, true)
22
+ install_modules_dependencies(s)
23
+ else
24
+ s.dependency "React-Core"
25
+
26
+ # Don't install the dependencies when we run `pod install` in the old architecture.
27
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29
+ s.pod_target_xcconfig = {
30
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33
+ }
34
+ s.dependency "React-Codegen"
35
+ s.dependency "RCT-Folly"
36
+ s.dependency "RCTRequired"
37
+ s.dependency "RCTTypeSafety"
38
+ s.dependency "ReactCommon/turbomodule/core"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,14 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ getInterfaceOrientation(): Promise<number>;
6
+ getDeviceOrientation(): Promise<number>;
7
+ lockTo(orientation: number): void;
8
+ unlock(): void;
9
+
10
+ addListener: (eventType: string) => void;
11
+ removeListeners: (count: number) => void;
12
+ }
13
+
14
+ export default TurboModuleRegistry.getEnforcing<Spec>('OrientationDirector');
@@ -0,0 +1,64 @@
1
+ import Module, { EventEmitter } from './module';
2
+ import Event from './types/Event.enum';
3
+ import type { InterfaceOrientationToLocalizedStringProvider } from './types/InterfaceOrientationToLocalizedStringProvider.type';
4
+ import { Orientation } from './types/Orientation.enum';
5
+ import type { OrientationEvent } from './types/OrientationEvent.interface';
6
+ import type { LockableOrientation } from './types/LockableOrientation.type';
7
+
8
+ class RNOrientationDirector {
9
+ private static _localizedStringProvider: InterfaceOrientationToLocalizedStringProvider =
10
+ {
11
+ [Orientation.unknown]: 'Unknown',
12
+ [Orientation.portrait]: 'Portrait',
13
+ [Orientation.portraitUpsideDown]: 'Portrait Upside Down',
14
+ [Orientation.landscapeLeft]: 'Landscape Left',
15
+ [Orientation.landscapeRight]: 'Landscape Right',
16
+ [Orientation.faceUp]: 'Face Up',
17
+ [Orientation.faceDown]: 'Face Down',
18
+ };
19
+
20
+ setLocalizedStringProvider(
21
+ provider: InterfaceOrientationToLocalizedStringProvider
22
+ ) {
23
+ RNOrientationDirector._localizedStringProvider = provider;
24
+ }
25
+
26
+ static getInterfaceOrientation(): Promise<Orientation> {
27
+ return Module.getInterfaceOrientation();
28
+ }
29
+
30
+ static getDeviceOrientation(): Promise<Orientation> {
31
+ return Module.getDeviceOrientation();
32
+ }
33
+
34
+ static lockTo(orientation: LockableOrientation) {
35
+ Module.lockTo(orientation);
36
+ }
37
+
38
+ static unlock() {
39
+ Module.unlock();
40
+ }
41
+
42
+ static listenForDeviceOrientationChanges(
43
+ callback: (orientation: OrientationEvent) => void
44
+ ) {
45
+ return EventEmitter.addListener(Event.DeviceOrientationDidChange, callback);
46
+ }
47
+
48
+ static listenForInterfaceOrientationChanges(
49
+ callback: (orientation: OrientationEvent) => void
50
+ ) {
51
+ return EventEmitter.addListener(
52
+ Event.InterfaceOrientationDidChange,
53
+ callback
54
+ );
55
+ }
56
+
57
+ static convertOrientationToHumanReadableString(
58
+ orientation: Orientation
59
+ ): string {
60
+ return RNOrientationDirector._localizedStringProvider[orientation];
61
+ }
62
+ }
63
+
64
+ export default RNOrientationDirector;
@@ -0,0 +1,40 @@
1
+ import React, { useRef } from 'react';
2
+ import RNOrientationDirector from '../RNOrientationDirector';
3
+ import type { OrientationEvent } from '../types/OrientationEvent.interface';
4
+ import { Orientation } from '../types/Orientation.enum';
5
+
6
+ /**
7
+ * Hook that returns the current device orientation.
8
+ * It listens for orientation changes and updates the state accordingly.
9
+ */
10
+ const useDeviceOrientation = () => {
11
+ const initialRender = useRef(false);
12
+ const [orientation, setOrientation] = React.useState<Orientation>(
13
+ Orientation.unknown
14
+ );
15
+
16
+ React.useEffect(() => {
17
+ if (initialRender.current) {
18
+ return;
19
+ }
20
+
21
+ initialRender.current = true;
22
+ RNOrientationDirector.getDeviceOrientation().then(setOrientation);
23
+ }, []);
24
+
25
+ React.useEffect(() => {
26
+ const onChange = (event: OrientationEvent) => {
27
+ setOrientation(event.orientation);
28
+ };
29
+
30
+ const subscription =
31
+ RNOrientationDirector.listenForDeviceOrientationChanges(onChange);
32
+ return () => {
33
+ subscription.remove();
34
+ };
35
+ }, []);
36
+
37
+ return orientation;
38
+ };
39
+
40
+ export default useDeviceOrientation;
@@ -0,0 +1,40 @@
1
+ import React, { useRef } from 'react';
2
+ import RNOrientationDirector from '../RNOrientationDirector';
3
+ import type { OrientationEvent } from '../types/OrientationEvent.interface';
4
+ import { Orientation } from '../types/Orientation.enum';
5
+
6
+ /**
7
+ * Hook that returns the current interface orientation.
8
+ * It listens for orientation changes and updates the state accordingly.
9
+ */
10
+ const useInterfaceOrientation = () => {
11
+ const initialRender = useRef(false);
12
+ const [orientation, setOrientation] = React.useState<Orientation>(
13
+ Orientation.unknown
14
+ );
15
+
16
+ React.useEffect(() => {
17
+ if (initialRender.current) {
18
+ return;
19
+ }
20
+
21
+ initialRender.current = true;
22
+ RNOrientationDirector.getInterfaceOrientation().then(setOrientation);
23
+ }, []);
24
+
25
+ React.useEffect(() => {
26
+ const onChange = (event: OrientationEvent) => {
27
+ setOrientation(event.orientation);
28
+ };
29
+
30
+ const subscription =
31
+ RNOrientationDirector.listenForInterfaceOrientationChanges(onChange);
32
+ return () => {
33
+ subscription.remove();
34
+ };
35
+ }, []);
36
+
37
+ return orientation;
38
+ };
39
+
40
+ export default useInterfaceOrientation;
package/src/index.tsx ADDED
@@ -0,0 +1,10 @@
1
+ export { Orientation } from './types/Orientation.enum';
2
+
3
+ import useDeviceOrientation from './hooks/useDeviceOrientation.hook';
4
+ export { useDeviceOrientation };
5
+
6
+ import useInterfaceOrientation from './hooks/useInterfaceOrientation.hook';
7
+ export { useInterfaceOrientation };
8
+
9
+ import RNOrientationDirector from './RNOrientationDirector';
10
+ export default RNOrientationDirector;
package/src/module.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
2
+ import type { Spec } from './NativeOrientationDirector';
3
+
4
+ const LINKING_ERROR =
5
+ `The package 'react-native-orientation-director' doesn't seem to be linked. Make sure: \n\n` +
6
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
7
+ '- You rebuilt the app after installing the package\n' +
8
+ '- You are not using Expo Go\n';
9
+
10
+ // @ts-expect-error
11
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
12
+
13
+ const Module = isTurboModuleEnabled
14
+ ? require('./NativeOrientationDirector').default
15
+ : NativeModules.OrientationDirector;
16
+
17
+ const OrientationDirectorModule = Module
18
+ ? Module
19
+ : new Proxy(
20
+ {},
21
+ {
22
+ get() {
23
+ throw new Error(LINKING_ERROR);
24
+ },
25
+ }
26
+ );
27
+
28
+ export const EventEmitter = new NativeEventEmitter(Module);
29
+
30
+ export default OrientationDirectorModule as Spec;
@@ -0,0 +1,6 @@
1
+ enum Event {
2
+ DeviceOrientationDidChange = 'DeviceOrientationDidChange',
3
+ InterfaceOrientationDidChange = 'InterfaceOrientationDidChange',
4
+ }
5
+
6
+ export default Event;
@@ -0,0 +1,6 @@
1
+ import type { Orientation } from './Orientation.enum';
2
+
3
+ export type InterfaceOrientationToLocalizedStringProvider = Record<
4
+ Orientation,
5
+ string
6
+ >;
@@ -0,0 +1,7 @@
1
+ import { Orientation } from './Orientation.enum';
2
+
3
+ export type LockableOrientation =
4
+ | Orientation.portrait
5
+ | Orientation.portraitUpsideDown
6
+ | Orientation.landscapeLeft
7
+ | Orientation.landscapeRight;
@@ -0,0 +1,11 @@
1
+ export enum Orientation {
2
+ unknown = 0,
3
+ portrait = 1,
4
+ landscapeRight = 2,
5
+ portraitUpsideDown = 3,
6
+ landscapeLeft = 4,
7
+
8
+ // iOS only
9
+ faceUp = 5,
10
+ faceDown = 6,
11
+ }
@@ -0,0 +1,5 @@
1
+ import type { Orientation } from './Orientation.enum';
2
+
3
+ export interface OrientationEvent {
4
+ orientation: Orientation;
5
+ }