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.
Files changed (76) hide show
  1. package/README.md +40 -6
  2. package/android/build.gradle +7 -12
  3. package/android/gradle.properties +5 -5
  4. package/android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt +2 -3
  5. package/android/src/main/java/com/orientationdirector/implementation/Orientation.kt +1 -0
  6. package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt +32 -2
  7. package/android/src/main/java/com/orientationdirector/implementation/Utils.kt +10 -0
  8. package/android/src/test/java/com/orientationdirector/implementation/OrientationDirectorModuleImplTest.kt +11 -0
  9. package/app.plugin.js +1 -0
  10. package/ios/implementation/EventManager.swift +7 -7
  11. package/ios/implementation/Orientation.swift +1 -1
  12. package/ios/implementation/OrientationDirectorImpl.swift +27 -12
  13. package/ios/implementation/SensorListener.swift +1 -1
  14. package/ios/implementation/Utils.swift +9 -5
  15. package/lib/commonjs/RNOrientationDirector.js +1 -0
  16. package/lib/commonjs/RNOrientationDirector.js.map +1 -1
  17. package/lib/commonjs/package.json +1 -0
  18. package/lib/commonjs/types/Orientation.enum.js +3 -2
  19. package/lib/commonjs/types/Orientation.enum.js.map +1 -1
  20. package/lib/module/EventEmitter.js +2 -0
  21. package/lib/module/EventEmitter.js.map +1 -1
  22. package/lib/module/NativeOrientationDirector.js +2 -0
  23. package/lib/module/NativeOrientationDirector.js.map +1 -1
  24. package/lib/module/RNOrientationDirector.js +3 -0
  25. package/lib/module/RNOrientationDirector.js.map +1 -1
  26. package/lib/module/hooks/useDeviceOrientation.hook.js +2 -0
  27. package/lib/module/hooks/useDeviceOrientation.hook.js.map +1 -1
  28. package/lib/module/hooks/useInterfaceOrientation.hook.js +2 -0
  29. package/lib/module/hooks/useInterfaceOrientation.hook.js.map +1 -1
  30. package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js +2 -0
  31. package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js.map +1 -1
  32. package/lib/module/index.js +2 -0
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/module.js +2 -0
  35. package/lib/module/module.js.map +1 -1
  36. package/lib/module/package.json +1 -0
  37. package/lib/module/types/AutoRotation.enum.js +2 -0
  38. package/lib/module/types/AutoRotation.enum.js.map +1 -1
  39. package/lib/module/types/Event.enum.js +2 -0
  40. package/lib/module/types/Event.enum.js.map +1 -1
  41. package/lib/module/types/HumanReadableAutoRotationsResource.type.js +2 -0
  42. package/lib/module/types/HumanReadableOrientationsResource.type.js +2 -0
  43. package/lib/module/types/LockableOrientation.type.js +2 -0
  44. package/lib/module/types/LockedEvent.interface.js +1 -1
  45. package/lib/module/types/Orientation.enum.js +5 -2
  46. package/lib/module/types/Orientation.enum.js.map +1 -1
  47. package/lib/module/types/OrientationEvent.interface.js +2 -0
  48. package/lib/module/types/OrientationType.enum.js +2 -0
  49. package/lib/module/types/OrientationType.enum.js.map +1 -1
  50. package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts +13 -0
  51. package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts.map +1 -0
  52. package/lib/typescript/plugin/src/index.d.ts +4 -0
  53. package/lib/typescript/plugin/src/index.d.ts.map +1 -0
  54. package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts +5 -0
  55. package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts.map +1 -0
  56. package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts +4 -0
  57. package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts.map +1 -0
  58. package/lib/typescript/src/RNOrientationDirector.d.ts.map +1 -1
  59. package/lib/typescript/src/types/LockableOrientation.type.d.ts +1 -1
  60. package/lib/typescript/src/types/LockableOrientation.type.d.ts.map +1 -1
  61. package/lib/typescript/src/types/Orientation.enum.d.ts +3 -2
  62. package/lib/typescript/src/types/Orientation.enum.d.ts.map +1 -1
  63. package/package.json +35 -9
  64. package/plugin/build/custom-mod/withBridgingHeader.d.ts +12 -0
  65. package/plugin/build/custom-mod/withBridgingHeader.js +107 -0
  66. package/plugin/build/index.d.ts +3 -0
  67. package/plugin/build/index.js +25 -0
  68. package/plugin/build/withRNOrientationAppDelegate.d.ts +4 -0
  69. package/plugin/build/withRNOrientationAppDelegate.js +71 -0
  70. package/plugin/build/withRNOrientationBridgingHeader.d.ts +3 -0
  71. package/plugin/build/withRNOrientationBridgingHeader.js +27 -0
  72. package/plugin/tsconfig.json +9 -0
  73. package/react-native-orientation-director.podspec +2 -1
  74. package/src/RNOrientationDirector.ts +1 -0
  75. package/src/types/LockableOrientation.type.ts +2 -1
  76. 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
