react-native-orientation-director 2.2.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 (55) 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/app.plugin.js +1 -0
  6. package/lib/commonjs/package.json +1 -0
  7. package/lib/module/EventEmitter.js +2 -0
  8. package/lib/module/EventEmitter.js.map +1 -1
  9. package/lib/module/NativeOrientationDirector.js +2 -0
  10. package/lib/module/NativeOrientationDirector.js.map +1 -1
  11. package/lib/module/RNOrientationDirector.js +2 -0
  12. package/lib/module/RNOrientationDirector.js.map +1 -1
  13. package/lib/module/hooks/useDeviceOrientation.hook.js +2 -0
  14. package/lib/module/hooks/useDeviceOrientation.hook.js.map +1 -1
  15. package/lib/module/hooks/useInterfaceOrientation.hook.js +2 -0
  16. package/lib/module/hooks/useInterfaceOrientation.hook.js.map +1 -1
  17. package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js +2 -0
  18. package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js.map +1 -1
  19. package/lib/module/index.js +2 -0
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/module/module.js +2 -0
  22. package/lib/module/module.js.map +1 -1
  23. package/lib/module/package.json +1 -0
  24. package/lib/module/types/AutoRotation.enum.js +2 -0
  25. package/lib/module/types/AutoRotation.enum.js.map +1 -1
  26. package/lib/module/types/Event.enum.js +2 -0
  27. package/lib/module/types/Event.enum.js.map +1 -1
  28. package/lib/module/types/HumanReadableAutoRotationsResource.type.js +2 -0
  29. package/lib/module/types/HumanReadableOrientationsResource.type.js +2 -0
  30. package/lib/module/types/LockableOrientation.type.js +2 -0
  31. package/lib/module/types/LockedEvent.interface.js +1 -1
  32. package/lib/module/types/Orientation.enum.js +2 -0
  33. package/lib/module/types/Orientation.enum.js.map +1 -1
  34. package/lib/module/types/OrientationEvent.interface.js +2 -0
  35. package/lib/module/types/OrientationType.enum.js +2 -0
  36. package/lib/module/types/OrientationType.enum.js.map +1 -1
  37. package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts +13 -0
  38. package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts.map +1 -0
  39. package/lib/typescript/plugin/src/index.d.ts +4 -0
  40. package/lib/typescript/plugin/src/index.d.ts.map +1 -0
  41. package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts +5 -0
  42. package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts.map +1 -0
  43. package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts +4 -0
  44. package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts.map +1 -0
  45. package/package.json +35 -9
  46. package/plugin/build/custom-mod/withBridgingHeader.d.ts +12 -0
  47. package/plugin/build/custom-mod/withBridgingHeader.js +107 -0
  48. package/plugin/build/index.d.ts +3 -0
  49. package/plugin/build/index.js +25 -0
  50. package/plugin/build/withRNOrientationAppDelegate.d.ts +4 -0
  51. package/plugin/build/withRNOrientationAppDelegate.js +71 -0
  52. package/plugin/build/withRNOrientationBridgingHeader.d.ts +3 -0
  53. package/plugin/build/withRNOrientationBridgingHeader.js +27 -0
  54. package/plugin/tsconfig.json +9 -0
  55. package/react-native-orientation-director.podspec +2 -1
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
  )
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./plugin/build');
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -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';
@@ -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":"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","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":"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","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import React, { useRef } from 'react';
2
4
  import RNOrientationDirector from '../RNOrientationDirector';
3
5
  import { Orientation } from '../types/Orientation.enum';
@@ -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,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import React, { useRef } from 'react';
2
4
  import RNOrientationDirector from '../RNOrientationDirector';
3
5
  import { Orientation } from '../types/Orientation.enum';
@@ -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,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import React from 'react';
2
4
  import RNOrientationDirector from '../RNOrientationDirector';
