react-native-orientation-director 2.2.0 → 2.3.1
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 +72 -8
- 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/ConfigurationChangedBroadcastReceiver.kt +52 -0
- package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt +23 -12
- package/app.plugin.js +1 -0
- package/lib/commonjs/package.json +1 -0
- 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 +2 -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 +2 -0
- 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/plugin/src/withRNOrientationMainActivity.d.ts +4 -0
- package/lib/typescript/plugin/src/withRNOrientationMainActivity.d.ts.map +1 -0
- 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 +27 -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/build/withRNOrientationMainActivity.d.ts +3 -0
- package/plugin/build/withRNOrientationMainActivity.js +62 -0
- package/plugin/tsconfig.json +9 -0
- package/react-native-orientation-director.podspec +2 -1
package/README.md
CHANGED
|
@@ -44,17 +44,66 @@ 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
|
+
|
|
67
|
+
> Note: only SDK 50 and above are supported, the plugin is configured to handle only the kotlin template.
|
|
68
|
+
|
|
54
69
|
## Setup
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
### Android
|
|
72
|
+
|
|
73
|
+
This library uses a custom broadcast receiver to handle the manual orientation changes: when the user disables the
|
|
74
|
+
autorotation feature and the system prompts the user to rotate the device, the library will listen to the broadcast
|
|
75
|
+
sent by the MainActivity and update the interface orientation accordingly.
|
|
76
|
+
|
|
77
|
+
To allow the library to listen to the broadcast, you need to override the `onConfigurationChanged` method in your
|
|
78
|
+
MainActivity file, as shown below:
|
|
79
|
+
|
|
80
|
+
```kotlin
|
|
81
|
+
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
82
|
+
super.onConfigurationChanged(newConfig)
|
|
83
|
+
|
|
84
|
+
val orientationDirectorCustomAction =
|
|
85
|
+
"${packageName}.${ConfigurationChangedBroadcastReceiver.CUSTOM_INTENT_ACTION}"
|
|
86
|
+
|
|
87
|
+
val intent =
|
|
88
|
+
Intent(orientationDirectorCustomAction).apply {
|
|
89
|
+
putExtra("newConfig", newConfig)
|
|
90
|
+
setPackage(packageName)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.sendBroadcast(intent)
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Nothing else is required for Android.
|
|
98
|
+
|
|
99
|
+
### iOS
|
|
100
|
+
|
|
101
|
+
To properly handle interface orientation changes in iOS, you need to update your AppDelegate file. Since React Native
|
|
102
|
+
0.77, the AppDelegate has been migrated to Swift, so see the instructions below for both Swift and Objective-C.
|
|
103
|
+
|
|
104
|
+
#### Objective-C
|
|
105
|
+
|
|
106
|
+
In your AppDelegate.h file, import "OrientationDirector.h" and implement supportedInterfaceOrientationsForWindow method as follows:
|
|
58
107
|
|
|
59
108
|
```objc
|
|
60
109
|
#import <OrientationDirector.h>
|
|
@@ -65,16 +114,31 @@ In your AppDelegate.mm file, import "OrientationDirector.h" and implement suppor
|
|
|
65
114
|
}
|
|
66
115
|
```
|
|
67
116
|
|
|
68
|
-
|
|
117
|
+
#### Swift
|
|
69
118
|
|
|
70
|
-
|
|
119
|
+
You need to create a [bridging header](https://developer.apple.com/documentation/swift/importing-objective-c-into-swift#Import-Code-Within-an-App-Target)
|
|
120
|
+
to import the library, as shown below:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
#import "OrientationDirector.h"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Then, in your AppDelegate.swift file, implement the supportedInterfaceOrientationsFor method as follows:
|
|
127
|
+
|
|
128
|
+
```swift
|
|
129
|
+
override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
|
|
130
|
+
return OrientationDirector.getSupportedInterfaceOrientationsForWindow()
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
If you need help, you can check the example project.
|
|
71
135
|
|
|
72
136
|
## Usage
|
|
73
137
|
|
|
74
138
|
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
139
|
|
|
76
140
|
| Method | Description |
|
|
77
|
-
|
|
141
|
+
|------------------------------------------|-----------------------------------------------------------------------------------|
|
|
78
142
|
| getInterfaceOrientation | Returns the last interface orientation |
|
|
79
143
|
| getDeviceOrientation | Returns the last device orientation |
|
|
80
144
|
| lockTo | Locks the interface to a specific orientation |
|
|
@@ -94,7 +158,7 @@ This library exports a class called: [RNOrientationDirector](https://github.com/
|
|
|
94
158
|
In addition, the library exposes the following hooks:
|
|
95
159
|
|
|
96
160
|
| Hook | Description |
|
|
97
|
-
|
|
161
|
+
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
|
|
98
162
|
| [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
163
|
| [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
164
|
| [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
|
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
package com.orientationdirector.implementation
|
|
2
|
+
|
|
3
|
+
import android.content.BroadcastReceiver
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import android.content.IntentFilter
|
|
7
|
+
import android.os.Build
|
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This custom broadcast receiver is needed to properly update the interface orientation when
|
|
12
|
+
* the user has disabled the automatic rotation.
|
|
13
|
+
*
|
|
14
|
+
* It listens for an explicit intent that the MainActivity can send in the onConfigurationChanged
|
|
15
|
+
* method and calls a custom callback that is set in the main implementation init
|
|
16
|
+
*/
|
|
17
|
+
class ConfigurationChangedBroadcastReceiver internal constructor(private val context: ReactApplicationContext) :
|
|
18
|
+
BroadcastReceiver() {
|
|
19
|
+
|
|
20
|
+
private var onReceiveCallback: ((intent: Intent?) -> Unit)? = null
|
|
21
|
+
|
|
22
|
+
override fun onReceive(context: Context?, intent: Intent?) {
|
|
23
|
+
this.onReceiveCallback?.invoke(intent)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
fun setOnReceiveCallback(callback: (intent: Intent?) -> Unit) {
|
|
27
|
+
onReceiveCallback = callback
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This method registers the receiver by checking the api we are currently running with.
|
|
32
|
+
* With the latest changes in Android 14, we need to explicitly set the `Context.RECEIVER_NOT_EXPORTED`
|
|
33
|
+
* flag.
|
|
34
|
+
*/
|
|
35
|
+
fun register() {
|
|
36
|
+
val filter = IntentFilter("${context.packageName}.$CUSTOM_INTENT_ACTION")
|
|
37
|
+
|
|
38
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
39
|
+
context.registerReceiver(this, filter, Context.RECEIVER_NOT_EXPORTED)
|
|
40
|
+
} else {
|
|
41
|
+
context.registerReceiver(this, filter)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fun unregister() {
|
|
46
|
+
context.unregisterReceiver(this)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
companion object {
|
|
50
|
+
const val CUSTOM_INTENT_ACTION = "CONFIGURATION_CHANGED"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -15,6 +15,7 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
15
15
|
)
|
|
16
16
|
)
|
|
17
17
|
private var mLifecycleListener = LifecycleListener()
|
|
18
|
+
private var mBroadcastReceiver = ConfigurationChangedBroadcastReceiver(context)
|
|
18
19
|
|
|
19
20
|
private var initialSupportedInterfaceOrientations = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
|
|
20
21
|
private var lastInterfaceOrientation = Orientation.UNKNOWN
|
|
@@ -31,24 +32,31 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
31
32
|
|
|
32
33
|
mAutoRotationObserver.enable()
|
|
33
34
|
|
|
35
|
+
mBroadcastReceiver.setOnReceiveCallback {
|
|
36
|
+
adaptInterfaceTo(lastDeviceOrientation, false)
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
context.addLifecycleEventListener(mLifecycleListener)
|
|
35
40
|
mLifecycleListener.setOnHostResumeCallback {
|
|
36
41
|
if (!didComputeInitialDeviceOrientation || areOrientationSensorsEnabled) {
|
|
37
42
|
mOrientationSensorsEventListener.enable()
|
|
38
43
|
}
|
|
39
44
|
mAutoRotationObserver.enable()
|
|
45
|
+
mBroadcastReceiver.register()
|
|
40
46
|
}
|
|
41
47
|
mLifecycleListener.setOnHostPauseCallback {
|
|
42
48
|
if (initialized && areOrientationSensorsEnabled) {
|
|
43
49
|
mOrientationSensorsEventListener.disable()
|
|
44
50
|
mAutoRotationObserver.disable()
|
|
45
51
|
}
|
|
52
|
+
mBroadcastReceiver.unregister()
|
|
46
53
|
}
|
|
47
54
|
mLifecycleListener.setOnHostDestroyCallback {
|
|
48
55
|
if (areOrientationSensorsEnabled) {
|
|
49
56
|
mOrientationSensorsEventListener.disable()
|
|
50
57
|
mAutoRotationObserver.disable()
|
|
51
58
|
}
|
|
59
|
+
mBroadcastReceiver.unregister()
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
initialSupportedInterfaceOrientations =
|
|
@@ -89,15 +97,16 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
89
97
|
return
|
|
90
98
|
}
|
|
91
99
|
|
|
92
|
-
val lastInterfaceOrientationIsAlreadyInLandscape =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
val lastInterfaceOrientationIsAlreadyInLandscape =
|
|
101
|
+
lastInterfaceOrientation == Orientation.LANDSCAPE_RIGHT
|
|
102
|
+
|| lastInterfaceOrientation == Orientation.LANDSCAPE_LEFT
|
|
103
|
+
if (lastInterfaceOrientationIsAlreadyInLandscape) {
|
|
104
|
+
updateLastInterfaceOrientationTo(lastInterfaceOrientation)
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
98
107
|
|
|
99
108
|
val systemDefaultLandscapeOrientation = Orientation.LANDSCAPE_RIGHT
|
|
100
|
-
|
|
109
|
+
updateLastInterfaceOrientationTo(systemDefaultLandscapeOrientation)
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
fun unlock() {
|
|
@@ -160,12 +169,13 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
171
|
|
|
163
|
-
private fun adaptInterfaceTo(deviceOrientation: Orientation) {
|
|
164
|
-
if (!mAutoRotationObserver.getLastAutoRotationStatus()) {
|
|
172
|
+
private fun adaptInterfaceTo(deviceOrientation: Orientation, checkLastAutoRotationStatus: Boolean = true) {
|
|
173
|
+
if (checkLastAutoRotationStatus && !mAutoRotationObserver.getLastAutoRotationStatus()) {
|
|
165
174
|
return
|
|
166
175
|
}
|
|
167
176
|
|
|
168
|
-
val supportsLandscape =
|
|
177
|
+
val supportsLandscape =
|
|
178
|
+
mUtils.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
|
169
179
|
if (isLocked && !supportsLandscape) {
|
|
170
180
|
return
|
|
171
181
|
}
|
|
@@ -191,8 +201,9 @@ class OrientationDirectorModuleImpl internal constructor(private val context: Re
|
|
|
191
201
|
* Instead, we check that its value is either LANDSCAPE_RIGHT or LANDSCAPE_LEFT, otherwise we
|
|
192
202
|
* exit
|
|
193
203
|
*/
|
|
194
|
-
val newInterfaceOrientationIsNotLandscape =
|
|
195
|
-
|
|
204
|
+
val newInterfaceOrientationIsNotLandscape =
|
|
205
|
+
newInterfaceOrientation != Orientation.LANDSCAPE_RIGHT
|
|
206
|
+
&& newInterfaceOrientation != Orientation.LANDSCAPE_LEFT;
|
|
196
207
|
if (supportsLandscape && newInterfaceOrientationIsNotLandscape) {
|
|
197
208
|
return
|
|
198
209
|
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -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,oBA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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 +1 @@
|
|
|
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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;IAC1E,OAAOpC,qBAAqB,CAACU,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,KAAKvB,WAAW,CAACM,OAAO,IACnCiB,WAAW,KAAKvB,WAAW,CAACY,MAAM,IAClCW,WAAW,KAAKvB,WAAW,CAACa,QAAQ,CACrC;EACH;AACF;AAEA,eAAeT,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;IAClC,C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qBAAqBA,CAC1BlB,WAAwB,EACY;IACpC,OAAO,EACLA,WAAW,KAAKvB,WAAW,CAACM,OAAO,IACnCiB,WAAW,KAAKvB,WAAW,CAACY,MAAM,IAClCW,WAAW,KAAKvB,WAAW,CAACa,QAAQ,CACrC;EACH;AACF;AAEA,eAAeT,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRef","RNOrientationDirector","Orientation","useDeviceOrientation","initialRender","orientation","setOrientation","useState","unknown","useEffect","current","getDeviceOrientation","then","onChange","event","subscription","listenForDeviceOrientationChanges","remove"],"sourceRoot":"../../../src","sources":["hooks/useDeviceOrientation.hook.ts"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,qBAAqB,MAAM,0BAA0B;AAE5D,SAASC,WAAW,QAAQ,2BAA2B;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACjC,MAAMC,aAAa,GAAGJ,MAAM,CAAC,KAAK,CAAC;EACnC,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAClDL,WAAW,CAACM,OACd,CAAC;EAEDT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,IAAIL,aAAa,CAACM,OAAO,EAAE;MACzB;IACF;IAEAN,aAAa,CAACM,OAAO,GAAG,IAAI;IAC5BT,qBAAqB,CAACU,oBAAoB,CAAC,CAAC,CAACC,IAAI,CAACN,cAAc,CAAC;EACnE,CAAC,EAAE,EAAE,CAAC;EAENP,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,MAAMI,QAAQ,GAAIC,KAAuB,IAAK;MAC5CR,cAAc,CAACQ,KAAK,CAACT,WAAW,CAAC;IACnC,CAAC;IAED,MAAMU,YAAY,GAChBd,qBAAqB,CAACe,iCAAiC,CAACH,QAAQ,CAAC;IACnE,OAAO,MAAM;MACXE,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOZ,WAAW;AACpB,CAAC;AAED,eAAeF,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useRef","RNOrientationDirector","Orientation","useDeviceOrientation","initialRender","orientation","setOrientation","useState","unknown","useEffect","current","getDeviceOrientation","then","onChange","event","subscription","listenForDeviceOrientationChanges","remove"],"sourceRoot":"../../../src","sources":["hooks/useDeviceOrientation.hook.ts"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,qBAAqB,MAAM,0BAA0B;AAE5D,SAASC,WAAW,QAAQ,2BAA2B;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACjC,MAAMC,aAAa,GAAGJ,MAAM,CAAC,KAAK,CAAC;EACnC,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAClDL,WAAW,CAACM,OACd,CAAC;EAEDT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,IAAIL,aAAa,CAACM,OAAO,EAAE;MACzB;IACF;IAEAN,aAAa,CAACM,OAAO,GAAG,IAAI;IAC5BT,qBAAqB,CAACU,oBAAoB,CAAC,CAAC,CAACC,IAAI,CAACN,cAAc,CAAC;EACnE,CAAC,EAAE,EAAE,CAAC;EAENP,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,MAAMI,QAAQ,GAAIC,KAAuB,IAAK;MAC5CR,cAAc,CAACQ,KAAK,CAACT,WAAW,CAAC;IACnC,CAAC;IAED,MAAMU,YAAY,GAChBd,qBAAqB,CAACe,iCAAiC,CAACH,QAAQ,CAAC;IACnE,OAAO,MAAM;MACXE,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOZ,WAAW;AACpB,CAAC;AAED,eAAeF,oBAAoB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRef","RNOrientationDirector","Orientation","useInterfaceOrientation","initialRender","orientation","setOrientation","useState","unknown","useEffect","current","getInterfaceOrientation","then","onChange","event","subscription","listenForInterfaceOrientationChanges","remove"],"sourceRoot":"../../../src","sources":["hooks/useInterfaceOrientation.hook.ts"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,qBAAqB,MAAM,0BAA0B;AAE5D,SAASC,WAAW,QAAQ,2BAA2B;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EACpC,MAAMC,aAAa,GAAGJ,MAAM,CAAC,KAAK,CAAC;EACnC,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAClDL,WAAW,CAACM,OACd,CAAC;EAEDT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,IAAIL,aAAa,CAACM,OAAO,EAAE;MACzB;IACF;IAEAN,aAAa,CAACM,OAAO,GAAG,IAAI;IAC5BT,qBAAqB,CAACU,uBAAuB,CAAC,CAAC,CAACC,IAAI,CAACN,cAAc,CAAC;EACtE,CAAC,EAAE,EAAE,CAAC;EAENP,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,MAAMI,QAAQ,GAAIC,KAAuB,IAAK;MAC5CR,cAAc,CAACQ,KAAK,CAACT,WAAW,CAAC;IACnC,CAAC;IAED,MAAMU,YAAY,GAChBd,qBAAqB,CAACe,oCAAoC,CAACH,QAAQ,CAAC;IACtE,OAAO,MAAM;MACXE,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOZ,WAAW;AACpB,CAAC;AAED,eAAeF,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useRef","RNOrientationDirector","Orientation","useInterfaceOrientation","initialRender","orientation","setOrientation","useState","unknown","useEffect","current","getInterfaceOrientation","then","onChange","event","subscription","listenForInterfaceOrientationChanges","remove"],"sourceRoot":"../../../src","sources":["hooks/useInterfaceOrientation.hook.ts"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,qBAAqB,MAAM,0BAA0B;AAE5D,SAASC,WAAW,QAAQ,2BAA2B;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EACpC,MAAMC,aAAa,GAAGJ,MAAM,CAAC,KAAK,CAAC;EACnC,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAClDL,WAAW,CAACM,OACd,CAAC;EAEDT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,IAAIL,aAAa,CAACM,OAAO,EAAE;MACzB;IACF;IAEAN,aAAa,CAACM,OAAO,GAAG,IAAI;IAC5BT,qBAAqB,CAACU,uBAAuB,CAAC,CAAC,CAACC,IAAI,CAACN,cAAc,CAAC;EACtE,CAAC,EAAE,EAAE,CAAC;EAENP,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,MAAMI,QAAQ,GAAIC,KAAuB,IAAK;MAC5CR,cAAc,CAACQ,KAAK,CAACT,WAAW,CAAC;IACnC,CAAC;IAED,MAAMU,YAAY,GAChBd,qBAAqB,CAACe,oCAAoC,CAACH,QAAQ,CAAC;IACtE,OAAO,MAAM;MACXE,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOZ,WAAW;AACpB,CAAC;AAED,eAAeF,uBAAuB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","RNOrientationDirector","useIsInterfaceOrientationLocked","orientation","setOrientation","useState","isLocked","useEffect","onChange","event","locked","subscription","listenForLockChanges","remove"],"sourceRoot":"../../../src","sources":["hooks/useIsInterfaceOrientationLocked.hook.ts"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,qBAAqB,MAAM,0BAA0B;AAG5D;AACA;AACA;AACA;AACA,MAAMC,+BAA+B,GAAGA,CAAA,KAAM;EAC5C,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGJ,KAAK,CAACK,QAAQ,CAAU,MAC5DJ,qBAAqB,CAACK,QAAQ,CAAC,CACjC,CAAC;EAEDN,KAAK,CAACO,SAAS,CAAC,MAAM;IACpB,MAAMC,QAAQ,GAAIC,KAAkB,IAAK;MACvCL,cAAc,CAACK,KAAK,CAACC,MAAM,CAAC;IAC9B,CAAC;IAED,MAAMC,YAAY,GAAGV,qBAAqB,CAACW,oBAAoB,CAACJ,QAAQ,CAAC;IACzE,OAAO,MAAM;MACXG,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOV,WAAW;AACpB,CAAC;AAED,eAAeD,+BAA+B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","RNOrientationDirector","useIsInterfaceOrientationLocked","orientation","setOrientation","useState","isLocked","useEffect","onChange","event","locked","subscription","listenForLockChanges","remove"],"sourceRoot":"../../../src","sources":["hooks/useIsInterfaceOrientationLocked.hook.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,qBAAqB,MAAM,0BAA0B;AAG5D;AACA;AACA;AACA;AACA,MAAMC,+BAA+B,GAAGA,CAAA,KAAM;EAC5C,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGJ,KAAK,CAACK,QAAQ,CAAU,MAC5DJ,qBAAqB,CAACK,QAAQ,CAAC,CACjC,CAAC;EAEDN,KAAK,CAACO,SAAS,CAAC,MAAM;IACpB,MAAMC,QAAQ,GAAIC,KAAkB,IAAK;MACvCL,cAAc,CAACK,KAAK,CAACC,MAAM,CAAC;IAC9B,CAAC;IAED,MAAMC,YAAY,GAAGV,qBAAqB,CAACW,oBAAoB,CAACJ,QAAQ,CAAC;IACzE,OAAO,MAAM;MACXG,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOV,WAAW;AACpB,CAAC;AAED,eAAeD,+BAA+B","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Orientation","AutoRotation","OrientationType","useDeviceOrientation","useInterfaceOrientation","useIsInterfaceOrientationLocked","RNOrientationDirector"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,eAAe,QAAQ,8BAA8B;AAE9D,OAAOC,oBAAoB,MAAM,mCAAmC;AACpE,SAASA,oBAAoB;AAE7B,OAAOC,uBAAuB,MAAM,sCAAsC;AAC1E,SAASA,uBAAuB;AAEhC,OAAOC,+BAA+B,MAAM,8CAA8C;AAC1F,SAASA,+BAA+B;AAExC,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,eAAeA,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Orientation","AutoRotation","OrientationType","useDeviceOrientation","useInterfaceOrientation","useIsInterfaceOrientationLocked","RNOrientationDirector"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,eAAe,QAAQ,8BAA8B;AAE9D,OAAOC,oBAAoB,MAAM,mCAAmC;AACpE,SAASA,oBAAoB;AAE7B,OAAOC,uBAAuB,MAAM,sCAAsC;AAC1E,SAASA,uBAAuB;AAEhC,OAAOC,+BAA+B,MAAM,8CAA8C;AAC1F,SAASA,+BAA+B;AAExC,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,eAAeA,qBAAqB","ignoreList":[]}
|
package/lib/module/module.js
CHANGED
package/lib/module/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","Module","require","OrientationDirector","OrientationDirectorModule","Proxy","get","Error","ModuleEventEmitter"],"sourceRoot":"../../src","sources":["module.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAG1E,MAAMC,aAAa,GACjB,4FAA4F,GAC5FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,MAAM,GAAGH,oBAAoB,GAC/BI,OAAO,CAAC,6BAA6B,CAAC,CAACL,OAAO,GAC9CL,aAAa,CAACW,mBAAmB;AAErC,MAAMC,yBAAyB,GAAGH,MAAM,GACpCA,MAAM,GACN,IAAII,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACb,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,MAAMc,kBAAkB,GAAG,IAAIjB,kBAAkB,CAACU,MAAM,CAAC;AAEhE,eAAeG,yBAAyB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","Module","require","OrientationDirector","OrientationDirectorModule","Proxy","get","Error","ModuleEventEmitter"],"sourceRoot":"../../src","sources":["module.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAG1E,MAAMC,aAAa,GACjB,4FAA4F,GAC5FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,MAAM,GAAGH,oBAAoB,GAC/BI,OAAO,CAAC,6BAA6B,CAAC,CAACL,OAAO,GAC9CL,aAAa,CAACW,mBAAmB;AAErC,MAAMC,yBAAyB,GAAGH,MAAM,GACpCA,MAAM,GACN,IAAII,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACb,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,MAAMc,kBAAkB,GAAG,IAAIjB,kBAAkB,CAACU,MAAM,CAAC;AAEhE,eAAeG,yBAAyB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AutoRotation"],"sourceRoot":"../../../src","sources":["types/AutoRotation.enum.ts"],"mappings":"AAAA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["AutoRotation"],"sourceRoot":"../../../src","sources":["types/AutoRotation.enum.ts"],"mappings":";;AAAA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Event"],"sourceRoot":"../../../src","sources":["types/Event.enum.ts"],"mappings":"IAAKA,KAAK,0BAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAAA,OAALA,KAAK;AAAA,EAALA,KAAK;AAMV,eAAeA,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Event"],"sourceRoot":"../../../src","sources":["types/Event.enum.ts"],"mappings":";;IAAKA,KAAK,0BAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAAA,OAALA,KAAK;AAAA,EAALA,KAAK;AAMV,eAAeA,KAAK","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
//# sourceMappingURL=LockedEvent.interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Orientation"],"sourceRoot":"../../../src","sources":["types/Orientation.enum.ts"],"mappings":"AAAA,WAAYA,WAAW,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
|
+
{"version":3,"names":["Orientation"],"sourceRoot":"../../../src","sources":["types/Orientation.enum.ts"],"mappings":";;AAAA,WAAYA,WAAW,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":["OrientationType"],"sourceRoot":"../../../src","sources":["types/OrientationType.enum.ts"],"mappings":"AAAA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["OrientationType"],"sourceRoot":"../../../src","sources":["types/OrientationType.enum.ts"],"mappings":";;AAAA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ConfigPlugin, IOSConfig, type Mod, type ExportedConfig } from '@expo/config-plugins';
|
|
2
|
+
/**
|
|
3
|
+
* This plugin adds a new mod to the prebuild that is the appBridgingHeader.
|
|
4
|
+
* This allows us to update it when the user launches the prebuild script.
|
|
5
|
+
*/
|
|
6
|
+
export declare function withAppBridgingHeaderMod(config: ExportedConfig): ExportedConfig;
|
|
7
|
+
/**
|
|
8
|
+
* This mod provides the app bridging header for modifications
|
|
9
|
+
* @param config
|
|
10
|
+
* @param action
|
|
11
|
+
*/
|
|
12
|
+
export declare const withAppBridgingHeader: ConfigPlugin<Mod<IOSConfig.Paths.AppDelegateProjectFile>>;
|
|
13
|
+
//# sourceMappingURL=withBridgingHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withBridgingHeader.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/custom-mod/withBridgingHeader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,SAAS,EACT,KAAK,GAAG,EAGR,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAS9B;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,kBAsB9D;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAC9C,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAO5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;;AA2B9B,wBAIE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
export declare const withRNOrientationAppDelegate: ConfigPlugin;
|
|
3
|
+
export declare function swiftFileUpdater(originalContents: string): string;
|
|
4
|
+
export declare function objCFileUpdater(originalContents: string): string;
|
|
5
|
+
//# sourceMappingURL=withRNOrientationAppDelegate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withRNOrientationAppDelegate.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withRNOrientationAppDelegate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAI9B,eAAO,MAAM,4BAA4B,EAAE,YAE1C,CAAC;AA8BF,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAkBjE;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CA6BhE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
export declare const withRNOrientationBridgingHeader: ConfigPlugin;
|
|
3
|
+
export declare function bridgingHeaderUpdater(originalContents: string): string;
|
|
4
|
+
//# sourceMappingURL=withRNOrientationBridgingHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withRNOrientationBridgingHeader.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withRNOrientationBridgingHeader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAK9B,eAAO,MAAM,+BAA+B,EAAE,YAE7C,CAAC;AAmBF,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,UAI7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withRNOrientationMainActivity.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withRNOrientationMainActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAI9B,eAAO,MAAM,6BAA6B,EAAE,YAE3C,CAAC;AA0BF,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CA2C9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-orientation-director",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A Modern React Native library that allows you to access orientation",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"android",
|
|
14
14
|
"ios",
|
|
15
15
|
"cpp",
|
|
16
|
+
"plugin/build",
|
|
17
|
+
"plugin/tsconfig.json",
|
|
18
|
+
"app.plugin.js",
|
|
16
19
|
"*.podspec",
|
|
17
20
|
"!ios/build",
|
|
18
21
|
"!android/build",
|
|
@@ -27,9 +30,10 @@
|
|
|
27
30
|
],
|
|
28
31
|
"scripts": {
|
|
29
32
|
"example": "yarn workspace react-native-orientation-director-example",
|
|
33
|
+
"expo-plugin": "yarn workspace react-native-orientation-director-expo-plugin",
|
|
30
34
|
"test": "jest",
|
|
31
|
-
"typecheck": "tsc
|
|
32
|
-
"lint": "eslint \"
|
|
35
|
+
"typecheck": "tsc",
|
|
36
|
+
"lint": "eslint \"src/**/*.{js,ts,tsx}\" \"example/**/*.{js,ts,tsx}\"",
|
|
33
37
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
34
38
|
"prepare": "bob build",
|
|
35
39
|
"release": "release-it"
|
|
@@ -55,7 +59,7 @@
|
|
|
55
59
|
"devDependencies": {
|
|
56
60
|
"@commitlint/config-conventional": "^17.0.2",
|
|
57
61
|
"@evilmartians/lefthook": "^1.5.0",
|
|
58
|
-
"@react-native/eslint-config": "
|
|
62
|
+
"@react-native/eslint-config": "0.77.0",
|
|
59
63
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
60
64
|
"@types/jest": "^29.5.5",
|
|
61
65
|
"@types/react": "^18.2.44",
|
|
@@ -64,24 +68,34 @@
|
|
|
64
68
|
"eslint": "^8.51.0",
|
|
65
69
|
"eslint-config-prettier": "^9.0.0",
|
|
66
70
|
"eslint-plugin-prettier": "^5.0.1",
|
|
71
|
+
"expo": "^52.0.35",
|
|
67
72
|
"jest": "^29.7.0",
|
|
68
73
|
"prettier": "^3.0.3",
|
|
69
74
|
"react": "18.3.1",
|
|
70
|
-
"react-native": "0.
|
|
71
|
-
"react-native-builder-bob": "^0.
|
|
75
|
+
"react-native": "0.77.0",
|
|
76
|
+
"react-native-builder-bob": "^0.36.0",
|
|
72
77
|
"release-it": "^15.0.0",
|
|
73
78
|
"turbo": "^1.10.7",
|
|
74
79
|
"typescript": "^5.2.2"
|
|
75
80
|
},
|
|
76
81
|
"resolutions": {
|
|
77
|
-
"@types/react": "^18.2.44"
|
|
82
|
+
"@types/react": "^18.2.44",
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
84
|
+
"@typescript-eslint/parser": "^7.1.1"
|
|
78
85
|
},
|
|
79
86
|
"peerDependencies": {
|
|
87
|
+
"expo": ">=47.0.0",
|
|
80
88
|
"react": "*",
|
|
81
89
|
"react-native": "*"
|
|
82
90
|
},
|
|
91
|
+
"peerDependenciesMeta": {
|
|
92
|
+
"expo": {
|
|
93
|
+
"optional": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
83
96
|
"workspaces": [
|
|
84
|
-
"example"
|
|
97
|
+
"example",
|
|
98
|
+
"plugin"
|
|
85
99
|
],
|
|
86
100
|
"packageManager": "yarn@3.6.1",
|
|
87
101
|
"jest": {
|
|
@@ -132,7 +146,11 @@
|
|
|
132
146
|
"@react-native",
|
|
133
147
|
"prettier"
|
|
134
148
|
],
|
|
149
|
+
"plugins": [
|
|
150
|
+
"prettier"
|
|
151
|
+
],
|
|
135
152
|
"rules": {
|
|
153
|
+
"react/react-in-jsx-scope": "off",
|
|
136
154
|
"prettier/prettier": [
|
|
137
155
|
"error",
|
|
138
156
|
{
|
|
@@ -173,6 +191,14 @@
|
|
|
173
191
|
"codegenConfig": {
|
|
174
192
|
"name": "RNOrientationDirectorSpec",
|
|
175
193
|
"type": "modules",
|
|
176
|
-
"jsSrcsDir": "src"
|
|
194
|
+
"jsSrcsDir": "src",
|
|
195
|
+
"android": {
|
|
196
|
+
"javaPackageName": "com.orientationdirector"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"create-react-native-library": {
|
|
200
|
+
"type": "turbo-module",
|
|
201
|
+
"languages": "kotlin-objc",
|
|
202
|
+
"version": "0.48.0"
|
|
177
203
|
}
|
|
178
204
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ConfigPlugin, IOSConfig, type Mod, type ExportedConfig } from '@expo/config-plugins';
|
|
2
|
+
/**
|
|
3
|
+
* This plugin adds a new mod to the prebuild that is the appBridgingHeader.
|
|
4
|
+
* This allows us to update it when the user launches the prebuild script.
|
|
5
|
+
*/
|
|
6
|
+
export declare function withAppBridgingHeaderMod(config: ExportedConfig): ExportedConfig;
|
|
7
|
+
/**
|
|
8
|
+
* This mod provides the app bridging header for modifications
|
|
9
|
+
* @param config
|
|
10
|
+
* @param action
|
|
11
|
+
*/
|
|
12
|
+
export declare const withAppBridgingHeader: ConfigPlugin<Mod<IOSConfig.Paths.AppDelegateProjectFile>>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.withAppBridgingHeader = void 0;
|
|
37
|
+
exports.withAppBridgingHeaderMod = withAppBridgingHeaderMod;
|
|
38
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
39
|
+
const glob_1 = require("glob");
|
|
40
|
+
const fs = __importStar(require("node:fs"));
|
|
41
|
+
/**
|
|
42
|
+
* Reference: https://github.com/expo/expo/blob/cb38337d37c35a26ac9a39eac2268c4735f488ad/packages/%40expo/config-plugins/src/ios/Paths.ts#L10C1-L10C69
|
|
43
|
+
*/
|
|
44
|
+
const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
|
|
45
|
+
/**
|
|
46
|
+
* This plugin adds a new mod to the prebuild that is the appBridgingHeader.
|
|
47
|
+
* This allows us to update it when the user launches the prebuild script.
|
|
48
|
+
*/
|
|
49
|
+
function withAppBridgingHeaderMod(config) {
|
|
50
|
+
return config_plugins_1.BaseMods.withGeneratedBaseMods(config, {
|
|
51
|
+
platform: 'ios',
|
|
52
|
+
providers: {
|
|
53
|
+
// Append a custom rule to supply AppDelegate header data to mods on `mods.ios.appBridgingHeader`
|
|
54
|
+
appBridgingHeader: config_plugins_1.BaseMods.provider({
|
|
55
|
+
// Get the local filepath that should be passed to the `read` method.
|
|
56
|
+
getFilePath({ modRequest: { projectRoot } }) {
|
|
57
|
+
return getBridgingHeaderFilePath(projectRoot);
|
|
58
|
+
},
|
|
59
|
+
// Read the input file from the filesystem.
|
|
60
|
+
async read(filePath) {
|
|
61
|
+
return config_plugins_1.IOSConfig.Paths.getFileInfo(filePath);
|
|
62
|
+
},
|
|
63
|
+
// Write the resulting output to the filesystem.
|
|
64
|
+
async write(filePath, { modResults: { contents } }) {
|
|
65
|
+
await fs.promises.writeFile(filePath, contents);
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* This mod provides the app bridging header for modifications
|
|
73
|
+
* @param config
|
|
74
|
+
* @param action
|
|
75
|
+
*/
|
|
76
|
+
const withAppBridgingHeader = (config, action) => {
|
|
77
|
+
return (0, config_plugins_1.withMod)(config, {
|
|
78
|
+
platform: 'ios',
|
|
79
|
+
mod: 'appBridgingHeader',
|
|
80
|
+
action,
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
exports.withAppBridgingHeader = withAppBridgingHeader;
|
|
84
|
+
/**
|
|
85
|
+
* Reference: https://github.com/expo/expo/blob/cb38337d37c35a26ac9a39eac2268c4735f488ad/packages/%40expo/config-plugins/src/ios/Paths.ts#L23
|
|
86
|
+
* @param projectRoot
|
|
87
|
+
*/
|
|
88
|
+
function getBridgingHeaderFilePath(projectRoot) {
|
|
89
|
+
const [using, ...extra] = withSortedGlobResult((0, glob_1.globSync)('ios/*/*-Bridging-Header.h', {
|
|
90
|
+
absolute: true,
|
|
91
|
+
cwd: projectRoot,
|
|
92
|
+
ignore: ignoredPaths,
|
|
93
|
+
}));
|
|
94
|
+
if (!using) {
|
|
95
|
+
throw new Error(`Could not locate a valid Bridging-Header at root: "${projectRoot}"`);
|
|
96
|
+
}
|
|
97
|
+
if (extra.length) {
|
|
98
|
+
throw new Error(`Multiple Bridging-Header found at root: "${projectRoot}"`);
|
|
99
|
+
}
|
|
100
|
+
return using;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Reference: https://github.com/expo/expo/blob/main/packages/%40expo/config-plugins/src/utils/glob.ts
|
|
104
|
+
*/
|
|
105
|
+
function withSortedGlobResult(glob) {
|
|
106
|
+
return glob.sort((a, b) => a.localeCompare(b));
|
|
107
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
+
const withBridgingHeader_1 = require("./custom-mod/withBridgingHeader");
|
|
5
|
+
const withRNOrientationAppDelegate_1 = require("./withRNOrientationAppDelegate");
|
|
6
|
+
const withRNOrientationBridgingHeader_1 = require("./withRNOrientationBridgingHeader");
|
|
7
|
+
const withRNOrientationMainActivity_1 = require("./withRNOrientationMainActivity");
|
|
8
|
+
/**
|
|
9
|
+
* So, expo config plugin are awesome and the documentation is well written, but I still needed to look around to see
|
|
10
|
+
* how other projects actually modify the AppDelegate. I've found react-native-firebase to implement a plugin config
|
|
11
|
+
* that changes the AppDelegate, so I'll leave their link as reference:
|
|
12
|
+
* https://github.com/invertase/react-native-firebase/blob/main/packages/app/plugin/src/ios/appDelegate.ts
|
|
13
|
+
*
|
|
14
|
+
* Kudos to them, because this stuff is hard!
|
|
15
|
+
*
|
|
16
|
+
* @param config
|
|
17
|
+
*/
|
|
18
|
+
const withRNOrientationDirector = (config) => {
|
|
19
|
+
return (0, config_plugins_1.withPlugins)(config, [
|
|
20
|
+
withRNOrientationAppDelegate_1.withRNOrientationAppDelegate,
|
|
21
|
+
withRNOrientationBridgingHeader_1.withRNOrientationBridgingHeader,
|
|
22
|
+
withRNOrientationMainActivity_1.withRNOrientationMainActivity,
|
|
23
|
+
withBridgingHeader_1.withAppBridgingHeaderMod,
|
|
24
|
+
]);
|
|
25
|
+
};
|
|
26
|
+
const pak = require('react-native-orientation-director/package.json');
|
|
27
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withRNOrientationDirector, pak.name, pak.version);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
export declare const withRNOrientationAppDelegate: ConfigPlugin;
|
|
3
|
+
export declare function swiftFileUpdater(originalContents: string): string;
|
|
4
|
+
export declare function objCFileUpdater(originalContents: string): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withRNOrientationAppDelegate = void 0;
|
|
4
|
+
exports.swiftFileUpdater = swiftFileUpdater;
|
|
5
|
+
exports.objCFileUpdater = objCFileUpdater;
|
|
6
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
7
|
+
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
8
|
+
const withRNOrientationAppDelegate = (config) => {
|
|
9
|
+
return (0, config_plugins_1.withAppDelegate)(config, readAppDelegateFileAndUpdateContents);
|
|
10
|
+
};
|
|
11
|
+
exports.withRNOrientationAppDelegate = withRNOrientationAppDelegate;
|
|
12
|
+
async function readAppDelegateFileAndUpdateContents(config) {
|
|
13
|
+
const { modResults: appDelegateFile } = config;
|
|
14
|
+
const worker = getCompatibleFileUpdater(appDelegateFile.language);
|
|
15
|
+
appDelegateFile.contents = worker(appDelegateFile.contents);
|
|
16
|
+
return config;
|
|
17
|
+
}
|
|
18
|
+
function getCompatibleFileUpdater(language) {
|
|
19
|
+
switch (language) {
|
|
20
|
+
case 'objc':
|
|
21
|
+
case 'objcpp': {
|
|
22
|
+
return objCFileUpdater;
|
|
23
|
+
}
|
|
24
|
+
case 'swift':
|
|
25
|
+
return swiftFileUpdater;
|
|
26
|
+
default:
|
|
27
|
+
throw new Error(`Cannot add React Native Orientation Director code to AppDelegate of language "${language}"`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function swiftFileUpdater(originalContents) {
|
|
31
|
+
const supportedInterfaceOrientationsForCodeBlock = `\n override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
|
|
32
|
+
return OrientationDirector.getSupportedInterfaceOrientationsForWindow()
|
|
33
|
+
}\n`;
|
|
34
|
+
const rightBeforeLastClosingBrace = /didFinishLaunchingWithOptions:\s*launchOptions\)/g;
|
|
35
|
+
const pasteInTheListJustAfterTheClosingBracket = 2;
|
|
36
|
+
const results = (0, generateCode_1.mergeContents)({
|
|
37
|
+
tag: '@react-native-orientation-director/supportedInterfaceOrientationsFor-implementation',
|
|
38
|
+
src: originalContents,
|
|
39
|
+
newSrc: supportedInterfaceOrientationsForCodeBlock,
|
|
40
|
+
anchor: rightBeforeLastClosingBrace,
|
|
41
|
+
offset: pasteInTheListJustAfterTheClosingBracket,
|
|
42
|
+
comment: '// React Native Orientation Director',
|
|
43
|
+
});
|
|
44
|
+
return results.contents;
|
|
45
|
+
}
|
|
46
|
+
function objCFileUpdater(originalContents) {
|
|
47
|
+
const libraryHeaderImportCodeBlock = '#import "OrientationDirector.h"\n';
|
|
48
|
+
const rightBeforeAppDelegateImplementation = /@implementation\s+\w+/g;
|
|
49
|
+
const headerImportMergeResults = (0, generateCode_1.mergeContents)({
|
|
50
|
+
tag: '@react-native-orientation-director/library-header-import',
|
|
51
|
+
src: originalContents,
|
|
52
|
+
newSrc: libraryHeaderImportCodeBlock,
|
|
53
|
+
anchor: rightBeforeAppDelegateImplementation,
|
|
54
|
+
offset: 0,
|
|
55
|
+
comment: '// React Native Orientation Director',
|
|
56
|
+
});
|
|
57
|
+
const supportedInterfaceOrientationsForCodeBlock = `- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
|
|
58
|
+
{
|
|
59
|
+
return [OrientationDirector getSupportedInterfaceOrientationsForWindow];
|
|
60
|
+
}\n`;
|
|
61
|
+
const rightBeforeLastClosingEnd = /@end[^@]*$/g;
|
|
62
|
+
const implementationMergeResults = (0, generateCode_1.mergeContents)({
|
|
63
|
+
tag: '@react-native-orientation-director/supportedInterfaceOrientationsFor-implementation',
|
|
64
|
+
src: headerImportMergeResults.contents,
|
|
65
|
+
newSrc: supportedInterfaceOrientationsForCodeBlock,
|
|
66
|
+
anchor: rightBeforeLastClosingEnd,
|
|
67
|
+
offset: 0,
|
|
68
|
+
comment: '// React Native Orientation Director',
|
|
69
|
+
});
|
|
70
|
+
return implementationMergeResults.contents;
|
|
71
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withRNOrientationBridgingHeader = void 0;
|
|
4
|
+
exports.bridgingHeaderUpdater = bridgingHeaderUpdater;
|
|
5
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
|
+
const withBridgingHeader_1 = require("./custom-mod/withBridgingHeader");
|
|
7
|
+
const withRNOrientationBridgingHeader = (config) => {
|
|
8
|
+
return (0, withBridgingHeader_1.withAppBridgingHeader)(config, readBridgingHeaderFileAndUpdateContents);
|
|
9
|
+
};
|
|
10
|
+
exports.withRNOrientationBridgingHeader = withRNOrientationBridgingHeader;
|
|
11
|
+
async function readBridgingHeaderFileAndUpdateContents(config) {
|
|
12
|
+
const { projectRoot } = config.modRequest;
|
|
13
|
+
if (isObjCTemplate(projectRoot)) {
|
|
14
|
+
return config;
|
|
15
|
+
}
|
|
16
|
+
const { modResults: bridgingHeaderFile } = config;
|
|
17
|
+
bridgingHeaderFile.contents = bridgingHeaderUpdater(bridgingHeaderFile.contents);
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
function bridgingHeaderUpdater(originalContents) {
|
|
21
|
+
const libraryHeaderImport = '#import "OrientationDirector.h"';
|
|
22
|
+
return originalContents.concat(`\n${libraryHeaderImport}`);
|
|
23
|
+
}
|
|
24
|
+
function isObjCTemplate(projectRoot) {
|
|
25
|
+
const appDelegateFile = config_plugins_1.IOSConfig.Paths.getAppDelegate(projectRoot);
|
|
26
|
+
return appDelegateFile.language !== 'swift';
|
|
27
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withRNOrientationMainActivity = void 0;
|
|
4
|
+
exports.ktFileUpdater = ktFileUpdater;
|
|
5
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
|
+
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
7
|
+
const withRNOrientationMainActivity = (config) => {
|
|
8
|
+
return (0, config_plugins_1.withMainActivity)(config, readMainActivityFileAndUpdateContents);
|
|
9
|
+
};
|
|
10
|
+
exports.withRNOrientationMainActivity = withRNOrientationMainActivity;
|
|
11
|
+
async function readMainActivityFileAndUpdateContents(config) {
|
|
12
|
+
const { modResults: mainActivityFile } = config;
|
|
13
|
+
const worker = getCompatibleFileUpdater(mainActivityFile.language);
|
|
14
|
+
mainActivityFile.contents = worker(mainActivityFile.contents);
|
|
15
|
+
return config;
|
|
16
|
+
}
|
|
17
|
+
function getCompatibleFileUpdater(language) {
|
|
18
|
+
switch (language) {
|
|
19
|
+
case 'kt':
|
|
20
|
+
return ktFileUpdater;
|
|
21
|
+
default:
|
|
22
|
+
throw new Error(`Cannot add React Native Orientation Director code to MainActivity of language "${language}"`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function ktFileUpdater(originalContents) {
|
|
26
|
+
const libraryImportCodeBlock = 'import com.orientationdirector.implementation.ConfigurationChangedBroadcastReceiver\n';
|
|
27
|
+
const rightBeforeClassDeclaration = /class MainActivity/g;
|
|
28
|
+
const importMergeResults = (0, generateCode_1.mergeContents)({
|
|
29
|
+
tag: '@react-native-orientation-director/library-import',
|
|
30
|
+
src: originalContents,
|
|
31
|
+
newSrc: libraryImportCodeBlock,
|
|
32
|
+
anchor: rightBeforeClassDeclaration,
|
|
33
|
+
offset: 0,
|
|
34
|
+
comment: '// React Native Orientation Director',
|
|
35
|
+
});
|
|
36
|
+
const onConfigurationChangedCodeBlock = `
|
|
37
|
+
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
38
|
+
super.onConfigurationChanged(newConfig)
|
|
39
|
+
|
|
40
|
+
val orientationDirectorCustomAction =
|
|
41
|
+
packageName + "." + ConfigurationChangedBroadcastReceiver.CUSTOM_INTENT_ACTION
|
|
42
|
+
|
|
43
|
+
val intent =
|
|
44
|
+
Intent(orientationDirectorCustomAction).apply {
|
|
45
|
+
putExtra("newConfig", newConfig)
|
|
46
|
+
setPackage(packageName)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this.sendBroadcast(intent)
|
|
50
|
+
}\n`;
|
|
51
|
+
const rightBeforeLastClosingBrace = /super\.onCreate/g;
|
|
52
|
+
const pasteInTheListJustAfterTheClosingBracket = 2;
|
|
53
|
+
const implementationMergeResults = (0, generateCode_1.mergeContents)({
|
|
54
|
+
tag: '@react-native-orientation-director/supportedInterfaceOrientationsFor-implementation',
|
|
55
|
+
src: importMergeResults.contents,
|
|
56
|
+
newSrc: onConfigurationChangedCodeBlock,
|
|
57
|
+
anchor: rightBeforeLastClosingBrace,
|
|
58
|
+
offset: pasteInTheListJustAfterTheClosingBracket,
|
|
59
|
+
comment: '// React Native Orientation Director',
|
|
60
|
+
});
|
|
61
|
+
return implementationMergeResults.contents;
|
|
62
|
+
}
|
|
@@ -14,7 +14,8 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.platforms = { :ios => min_ios_version_supported }
|
|
15
15
|
s.source = { :git => "https://github.com/gladiuscode/react-native-orientation-director.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
18
|
+
s.private_header_files = "ios/generated/**/*.h"
|
|
18
19
|
|
|
19
20
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
21
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|