- This library can be installed only for [Development Builds](https://docs.expo.dev/develop/development-builds/introduction/)
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.mm file.
57
- In your AppDelegate.mm file, import "OrientationDirector.h" and implement supportedInterfaceOrientationsForWindow method as follows:
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 |
@@ -1,6 +1,7 @@
1
1
  buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["OrientationDirector_kotlinVersion"]
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.1"
12
+ classpath "com.android.tools.build:gradle:8.7.2"
12
13
  // noinspection DifferentKotlinGradleVersion
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
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
- // For < 0.71, this will be from the local maven repo
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=1.7.0
2
- OrientationDirector_minSdkVersion=21
3
- OrientationDirector_targetSdkVersion=31
4
- OrientationDirector_compileSdkVersion=31
5
- OrientationDirector_ndkversion=21.4.7075529
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.TurboReactPackage
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 : TurboReactPackage() {
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
  )
@@ -9,6 +9,7 @@ enum class Orientation {
9
9
  LANDSCAPE_RIGHT,
10
10
  PORTRAIT_UPSIDE_DOWN,
11
11
  LANDSCAPE_LEFT,
12
+ LANDSCAPE,
12
13
  FACE_UP,
13
14
  FACE_DOWN,
14
15
  }
@@ -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
- updateLastInterfaceOrientationTo(jsOrientation)
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
- if (isLocked) {
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 : NSObject {
11
- @objc public weak var delegate: OrientationEventEmitterDelegate? = nil
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 (!delegate.isJsListening) {
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 (!delegate.isJsListening) {
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 (!delegate.isJsListening) {
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 : NSObject {
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
- updateLastInterfaceOrientationTo(value: jsOrientation)
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 (isLastMaskSupported) {
95
+ if isLastMaskSupported {
82
96
  return
83
97
  }
84
98
 
85
99
  let supportedInterfaceOrientations = bundleManager.getSupportedInterfaceOrientations()
86
- if (supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.portrait)) {
100
+ if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.portrait) {
87
101
  self.updateLastInterfaceOrientationTo(value: Orientation.PORTRAIT)
88
102
  return
89
103
  }
90
- if (supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeRight)) {
104
+ if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeRight) {
91
105
  self.updateLastInterfaceOrientationTo(value: Orientation.LANDSCAPE_RIGHT)
92
106
  return
93
107
  }
94
- if (supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeLeft)) {
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 (supportedOrientations.count > 1) {
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
- if (isLocked) {
171
+ let supportsLandscape = self.supportedInterfaceOrientations.contains(.landscape)
172
+ if isLocked && !supportsLandscape {
158
173
  return
159
174
  }
160
175
 
161
- if (deviceOrientation == Orientation.FACE_UP || deviceOrientation == Orientation.FACE_DOWN) {
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)? = nil
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(uiInterfaceOrientation) {
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(deviceOrientation) {
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(jsValue) {
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(jsOrientation) {
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,CAACN,wBAAW,CAACO,QAAQ,GAAG;EAC1B,CAAC;EAEH,OAAeC,mCAAmC,GAChD;IACE,CAACC,0BAAY,CAACR,OAAO,GAAG,SAAS;IACjC,CAACQ,0BAAY,CAACC,OAAO,GAAG,SAAS;IACjC,CAACD,0BAAY,CAACE,QAAQ,GAAG;EAC3B,CAAC;EAEHC,4BAA4BA,CAACC,QAA2C,EAAE;IACxEf,qBAAqB,CAACC,kCAAkC,GAAGc,QAAQ;EACrE;EAEAC,6BAA6BA,CAACD,QAA4C,EAAE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;IAC3CZ,eAAM,CAACY,mCAAmC,CAAC,CAAC;EAC9C;EAEA,OAAOC,iCAAiCA,CACtCC,QAAiD,EACjD;IACA,OAAOC,qBAAY,CAACC,qCAAqC,CAACF,QAAQ,CAAC;EACrE;EAEA,OAAOG,oCAAoCA,CACzCH,QAAiD,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,OAAOrB,qBAAqB,CAACC,kCAAkC,CAC7DoB,WAAW,CACZ;EACH;EAEA,OAAOmB,wCAAwCA,CAACC,YAA0B,EAAE;IAC1E,OAAOzC,qBAAqB,CAACU,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,KAAKnB,wBAAW,CAACC,OAAO,IACnCkB,WAAW,KAAKnB,wBAAW,CAACM,MAAM,IAClCa,WAAW,KAAKnB,wBAAW,CAACO,QAAQ,CACrC;EACH;AACF;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAA7C,OAAA,GAEcC,qBAAqB","ignoreList":[]}
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,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,SAAS,GAAG,WAAW;IACpC,CAACN,wBAAW,CAACO,MAAM,GAAG,SAAS;IAC/B,CAACP,wBAAW,CAACQ,QAAQ,GAAG;EAC1B,CAAC;EAEH,OAAeC,mCAAmC,GAChD;IACE,CAACC,0BAAY,CAACT,OAAO,GAAG,SAAS;IACjC,CAACS,0BAAY,CAACC,OAAO,GAAG,SAAS;IACjC,CAACD,0BAAY,CAACE,QAAQ,GAAG;EAC3B,CAAC;EAEHC,4BAA4BA,CAACC,QAA2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,GACjChB,0BAAY,CAACC,OAAO,GACpBD,0BAAY,CAACE,QAAQ;EAC3B;EAEA,OAAOiB,mCAAmCA,CAAA,EAAG;IAC3CZ,eAAM,CAACY,mCAAmC,CAAC,CAAC;EAC9C;EAEA,OAAOC,iCAAiCA,CACtCC,QAAiD,EACjD;IACA,OAAOC,qBAAY,CAACC,qCAAqC,CAACF,QAAQ,CAAC;EACrE;EAEA,OAAOG,oCAAoCA,CACzCH,QAAiD,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["faceUp"] = 5] = "faceUp";
14
- Orientation[Orientation["faceDown"] = 6] = "faceDown";
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,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import { Platform } from 'react-native';
2
4
  import Module, { ModuleEventEmitter } from './module';
3
5
  import Event from './types/Event.enum';
@@ -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;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
+ {"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,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import { TurboModuleRegistry } from 'react-native';
2
4
  export default TurboModuleRegistry.getEnforcing('OrientationDirector');
3
5
  //# sourceMappingURL=NativeOrientationDirector.js.map
@@ -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,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C,YAA0B,EAAE;IAC1E,OAAOnC,qBAAqB,CAACS,mCAAmC,CAC9D0B,YAAY,CACb;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,qBAAqBA,CAC1BlB,WAAwB,EACY;IACpC,OAAO,EACLA,WAAW,KAAKtB,WAAW,CAACM,OAAO,IACnCgB,WAAW,KAAKtB,WAAW,CAACW,MAAM,IAClCW,WAAW,KAAKtB,WAAW,CAACY,QAAQ,CACrC;EACH;AACF;AAEA,eAAeR,qBAAqB","ignoreList":[]}
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;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