react-native-orientation-director 2.1.0 → 2.3.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.
- package/README.md +40 -6
- package/android/build.gradle +7 -12
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt +2 -3
- package/android/src/main/java/com/orientationdirector/implementation/Orientation.kt +1 -0
- package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt +32 -2
- package/android/src/main/java/com/orientationdirector/implementation/Utils.kt +10 -0
- package/android/src/test/java/com/orientationdirector/implementation/OrientationDirectorModuleImplTest.kt +11 -0
- package/app.plugin.js +1 -0
- package/ios/implementation/EventManager.swift +7 -7
- package/ios/implementation/Orientation.swift +1 -1
- package/ios/implementation/OrientationDirectorImpl.swift +27 -12
- package/ios/implementation/SensorListener.swift +1 -1
- package/ios/implementation/Utils.swift +9 -5
- package/lib/commonjs/RNOrientationDirector.js +1 -0
- package/lib/commonjs/RNOrientationDirector.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/Orientation.enum.js +3 -2
- package/lib/commonjs/types/Orientation.enum.js.map +1 -1
- package/lib/module/EventEmitter.js +2 -0
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/NativeOrientationDirector.js +2 -0
- package/lib/module/NativeOrientationDirector.js.map +1 -1
- package/lib/module/RNOrientationDirector.js +3 -0
- package/lib/module/RNOrientationDirector.js.map +1 -1
- package/lib/module/hooks/useDeviceOrientation.hook.js +2 -0
- package/lib/module/hooks/useDeviceOrientation.hook.js.map +1 -1
- package/lib/module/hooks/useInterfaceOrientation.hook.js +2 -0
- package/lib/module/hooks/useInterfaceOrientation.hook.js.map +1 -1
- package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js +2 -0
- package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/module.js +2 -0
- package/lib/module/module.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types/AutoRotation.enum.js +2 -0
- package/lib/module/types/AutoRotation.enum.js.map +1 -1
- package/lib/module/types/Event.enum.js +2 -0
- package/lib/module/types/Event.enum.js.map +1 -1
- package/lib/module/types/HumanReadableAutoRotationsResource.type.js +2 -0
- package/lib/module/types/HumanReadableOrientationsResource.type.js +2 -0
- package/lib/module/types/LockableOrientation.type.js +2 -0
- package/lib/module/types/LockedEvent.interface.js +1 -1
- package/lib/module/types/Orientation.enum.js +5 -2
- package/lib/module/types/Orientation.enum.js.map +1 -1
- package/lib/module/types/OrientationEvent.interface.js +2 -0
- package/lib/module/types/OrientationType.enum.js +2 -0
- package/lib/module/types/OrientationType.enum.js.map +1 -1
- package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts +13 -0
- package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts.map +1 -0
- package/lib/typescript/plugin/src/index.d.ts +4 -0
- package/lib/typescript/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts +5 -0
- package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts.map +1 -0
- package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts +4 -0
- package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts.map +1 -0
- package/lib/typescript/src/RNOrientationDirector.d.ts.map +1 -1
- package/lib/typescript/src/types/LockableOrientation.type.d.ts +1 -1
- package/lib/typescript/src/types/LockableOrientation.type.d.ts.map +1 -1
- package/lib/typescript/src/types/Orientation.enum.d.ts +3 -2
- package/lib/typescript/src/types/Orientation.enum.d.ts.map +1 -1
- package/package.json +35 -9
- package/plugin/build/custom-mod/withBridgingHeader.d.ts +12 -0
- package/plugin/build/custom-mod/withBridgingHeader.js +107 -0
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +25 -0
- package/plugin/build/withRNOrientationAppDelegate.d.ts +4 -0
- package/plugin/build/withRNOrientationAppDelegate.js +71 -0
- package/plugin/build/withRNOrientationBridgingHeader.d.ts +3 -0
- package/plugin/build/withRNOrientationBridgingHeader.js +27 -0
- package/plugin/tsconfig.json +9 -0
- package/react-native-orientation-director.podspec +2 -1
- package/src/RNOrientationDirector.ts +1 -0
- package/src/types/LockableOrientation.type.ts +2 -1
- package/src/types/Orientation.enum.ts +3 -2
package/README.md
CHANGED
|
@@ -44,17 +44,34 @@ Don't forget to run pod-install.
|
|
|
44
44
|
|
|
45
45
|
### Expo
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
using the following command:
|
|
47
|
+
You can install the package like any other Expo package, using the following command:
|
|
49
48
|
|
|
50
49
|
```sh
|
|
51
50
|
npx expo install react-native-orientation-director
|
|
52
51
|
```
|
|
53
52
|
|
|
53
|
+
Then, you need to add the plugin to your app.json file:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"expo": {
|
|
58
|
+
"plugins": [
|
|
59
|
+
"react-native-orientation-director"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This way, Expo will handle the native setup for you during `prebuild`.
|
|
66
|
+
|
|
54
67
|
## Setup
|
|
55
68
|
|
|
56
|
-
To properly handle interface orientation changes in iOS, you need to update your AppDelegate
|
|
57
|
-
|
|
69
|
+
To properly handle interface orientation changes in iOS, you need to update your AppDelegate file. Since React Native
|
|
70
|
+
0.77, the AppDelegate has been migrated to Swift, so see the instructions below for both Swift and Objective-C.
|
|
71
|
+
|
|
72
|
+
### Objective-C
|
|
73
|
+
|
|
74
|
+
In your AppDelegate.h file, import "OrientationDirector.h" and implement supportedInterfaceOrientationsForWindow method as follows:
|
|
58
75
|
|
|
59
76
|
```objc
|
|
60
77
|
#import <OrientationDirector.h>
|
|
@@ -65,6 +82,23 @@ In your AppDelegate.mm file, import "OrientationDirector.h" and implement suppor
|
|
|
65
82
|
}
|
|
66
83
|
```
|
|
67
84
|
|
|
85
|
+
### Swift
|
|
86
|
+
|
|
87
|
+
You need to create a [bridging header](https://developer.apple.com/documentation/swift/importing-objective-c-into-swift#Import-Code-Within-an-App-Target)
|
|
88
|
+
to import the library, as shown below:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
#import "OrientationDirector.h"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Then, in your AppDelegate.swift file, implement the supportedInterfaceOrientationsFor method as follows:
|
|
95
|
+
|
|
96
|
+
```swift
|
|
97
|
+
override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
|
|
98
|
+
return OrientationDirector.getSupportedInterfaceOrientationsForWindow()
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
68
102
|
If you need help, you can check the example project.
|
|
69
103
|
|
|
70
104
|
There is no need to do anything in Android, it works out of the box.
|
|
@@ -74,7 +108,7 @@ There is no need to do anything in Android, it works out of the box.
|
|
|
74
108
|
This library exports a class called: [RNOrientationDirector](https://github.com/gladiuscode/react-native-orientation-director/blob/main/src/RNOrientationDirector.ts) that exposes the following methods:
|
|
75
109
|
|
|
76
110
|
| Method | Description |
|
|
77
|
-
|
|
111
|
+
|------------------------------------------|-----------------------------------------------------------------------------------|
|
|
78
112
|
| getInterfaceOrientation | Returns the last interface orientation |
|
|
79
113
|
| getDeviceOrientation | Returns the last device orientation |
|
|
80
114
|
| lockTo | Locks the interface to a specific orientation |
|
|
@@ -94,7 +128,7 @@ This library exports a class called: [RNOrientationDirector](https://github.com/
|
|
|
94
128
|
In addition, the library exposes the following hooks:
|
|
95
129
|
|
|
96
130
|
| Hook | Description |
|
|
97
|
-
|
|
131
|
+
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
|
|
98
132
|
| [useInterfaceOrientation](https://github.com/gladiuscode/react-native-orientation-director/blob/main/src/hooks/useInterfaceOrientation.hook.ts) | Returns the current interface orientation and listens to changes |
|
|
99
133
|
| [useDeviceOrientation](https://github.com/gladiuscode/react-native-orientation-director/blob/main/src/hooks/useDeviceOrientation.hook.ts) | Returns the current device orientation and listens to changes |
|
|
100
134
|
| [useIsInterfaceOrientationLocked](https://github.com/gladiuscode/react-native-orientation-director/blob/main/src/hooks/useIsInterfaceOrientationLocked.hook.ts) | Returns the current interface orientation status and listens to changes |
|
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['OrientationDirector_' + name]
|
|
4
|
+
}
|
|
4
5
|
|
|
5
6
|
repositories {
|
|
6
7
|
google()
|
|
@@ -8,12 +9,13 @@ buildscript {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:7.2
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
12
13
|
// noinspection DifferentKotlinGradleVersion
|
|
13
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
|
|
17
19
|
def isNewArchitectureEnabled() {
|
|
18
20
|
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
21
|
}
|
|
@@ -25,10 +27,6 @@ if (isNewArchitectureEnabled()) {
|
|
|
25
27
|
apply plugin: "com.facebook.react"
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
def getExtOrDefault(name) {
|
|
29
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["OrientationDirector_" + name]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
30
|
def getExtOrIntegerDefault(name) {
|
|
33
31
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OrientationDirector_" + name]).toInteger()
|
|
34
32
|
}
|
|
@@ -111,10 +109,7 @@ def robolectric_version = getDefault("robolectricVersion")
|
|
|
111
109
|
def mockito_core_version = getDefault("mockitoCoreVersion")
|
|
112
110
|
|
|
113
111
|
dependencies {
|
|
114
|
-
|
|
115
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
116
|
-
//noinspection GradleDynamicVersion
|
|
117
|
-
implementation "com.facebook.react:react-native:+"
|
|
112
|
+
implementation "com.facebook.react:react-android"
|
|
118
113
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
119
114
|
|
|
120
115
|
testImplementation "junit:junit:$junit_version"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
OrientationDirector_kotlinVersion=
|
|
2
|
-
OrientationDirector_minSdkVersion=
|
|
3
|
-
OrientationDirector_targetSdkVersion=
|
|
4
|
-
OrientationDirector_compileSdkVersion=
|
|
5
|
-
|
|
1
|
+
OrientationDirector_kotlinVersion=2.0.21
|
|
2
|
+
OrientationDirector_minSdkVersion=24
|
|
3
|
+
OrientationDirector_targetSdkVersion=34
|
|
4
|
+
OrientationDirector_compileSdkVersion=35
|
|
5
|
+
OrientationDirector_ndkVersion=27.1.12297006
|
|
6
6
|
|
|
7
7
|
#########################
|
|
8
8
|
# TESTING
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
package com.orientationdirector
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
5
|
import com.facebook.react.bridge.NativeModule
|
|
6
6
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
@@ -8,7 +8,7 @@ import com.facebook.react.module.model.ReactModuleInfo
|
|
|
8
8
|
import com.orientationdirector.implementation.OrientationDirectorModuleImpl
|
|
9
9
|
import java.util.HashMap
|
|
10
10
|
|
|
11
|
-
class OrientationDirectorPackage :
|
|
11
|
+
class OrientationDirectorPackage : BaseReactPackage() {
|
|
12
12
|
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
13
13
|
return if (name == OrientationDirectorModuleImpl.NAME) {
|
|
14
14
|
OrientationDirectorModule(reactContext)
|
|
@@ -26,7 +26,6 @@ class OrientationDirectorPackage : TurboReactPackage() {
|
|
|
26
26
|
OrientationDirectorModuleImpl.NAME,
|
|
27
27
|
false, // canOverrideExistingModule
|
|
28
28
|
false, // needsEagerInit
|
|
29
|
-
true, // hasConstants
|
|
30
29
|
false, // isCxxModule
|
|
31
30
|
isTurboModule // isTurboModule
|
|
32
31
|
)
|
|
@@ -82,7 +82,22 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
82
82
|
context.currentActivity?.requestedOrientation = screenOrientation
|
|
83
83
|
|
|
84
84
|
updateIsLockedTo(true)
|
|
85
|
-
|
|
85
|
+
|
|
86
|
+
val orientationCanBeUpdatedDirectly = jsOrientation != Orientation.LANDSCAPE;
|
|
87
|
+
if (orientationCanBeUpdatedDirectly) {
|
|
88
|
+
updateLastInterfaceOrientationTo(jsOrientation)
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
val lastInterfaceOrientationIsAlreadyInLandscape = lastInterfaceOrientation == Orientation.LANDSCAPE_RIGHT
|
|
93
|
+
|| lastInterfaceOrientation == Orientation.LANDSCAPE_LEFT
|
|
94
|
+
if (lastInterfaceOrientationIsAlreadyInLandscape) {
|
|
95
|
+
updateLastInterfaceOrientationTo(lastInterfaceOrientation)
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
val systemDefaultLandscapeOrientation = Orientation.LANDSCAPE_RIGHT
|
|
100
|
+
updateLastInterfaceOrientationTo(systemDefaultLandscapeOrientation)
|
|
86
101
|
}
|
|
87
102
|
|
|
88
103
|
fun unlock() {
|
|
@@ -150,7 +165,8 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
150
165
|
return
|
|
151
166
|
}
|
|
152
167
|
|
|
153
|
-
|
|
168
|
+
val supportsLandscape = mUtils.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
|
169
|
+
if (isLocked && !supportsLandscape) {
|
|
154
170
|
return
|
|
155
171
|
}
|
|
156
172
|
|
|
@@ -167,6 +183,20 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
167
183
|
newInterfaceOrientation = mUtils.convertToOrientationFromScreenRotation(rotation)
|
|
168
184
|
}
|
|
169
185
|
|
|
186
|
+
/**
|
|
187
|
+
* This differs from iOS because we can't read the actual orientation of the interface,
|
|
188
|
+
* we read its rotation.
|
|
189
|
+
* This means that even if the requestedOrientation of the currentActivity is locked to landscape
|
|
190
|
+
* it reads every possible orientation and this is not what we want.
|
|
191
|
+
* Instead, we check that its value is either LANDSCAPE_RIGHT or LANDSCAPE_LEFT, otherwise we
|
|
192
|
+
* exit
|
|
193
|
+
*/
|
|
194
|
+
val newInterfaceOrientationIsNotLandscape = newInterfaceOrientation != Orientation.LANDSCAPE_RIGHT
|
|
195
|
+
&& newInterfaceOrientation != Orientation.LANDSCAPE_LEFT;
|
|
196
|
+
if (supportsLandscape && newInterfaceOrientationIsNotLandscape) {
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
|
|
170
200
|
if (newInterfaceOrientation == lastInterfaceOrientation) {
|
|
171
201
|
return
|
|
172
202
|
}
|
|
@@ -53,6 +53,7 @@ class Utils(private val context: ReactContext) {
|
|
|
53
53
|
Orientation.LANDSCAPE_RIGHT -> ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
|
54
54
|
Orientation.PORTRAIT_UPSIDE_DOWN -> ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
|
|
55
55
|
Orientation.LANDSCAPE_LEFT -> ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
|
|
56
|
+
Orientation.LANDSCAPE -> ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
|
|
56
57
|
else -> ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -62,6 +63,7 @@ class Utils(private val context: ReactContext) {
|
|
|
62
63
|
2 -> Orientation.LANDSCAPE_RIGHT
|
|
63
64
|
3 -> Orientation.PORTRAIT_UPSIDE_DOWN
|
|
64
65
|
4 -> Orientation.LANDSCAPE_LEFT
|
|
66
|
+
5 -> Orientation.LANDSCAPE
|
|
65
67
|
else -> Orientation.PORTRAIT
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -84,4 +86,12 @@ class Utils(private val context: ReactContext) {
|
|
|
84
86
|
else -> Orientation.UNKNOWN
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
|
|
90
|
+
fun getRequestedOrientation(): Int {
|
|
91
|
+
if (context.currentActivity?.requestedOrientation == null) {
|
|
92
|
+
return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return context.currentActivity!!.requestedOrientation;
|
|
96
|
+
}
|
|
87
97
|
}
|
|
@@ -144,6 +144,17 @@ class OrientationDirectorModuleImplTest {
|
|
|
144
144
|
)
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
@Test
|
|
148
|
+
fun assert_interface_orientation_matches_locked_to_landscape() {
|
|
149
|
+
mModule.lockTo(5)
|
|
150
|
+
|
|
151
|
+
assertEquals(
|
|
152
|
+
"When the interface is locked to landscape, getInterfaceOrientation should return landscape right",
|
|
153
|
+
Orientation.LANDSCAPE_RIGHT,
|
|
154
|
+
mModule.getInterfaceOrientation()
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
147
158
|
@Test
|
|
148
159
|
fun assert_is_locked_reset_when_unlock_is_executed() {
|
|
149
160
|
mModule.lockTo(1)
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build');
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
|
-
@objc public class EventManager
|
|
11
|
-
@objc public weak var delegate: OrientationEventEmitterDelegate?
|
|
10
|
+
@objc public class EventManager: NSObject {
|
|
11
|
+
@objc public weak var delegate: OrientationEventEmitterDelegate?
|
|
12
12
|
|
|
13
13
|
func sendDeviceOrientationDidChange(orientationValue: Int) {
|
|
14
14
|
guard let delegate = delegate else {
|
|
15
15
|
return
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
if
|
|
18
|
+
if !delegate.isJsListening {
|
|
19
19
|
return
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -28,20 +28,20 @@ import Foundation
|
|
|
28
28
|
return
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
if
|
|
31
|
+
if !delegate.isJsListening {
|
|
32
32
|
return
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
let params = Dictionary(dictionaryLiteral: ("orientation", orientationValue))
|
|
36
36
|
delegate.sendEvent(name: Event.InterfaceOrientationDidChange.rawValue, params: params as NSDictionary)
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
func sendLockDidChange(value: Bool) {
|
|
40
40
|
guard let delegate = delegate else {
|
|
41
41
|
return
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if
|
|
44
|
+
if !delegate.isJsListening {
|
|
45
45
|
return
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -65,6 +65,6 @@ public extension EventManager {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
@objc static var supportedEvents: [String] {
|
|
68
|
-
return Event.allCases.map(\.rawValue)
|
|
68
|
+
return Event.allCases.map(\.rawValue)
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
@objc public enum Orientation: Int {
|
|
11
|
-
case UNKNOWN, PORTRAIT, LANDSCAPE_RIGHT, PORTRAIT_UPSIDE_DOWN, LANDSCAPE_LEFT, FACE_UP, FACE_DOWN
|
|
11
|
+
case UNKNOWN, PORTRAIT, LANDSCAPE_RIGHT, PORTRAIT_UPSIDE_DOWN, LANDSCAPE_LEFT, LANDSCAPE, FACE_UP, FACE_DOWN
|
|
12
12
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import UIKit
|
|
10
10
|
|
|
11
|
-
@objc public class OrientationDirectorImpl
|
|
11
|
+
@objc public class OrientationDirectorImpl: NSObject {
|
|
12
12
|
private static let TAG = "OrientationDirectorImpl"
|
|
13
13
|
|
|
14
14
|
private let bundleManager: BundleManager = BundleManager()
|
|
@@ -50,7 +50,7 @@ import UIKit
|
|
|
50
50
|
@objc public func getDeviceOrientation() -> Orientation {
|
|
51
51
|
return lastDeviceOrientation
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
@objc public func getIsLocked() -> Bool {
|
|
55
55
|
return isLocked
|
|
56
56
|
}
|
|
@@ -61,7 +61,21 @@ import UIKit
|
|
|
61
61
|
self.requestInterfaceUpdateTo(mask: mask)
|
|
62
62
|
|
|
63
63
|
updateIsLockedTo(value: true)
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
let orientationCanBeUpdatedDirectly = jsOrientation != Orientation.LANDSCAPE
|
|
66
|
+
if orientationCanBeUpdatedDirectly {
|
|
67
|
+
updateLastInterfaceOrientationTo(value: jsOrientation)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let lastInterfaceOrientationIsAlreadyInLandscape = lastInterfaceOrientation == Orientation.LANDSCAPE_RIGHT || lastInterfaceOrientation == Orientation.LANDSCAPE_LEFT
|
|
72
|
+
if lastInterfaceOrientationIsAlreadyInLandscape {
|
|
73
|
+
updateLastInterfaceOrientationTo(value: lastInterfaceOrientation)
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let systemDefaultLandscapeOrientation = Orientation.LANDSCAPE_RIGHT
|
|
78
|
+
updateLastInterfaceOrientationTo(value: systemDefaultLandscapeOrientation)
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
@objc public func unlock() {
|
|
@@ -78,20 +92,20 @@ import UIKit
|
|
|
78
92
|
|
|
79
93
|
let lastMask = utils.convertToMaskFrom(jsOrientation: lastInterfaceOrientation)
|
|
80
94
|
let isLastMaskSupported = self.supportedInterfaceOrientations.contains(lastMask)
|
|
81
|
-
if
|
|
95
|
+
if isLastMaskSupported {
|
|
82
96
|
return
|
|
83
97
|
}
|
|
84
98
|
|
|
85
99
|
let supportedInterfaceOrientations = bundleManager.getSupportedInterfaceOrientations()
|
|
86
|
-
if
|
|
100
|
+
if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.portrait) {
|
|
87
101
|
self.updateLastInterfaceOrientationTo(value: Orientation.PORTRAIT)
|
|
88
102
|
return
|
|
89
103
|
}
|
|
90
|
-
if
|
|
104
|
+
if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeRight) {
|
|
91
105
|
self.updateLastInterfaceOrientationTo(value: Orientation.LANDSCAPE_RIGHT)
|
|
92
106
|
return
|
|
93
107
|
}
|
|
94
|
-
if
|
|
108
|
+
if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeLeft) {
|
|
95
109
|
self.updateLastInterfaceOrientationTo(value: Orientation.LANDSCAPE_LEFT)
|
|
96
110
|
return
|
|
97
111
|
}
|
|
@@ -114,7 +128,7 @@ import UIKit
|
|
|
114
128
|
|
|
115
129
|
private func initIsLocked() -> Bool {
|
|
116
130
|
let supportedOrientations = bundleManager.getSupportedInterfaceOrientations()
|
|
117
|
-
if
|
|
131
|
+
if supportedOrientations.count > 1 {
|
|
118
132
|
return false
|
|
119
133
|
}
|
|
120
134
|
|
|
@@ -154,14 +168,15 @@ import UIKit
|
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
private func adaptInterfaceTo(deviceOrientation: Orientation) {
|
|
157
|
-
|
|
171
|
+
let supportsLandscape = self.supportedInterfaceOrientations.contains(.landscape)
|
|
172
|
+
if isLocked && !supportsLandscape {
|
|
158
173
|
return
|
|
159
174
|
}
|
|
160
175
|
|
|
161
|
-
if
|
|
176
|
+
if deviceOrientation == Orientation.FACE_UP || deviceOrientation == Orientation.FACE_DOWN {
|
|
162
177
|
return
|
|
163
178
|
}
|
|
164
|
-
|
|
179
|
+
|
|
165
180
|
let newInterfaceOrientation = self.getOrientationFromInterface()
|
|
166
181
|
updateLastInterfaceOrientationTo(value: newInterfaceOrientation)
|
|
167
182
|
}
|
|
@@ -175,7 +190,7 @@ import UIKit
|
|
|
175
190
|
self.eventManager.sendInterfaceOrientationDidChange(orientationValue: value.rawValue)
|
|
176
191
|
lastInterfaceOrientation = value
|
|
177
192
|
}
|
|
178
|
-
|
|
193
|
+
|
|
179
194
|
private func getOrientationFromInterface() -> Orientation {
|
|
180
195
|
let interfaceOrientation = utils.getInterfaceOrientation()
|
|
181
196
|
return utils.convertToOrientationFrom(uiInterfaceOrientation: interfaceOrientation)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
public class SensorListener {
|
|
11
|
-
private var onOrientationDidChangeCallback: ((_ deviceOrientation: UIDeviceOrientation) -> Void)?
|
|
11
|
+
private var onOrientationDidChangeCallback: ((_ deviceOrientation: UIDeviceOrientation) -> Void)?
|
|
12
12
|
|
|
13
13
|
init() {
|
|
14
14
|
NotificationCenter.default.addObserver(
|
|
@@ -13,7 +13,7 @@ class Utils {
|
|
|
13
13
|
|
|
14
14
|
// TODO: Add .unknown
|
|
15
15
|
public func convertToOrientationFrom(uiInterfaceOrientation: UIInterfaceOrientation) -> Orientation {
|
|
16
|
-
switch
|
|
16
|
+
switch uiInterfaceOrientation {
|
|
17
17
|
case .landscapeRight:
|
|
18
18
|
return .LANDSCAPE_RIGHT
|
|
19
19
|
case .portraitUpsideDown:
|
|
@@ -26,7 +26,7 @@ class Utils {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
public func convertToOrientationFrom(deviceOrientation: UIDeviceOrientation) -> Orientation {
|
|
29
|
-
switch
|
|
29
|
+
switch deviceOrientation {
|
|
30
30
|
case .landscapeRight:
|
|
31
31
|
return .LANDSCAPE_RIGHT
|
|
32
32
|
case .portraitUpsideDown:
|
|
@@ -43,13 +43,15 @@ class Utils {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
public func convertToOrientationFrom(jsValue: NSNumber) -> Orientation {
|
|
46
|
-
switch
|
|
46
|
+
switch jsValue {
|
|
47
47
|
case 2:
|
|
48
48
|
return .LANDSCAPE_RIGHT
|
|
49
49
|
case 3:
|
|
50
50
|
return .PORTRAIT_UPSIDE_DOWN
|
|
51
51
|
case 4:
|
|
52
52
|
return .LANDSCAPE_LEFT
|
|
53
|
+
case 5:
|
|
54
|
+
return .LANDSCAPE
|
|
53
55
|
default:
|
|
54
56
|
return .PORTRAIT
|
|
55
57
|
}
|
|
@@ -60,7 +62,7 @@ class Utils {
|
|
|
60
62
|
https://developer.apple.com/documentation/uikit/uiviewcontroller/1621435-supportedinterfaceorientations
|
|
61
63
|
*/
|
|
62
64
|
public func convertToMaskFrom(jsOrientation: Orientation) -> UIInterfaceOrientationMask {
|
|
63
|
-
switch
|
|
65
|
+
switch jsOrientation {
|
|
64
66
|
case .PORTRAIT:
|
|
65
67
|
return .portrait
|
|
66
68
|
case .LANDSCAPE_RIGHT:
|
|
@@ -69,6 +71,8 @@ class Utils {
|
|
|
69
71
|
return .portraitUpsideDown
|
|
70
72
|
case .LANDSCAPE_LEFT:
|
|
71
73
|
return .landscapeLeft
|
|
74
|
+
case .LANDSCAPE:
|
|
75
|
+
return .landscape
|
|
72
76
|
default:
|
|
73
77
|
return .all
|
|
74
78
|
}
|
|
@@ -79,7 +83,7 @@ class Utils {
|
|
|
79
83
|
return UIInterfaceOrientation.unknown
|
|
80
84
|
}
|
|
81
85
|
|
|
82
|
-
return windowScene.interfaceOrientation
|
|
86
|
+
return windowScene.interfaceOrientation
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
/* This function is needed to get the current available window.
|
|
@@ -18,6 +18,7 @@ class RNOrientationDirector {
|
|
|
18
18
|
[_Orientation.Orientation.portraitUpsideDown]: 'Portrait Upside Down',
|
|
19
19
|
[_Orientation.Orientation.landscapeLeft]: 'Landscape Left',
|
|
20
20
|
[_Orientation.Orientation.landscapeRight]: 'Landscape Right',
|
|
21
|
+
[_Orientation.Orientation.landscape]: 'Landscape',
|
|
21
22
|
[_Orientation.Orientation.faceUp]: 'Face Up',
|
|
22
23
|
[_Orientation.Orientation.faceDown]: 'Face Down'
|
|
23
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_module","_interopRequireDefault","_Orientation","_AutoRotation","_OrientationType","_EventEmitter","e","__esModule","default","RNOrientationDirector","_humanReadableOrientationsResource","Orientation","unknown","portrait","portraitUpsideDown","landscapeLeft","landscapeRight","faceUp","faceDown","_humanReadableAutoRotationsResource","AutoRotation","enabled","disabled","setHumanReadableOrientations","resource","setHumanReadableAutoRotations","getInterfaceOrientation","Module","getDeviceOrientation","lockTo","orientation","orientationType","OrientationType","interface","unlock","isLocked","isAutoRotationEnabled","Platform","OS","resetSupportedInterfaceOrientations","listenForDeviceOrientationChanges","callback","EventEmitter","addDeviceOrientationDidChangeListener","listenForInterfaceOrientationChanges","addInterfaceOrientationDidChangeListener","listenForLockChanges","addLockDidChangeListener","convertOrientationToHumanReadableString","convertAutoRotationToHumanReadableString","autoRotation","isLockableOrientation","_default","exports"],"sourceRoot":"../../src","sources":["RNOrientationDirector.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAA0C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1C,MAAMG,qBAAqB,CAAC;EAC1B,OAAeC,kCAAkC,GAC/C;IACE,CAACC,wBAAW,CAACC,OAAO,GAAG,SAAS;IAChC,CAACD,wBAAW,CAACE,QAAQ,GAAG,UAAU;IAClC,CAACF,wBAAW,CAACG,kBAAkB,GAAG,sBAAsB;IACxD,CAACH,wBAAW,CAACI,aAAa,GAAG,gBAAgB;IAC7C,CAACJ,wBAAW,CAACK,cAAc,GAAG,iBAAiB;IAC/C,CAACL,wBAAW,CAACM,MAAM,GAAG,SAAS;IAC/B,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_module","_interopRequireDefault","_Orientation","_AutoRotation","_OrientationType","_EventEmitter","e","__esModule","default","RNOrientationDirector","_humanReadableOrientationsResource","Orientation","unknown","portrait","portraitUpsideDown","landscapeLeft","landscapeRight","landscape","faceUp","faceDown","_humanReadableAutoRotationsResource","AutoRotation","enabled","disabled","setHumanReadableOrientations","resource","setHumanReadableAutoRotations","getInterfaceOrientation","Module","getDeviceOrientation","lockTo","orientation","orientationType","OrientationType","interface","unlock","isLocked","isAutoRotationEnabled","Platform","OS","resetSupportedInterfaceOrientations","listenForDeviceOrientationChanges","callback","EventEmitter","addDeviceOrientationDidChangeListener","listenForInterfaceOrientationChanges","addInterfaceOrientationDidChangeListener","listenForLockChanges","addLockDidChangeListener","convertOrientationToHumanReadableString","convertAutoRotationToHumanReadableString","autoRotation","isLockableOrientation","_default","exports"],"sourceRoot":"../../src","sources":["RNOrientationDirector.ts"],"mappings":";;;;;;AAAA,IA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,EACjD;IACA,OAAOC,qBAAY,CAACG,wCAAwC,CAACJ,QAAQ,CAAC;EACxE;EAEA,OAAOK,oBAAoBA,CAACL,QAAsC,EAAE;IAClE,OAAOC,qBAAY,CAACK,wBAAwB,CAACN,QAAQ,CAAC;EACxD;EAEA,OAAOO,uCAAuCA,CAAClB,WAAwB,EAAE;IACvE,OAAOtB,qBAAqB,CAACC,kCAAkC,CAC7DqB,WAAW,CACZ;EACH;EAEA,OAAOmB,wCAAwCA,CAACC,YAA0B,EAAE;IAC1E,OAAO1C,qBAAqB,CAACW,mCAAmC,CAC9D+B,YAAY,CACb;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,qBAAqBA,CAC1BrB,WAAwB,EACY;IACpC,OAAO,EACLA,WAAW,KAAKpB,wBAAW,CAACC,OAAO,IACnCmB,WAAW,KAAKpB,wBAAW,CAACO,MAAM,IAClCa,WAAW,KAAKpB,wBAAW,CAACQ,QAAQ,CACrC;EACH;AACF;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAA9C,OAAA,GAEcC,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -10,8 +10,9 @@ let Orientation = exports.Orientation = /*#__PURE__*/function (Orientation) {
|
|
|
10
10
|
Orientation[Orientation["landscapeRight"] = 2] = "landscapeRight";
|
|
11
11
|
Orientation[Orientation["portraitUpsideDown"] = 3] = "portraitUpsideDown";
|
|
12
12
|
Orientation[Orientation["landscapeLeft"] = 4] = "landscapeLeft";
|
|
13
|
-
Orientation[Orientation["
|
|
14
|
-
Orientation[Orientation["
|
|
13
|
+
Orientation[Orientation["landscape"] = 5] = "landscape";
|
|
14
|
+
Orientation[Orientation["faceUp"] = 6] = "faceUp";
|
|
15
|
+
Orientation[Orientation["faceDown"] = 7] = "faceDown";
|
|
15
16
|
return Orientation;
|
|
16
17
|
}({});
|
|
17
18
|
//# sourceMappingURL=Orientation.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Orientation","exports"],"sourceRoot":"../../../src","sources":["types/Orientation.enum.ts"],"mappings":";;;;;;IAAYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Orientation","exports"],"sourceRoot":"../../../src","sources":["types/Orientation.enum.ts"],"mappings":";;;;;;IAAYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","Module","ModuleEventEmitter","Event","EventEmitter","addDeviceOrientationDidChangeListener","callback","listener","addListener","DeviceOrientationDidChange","OS","listenerCount","enableOrientationSensors","createDeviceOrientationListenerProxy","addInterfaceOrientationDidChangeListener","InterfaceOrientationDidChange","addLockDidChangeListener","LockDidChange","handler","get","target","propertyKey","receiver","disableOrientationSensorsIfLastListener","Reflect","Proxy","disableOrientationSensors"],"sourceRoot":"../../src","sources":["EventEmitter.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAkC,cAAc;AACjE,OAAOC,MAAM,IAAIC,kBAAkB,QAAQ,UAAU;A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a,KAAK,CAAC,EAAE;QACvBV,MAAM,CAACyB,yBAAyB,CAAC,CAAC;MACpC;IACF;EACF;AACF;AAEA,eAAetB,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Platform","Module","ModuleEventEmitter","Event","EventEmitter","addDeviceOrientationDidChangeListener","callback","listener","addListener","DeviceOrientationDidChange","OS","listenerCount","enableOrientationSensors","createDeviceOrientationListenerProxy","addInterfaceOrientationDidChangeListener","InterfaceOrientationDidChange","addLockDidChangeListener","LockDidChange","handler","get","target","propertyKey","receiver","disableOrientationSensorsIfLastListener","Reflect","Proxy","disableOrientationSensors"],"sourceRoot":"../../src","sources":["EventEmitter.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAkC,cAAc;AACjE,OAAOC,MAAM,IAAIC,kBAAkB,QAAQ,UAAU;AACrD,OAAOC,KAAK,MAAM,oBAAoB;AAItC,MAAMC,YAAY,CAAC;EACjB,OAAOC,qCAAqCA,CAC1CC,QAAiD,EACjD;IACA,IAAIC,QAAQ,GAAGL,kBAAkB,CAACM,WAAW,CAC3CL,KAAK,CAACM,0BAA0B,EAChCH,QACF,CAAC;IAED,IAAIN,QAAQ,CAACU,EAAE,KAAK,SAAS,EAAE;MAC7B,OAAOH,QAAQ;IACjB;IAEA,MAAMI,aAAa,GAAGT,kBAAkB,CAACS,aAAa,CACpDR,KAAK,CAACM,0BACR,CAAC;IAED,IAAIE,aAAa,KAAK,CAAC,EAAE;MACvBV,MAAM,CAACW,wBAAwB,CAAC,CAAC;IACnC;IAEA,OAAOR,YAAY,CAACS,oCAAoC,CAACN,QAAQ,CAAC;EACpE;EAEA,OAAOO,wCAAwCA,CAC7CR,QAAiD,EACjD;IACA,OAAOJ,kBAAkB,CAACM,WAAW,CACnCL,KAAK,CAACY,6BAA6B,EACnCT,QACF,CAAC;EACH;EAEA,OAAOU,wBAAwBA,CAACV,QAAsC,EAAE;IACtE,OAAOJ,kBAAkB,CAACM,WAAW,CAACL,KAAK,CAACc,aAAa,EAAEX,QAAQ,CAAC;EACtE;EAEA,OAAeO,oCAAoCA,CACjDN,QAA6B,EAC7B;IACA,MAAMW,OAA0C,GAAG;MACjDC,GAAGA,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,EAAE;QACjC,IAAID,WAAW,KAAK,QAAQ,EAAE;UAC5BE,uCAAuC,CAAC,CAAC;QAC3C;QACA,OAAOC,OAAO,CAACL,GAAG,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,CAAC;MACnD;IACF,CAAC;IAED,OAAO,IAAIG,KAAK,CAAClB,QAAQ,EAAEW,OAAO,CAAC;IAEnC,SAASK,uCAAuCA,CAAA,EAAG;MACjD,MAAMZ,aAAa,GAAGT,kBAAkB,CAACS,aAAa,CACpDR,KAAK,CAACM,0BACR,CAAC;MAED,IAAIE,aAAa,KAAK,CAAC,EAAE;QACvBV,MAAM,CAACyB,yBAAyB,CAAC,CAAC;MACpC;IACF;EACF;AACF;AAEA,eAAetB,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeOrientationDirector.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AA0BlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,qBAAqB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeOrientationDirector.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AA0BlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,qBAAqB,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { Platform } from 'react-native';
|
|
2
4
|
import Module from './module';
|
|
3
5
|
import { Orientation } from './types/Orientation.enum';
|
|
@@ -11,6 +13,7 @@ class RNOrientationDirector {
|
|
|
11
13
|
[Orientation.portraitUpsideDown]: 'Portrait Upside Down',
|
|
12
14
|
[Orientation.landscapeLeft]: 'Landscape Left',
|
|
13
15
|
[Orientation.landscapeRight]: 'Landscape Right',
|
|
16
|
+
[Orientation.landscape]: 'Landscape',
|
|
14
17
|
[Orientation.faceUp]: 'Face Up',
|
|
15
18
|
[Orientation.faceDown]: 'Face Down'
|
|
16
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","Module","Orientation","AutoRotation","OrientationType","EventEmitter","RNOrientationDirector","_humanReadableOrientationsResource","unknown","portrait","portraitUpsideDown","landscapeLeft","landscapeRight","faceUp","faceDown","_humanReadableAutoRotationsResource","enabled","disabled","setHumanReadableOrientations","resource","setHumanReadableAutoRotations","getInterfaceOrientation","getDeviceOrientation","lockTo","orientation","orientationType","interface","unlock","isLocked","isAutoRotationEnabled","OS","resetSupportedInterfaceOrientations","listenForDeviceOrientationChanges","callback","addDeviceOrientationDidChangeListener","listenForInterfaceOrientationChanges","addInterfaceOrientationDidChangeListener","listenForLockChanges","addLockDidChangeListener","convertOrientationToHumanReadableString","convertAutoRotationToHumanReadableString","autoRotation","isLockableOrientation"],"sourceRoot":"../../src","sources":["RNOrientationDirector.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,MAAM,MAAM,UAAU;AAE7B,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,eAAe,QAAQ,8BAA8B;AAK9D,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,MAAMC,qBAAqB,CAAC;EAC1B,OAAeC,kCAAkC,GAC/C;IACE,CAACL,WAAW,CAACM,OAAO,GAAG,SAAS;IAChC,CAACN,WAAW,CAACO,QAAQ,GAAG,UAAU;IAClC,CAACP,WAAW,CAACQ,kBAAkB,GAAG,sBAAsB;IACxD,CAACR,WAAW,CAACS,aAAa,GAAG,gBAAgB;IAC7C,CAACT,WAAW,CAACU,cAAc,GAAG,iBAAiB;IAC/C,CAACV,WAAW,CAACW,MAAM,GAAG,SAAS;IAC/B,
|
|
1
|
+
{"version":3,"names":["Platform","Module","Orientation","AutoRotation","OrientationType","EventEmitter","RNOrientationDirector","_humanReadableOrientationsResource","unknown","portrait","portraitUpsideDown","landscapeLeft","landscapeRight","landscape","faceUp","faceDown","_humanReadableAutoRotationsResource","enabled","disabled","setHumanReadableOrientations","resource","setHumanReadableAutoRotations","getInterfaceOrientation","getDeviceOrientation","lockTo","orientation","orientationType","interface","unlock","isLocked","isAutoRotationEnabled","OS","resetSupportedInterfaceOrientations","listenForDeviceOrientationChanges","callback","addDeviceOrientationDidChangeListener","listenForInterfaceOrientationChanges","addInterfaceOrientationDidChangeListener","listenForLockChanges","addLockDidChangeListener","convertOrientationToHumanReadableString","convertAutoRotationToHumanReadableString","autoRotation","isLockableOrientation"],"sourceRoot":"../../src","sources":["RNOrientationDirector.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,MAAM,MAAM,UAAU;AAE7B,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,eAAe,QAAQ,8BAA8B;AAK9D,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,MAAMC,qBAAqB,CAAC;EAC1B,OAAeC,kCAAkC,GAC/C;IACE,CAACL,WAAW,CAACM,OAAO,GAAG,SAAS;IAChC,CAACN,WAAW,CAACO,QAAQ,GAAG,UAAU;IAClC,CAACP,WAAW,CAACQ,kBAAkB,GAAG,sBAAsB;IACxD,CAACR,WAAW,CAACS,aAAa,GAAG,gBAAgB;IAC7C,CAACT,WAAW,CAACU,cAAc,GAAG,iBAAiB;IAC/C,CAACV,WAAW,CAACW,SAAS,GAAG,WAAW;IACpC,CAACX,WAAW,CAACY,MAAM,GAAG,SAAS;IAC/B,CAACZ,WAAW,CAACa,QAAQ,GAAG;EAC1B,CAAC;EAEH,OAAeC,mCAAmC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