3
5
  /**
@@ -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":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  export { Orientation } from './types/Orientation.enum';
2
4
  export { AutoRotation } from './types/AutoRotation.enum';
3
5
  export { OrientationType } from './types/OrientationType.enum';
@@ -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":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
2
4
  const LINKING_ERROR = `The package 'react-native-orientation-director' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
5
  ios: "- You have run 'pod install'\n",
@@ -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,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  export let AutoRotation = /*#__PURE__*/function (AutoRotation) {
2
4
  AutoRotation[AutoRotation["unknown"] = 0] = "unknown";
3
5
  AutoRotation[AutoRotation["enabled"] = 1] = "enabled";
@@ -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,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  var Event = /*#__PURE__*/function (Event) {
2
4
  Event["DeviceOrientationDidChange"] = "DeviceOrientationDidChange";
3
5
  Event["InterfaceOrientationDidChange"] = "InterfaceOrientationDidChange";
@@ -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,4 @@
1
+ "use strict";
2
+
1
3
  export {};
2
4
  //# sourceMappingURL=HumanReadableAutoRotationsResource.type.js.map
@@ -1,2 +1,4 @@
1
+ "use strict";
2
+
1
3
  export {};
2
4
  //# sourceMappingURL=HumanReadableOrientationsResource.type.js.map
@@ -1,2 +1,4 @@
1
+ "use strict";
2
+
1
3
  export {};
2
4
  //# sourceMappingURL=LockableOrientation.type.js.map
@@ -1,2 +1,2 @@
1
-
1
+ "use strict";
2
2
  //# sourceMappingURL=LockedEvent.interface.js.map
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  export let Orientation = /*#__PURE__*/function (Orientation) {
2
4
  Orientation[Orientation["unknown"] = 0] = "unknown";
3
5
  Orientation[Orientation["portrait"] = 1] = "portrait";
@@ -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,2 +1,4 @@
1
+ "use strict";
2
+
1
3
  export {};
2
4
  //# sourceMappingURL=OrientationEvent.interface.js.map
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  export let OrientationType = /*#__PURE__*/function (OrientationType) {
2
4
  OrientationType["device"] = "device";
3
5
  OrientationType["interface"] = "interface";
@@ -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,4 @@
1
+ import { type ConfigPlugin } from '@expo/config-plugins';
2
+ declare const _default: ConfigPlugin<void>;
3
+ export default _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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;;AAyB9B,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-orientation-director",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
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 --noEmit",
32
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
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": "^0.73.1",
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.75.3",
71
- "react-native-builder-bob": "^0.23.2",
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,3 @@
1
+ import { type ConfigPlugin } from '@expo/config-plugins';
2
+ declare const _default: ConfigPlugin<void>;
3
+ export default _default;
@@ -0,0 +1,25 @@
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
+ /**
8
+ * So, expo config plugin are awesome and the documentation is well written, but I still needed to look around to see
9
+ * how other projects actually modify the AppDelegate. I've found react-native-firebase to implement a plugin config
10
+ * that changes the AppDelegate, so I'll leave their link as reference:
11
+ * https://github.com/invertase/react-native-firebase/blob/main/packages/app/plugin/src/ios/appDelegate.ts
12
+ *
13
+ * Kudos to them, because this stuff is hard!
14
+ *
15
+ * @param config
16
+ */
17
+ const withRNOrientationDirector = (config) => {
18
+ return (0, config_plugins_1.withPlugins)(config, [
19
+ withRNOrientationAppDelegate_1.withRNOrientationAppDelegate,
20
+ withRNOrientationBridgingHeader_1.withRNOrientationBridgingHeader,
21
+ withBridgingHeader_1.withAppBridgingHeaderMod,
22
+ ]);
23
+ };
24
+ const pak = require('react-native-orientation-director/package.json');
25
+ 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,3 @@
1
+ import { type ConfigPlugin } from '@expo/config-plugins';
2
+ export declare const withRNOrientationBridgingHeader: ConfigPlugin;
3
+ export declare function bridgingHeaderUpdater(originalContents: string): string;
@@ -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,9 @@
1
+ {
2
+ "extends": "expo-module-scripts/tsconfig.plugin",
3
+ "compilerOptions": {
4
+ "outDir": "build",
5
+ "rootDir": "src"
6
+ },
7
+ "include": ["./src"],
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*"]
9
+ }
@@ -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.