expo-modules-core 2.0.0-preview.7 → 2.0.0-preview.9

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 (24) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/android/build.gradle +3 -3
  3. package/android/src/main/java/expo/modules/adapters/react/apploader/RNHeadlessAppLoader.kt +5 -5
  4. package/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt +14 -5
  5. package/android/src/main/java/expo/modules/adapters/react/services/EventEmitterModule.java +2 -0
  6. package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +5 -0
  7. package/android/src/main/java/expo/modules/core/ModulePriorities.kt +1 -1
  8. package/android/src/main/java/expo/modules/core/ModuleRegistry.java +1 -0
  9. package/android/src/main/java/expo/modules/core/arguments/ReadableArguments.java +1 -0
  10. package/android/src/main/java/expo/modules/interfaces/taskManager/TaskServiceProviderHelper.kt +41 -0
  11. package/android/src/main/java/expo/modules/interfaces/taskManager/TaskServiceProviderInterface.java +18 -0
  12. package/android/src/main/java/expo/modules/kotlin/Promise.kt +6 -6
  13. package/android/src/main/java/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +2 -2
  14. package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObject.kt +1 -0
  15. package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverterHelper.kt +1 -0
  16. package/android/src/main/java/expo/modules/kotlin/views/GroupViewManagerWrapper.kt +2 -14
  17. package/android/src/main/java/expo/modules/kotlin/views/SimpleViewManagerWrapper.kt +2 -14
  18. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerWrapperDelegate.kt +11 -12
  19. package/build/ts-declarations/global.d.ts +17 -16
  20. package/build/ts-declarations/global.d.ts.map +1 -1
  21. package/package.json +2 -2
  22. package/src/ts-declarations/global.ts +22 -20
  23. package/ios/Interfaces/BarcodeScanner/EXBarcodeScannerInterface.h +0 -22
  24. package/ios/Interfaces/BarcodeScanner/EXBarcodeScannerProviderInterface.h +0 -9
package/CHANGELOG.md CHANGED
@@ -10,6 +10,23 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 2.0.0-preview.9 — 2024-10-31
14
+
15
+ ### 💡 Others
16
+
17
+ - [Android] Fix `ClassCastException` in headless app loader under the old architecture. ([#32390](https://github.com/expo/expo/pull/32390) by [@robertying](https://github.com/robertying))
18
+
19
+ ## 2.0.0-preview.8 — 2024-10-31
20
+
21
+ ### 🛠 Breaking changes
22
+
23
+ - Remove expo barcode scanner interface. ([#32198](https://github.com/expo/expo/pull/32198) by [@aleqsio](https://github.com/aleqsio))
24
+
25
+ ### 💡 Others
26
+
27
+ - [android] Added helper for looking up TaskService instance used by expo-task-manager ([#32300](https://github.com/expo/expo/pull/32300) by [@chrfalch](https://github.com/chrfalch))
28
+ - Made TypeScript declaration for `process` an interface. ([#32464](https://github.com/expo/expo/pull/32464) by [@tsapeta](https://github.com/tsapeta))
29
+
13
30
  ## 2.0.0-preview.7 — 2024-10-29
14
31
 
15
32
  ### 💡 Others
@@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3
3
  apply plugin: 'com.android.library'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '2.0.0-preview.7'
6
+ version = '2.0.0-preview.9'
7
7
 
8
8
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
9
  apply from: expoModulesCorePlugin
@@ -67,7 +67,7 @@ android {
67
67
  defaultConfig {
68
68
  consumerProguardFiles 'proguard-rules.pro'
69
69
  versionCode 1
70
- versionName "2.0.0-preview.7"
70
+ versionName "2.0.0-preview.9"
71
71
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
72
72
 
73
73
  testInstrumentationRunner "expo.modules.TestRunner"
@@ -198,7 +198,7 @@ dependencies {
198
198
 
199
199
  if (shouldTurnWarningsIntoErrors) {
200
200
  tasks.withType(JavaCompile) configureEach {
201
- options.compilerArgs << "-Werror" << "-Xlint:all"
201
+ options.compilerArgs << "-Werror" << "-Xlint:all" << '-Xlint:-serial' << '-Xlint:-rawtypes'
202
202
  }
203
203
  tasks.withType(KotlinCompile) configureEach {
204
204
  compilerOptions.allWarningsAsErrors = true
@@ -28,7 +28,7 @@ class RNHeadlessAppLoader @DoNotStrip constructor(private val context: Context)
28
28
  // In old arch reactHost will be null
29
29
  if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
30
30
  // New architecture
31
- val reactHost = (context as ReactApplication).reactHost ?: throw IllegalStateException("Your application does not have a valid reactHost")
31
+ val reactHost = (context.applicationContext as ReactApplication).reactHost ?: throw IllegalStateException("Your application does not have a valid reactHost")
32
32
  reactHost.addReactInstanceEventListener(
33
33
  object : ReactInstanceEventListener {
34
34
  override fun onReactContextInitialized(context: ReactContext) {
@@ -42,7 +42,7 @@ class RNHeadlessAppLoader @DoNotStrip constructor(private val context: Context)
42
42
  reactHost.start()
43
43
  } else {
44
44
  // Old architecture
45
- val reactInstanceManager = (context as ReactApplication).reactNativeHost.reactInstanceManager
45
+ val reactInstanceManager = (context.applicationContext as ReactApplication).reactNativeHost.reactInstanceManager
46
46
  reactInstanceManager.addReactInstanceEventListener(
47
47
  object : ReactInstanceEventListener {
48
48
  override fun onReactContextInitialized(context: ReactContext) {
@@ -69,7 +69,7 @@ class RNHeadlessAppLoader @DoNotStrip constructor(private val context: Context)
69
69
  val reactContext = appRecords[appScopeKey] ?: return false
70
70
  if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
71
71
  // New architecture
72
- val reactHost = (reactContext.baseContext as ReactApplication).reactHost ?: throw IllegalStateException("Your application does not have a valid reactHost")
72
+ val reactHost = (reactContext.applicationContext as ReactApplication).reactHost ?: throw IllegalStateException("Your application does not have a valid reactHost")
73
73
  android.os.Handler(reactContext.mainLooper).post {
74
74
  reactHost.destroy("Closing headless task app", null)
75
75
  HeadlessAppLoaderNotifier.notifyAppDestroyed(appScopeKey)
@@ -77,7 +77,7 @@ class RNHeadlessAppLoader @DoNotStrip constructor(private val context: Context)
77
77
  }
78
78
  } else {
79
79
  // Old architecture
80
- val reactNativeHost = (reactContext as ReactApplication).reactNativeHost
80
+ val reactNativeHost = (reactContext.applicationContext as ReactApplication).reactNativeHost
81
81
  if (reactNativeHost.hasInstance()) {
82
82
  val reactInstanceManager: ReactInstanceManager = reactNativeHost.reactInstanceManager
83
83
  android.os.Handler(reactContext.mainLooper).post {
@@ -106,7 +106,7 @@ class RNHeadlessAppLoader @DoNotStrip constructor(private val context: Context)
106
106
  return true
107
107
  } else {
108
108
  // Old architecture
109
- val reactNativeHost = (reactContext.baseContext as ReactApplication).reactNativeHost
109
+ val reactNativeHost = (reactContext.applicationContext as ReactApplication).reactNativeHost
110
110
  return reactNativeHost.reactInstanceManager.hasStartedCreatingInitialContext()
111
111
  }
112
112
  }
@@ -13,7 +13,6 @@ import androidx.core.content.ContextCompat
13
13
  import com.facebook.react.modules.core.PermissionAwareActivity
14
14
  import com.facebook.react.modules.core.PermissionListener
15
15
  import expo.modules.core.ModuleRegistry
16
- import expo.modules.core.Promise
17
16
  import expo.modules.core.interfaces.ActivityProvider
18
17
  import expo.modules.core.interfaces.InternalModule
19
18
  import expo.modules.core.interfaces.LifecycleEventListener
@@ -59,7 +58,12 @@ open class PermissionsService(val context: Context) : InternalModule, Permission
59
58
  mAskedPermissionsCache = context.applicationContext.getSharedPreferences(PREFERENCE_FILENAME, Context.MODE_PRIVATE)
60
59
  }
61
60
 
62
- override fun getPermissionsWithPromise(promise: Promise, vararg permissions: String) {
61
+ override fun getPermissionsWithPromise(
62
+ promise:
63
+ @Suppress("DEPRECATION")
64
+ expo.modules.core.Promise,
65
+ vararg permissions: String
66
+ ) {
63
67
  getPermissions(
64
68
  PermissionsResponseListener { permissionsMap: MutableMap<String, PermissionsResponse> ->
65
69
  val areAllGranted = permissionsMap.all { (_, response) -> response.status == PermissionsStatus.GRANTED }
@@ -86,7 +90,12 @@ open class PermissionsService(val context: Context) : InternalModule, Permission
86
90
  )
87
91
  }
88
92
 
89
- override fun askForPermissionsWithPromise(promise: Promise, vararg permissions: String) {
93
+ override fun askForPermissionsWithPromise(
94
+ promise:
95
+ @Suppress("DEPRECATION")
96
+ expo.modules.core.Promise,
97
+ vararg permissions: String
98
+ ) {
90
99
  askForPermissions(
91
100
  PermissionsResponseListener {
92
101
  getPermissionsWithPromise(promise, *permissions)
@@ -165,7 +174,7 @@ open class PermissionsService(val context: Context) : InternalModule, Permission
165
174
  return requestedPermissions!!.contains(permission)
166
175
  }
167
176
  return false
168
- } catch (e: PackageManager.NameNotFoundException) {
177
+ } catch (_: PackageManager.NameNotFoundException) {
169
178
  return false
170
179
  }
171
180
  }
@@ -206,7 +215,7 @@ open class PermissionsService(val context: Context) : InternalModule, Permission
206
215
  private fun canAskAgain(permission: String): Boolean {
207
216
  return mActivityProvider?.currentActivity?.let {
208
217
  ActivityCompat.shouldShowRequestPermissionRationale(it, permission)
209
- } ?: false
218
+ } == true
210
219
  }
211
220
 
212
221
  private fun parseNativeResult(permissionsString: Array<out String>, grantResults: IntArray): Map<String, PermissionsResponse> {
@@ -35,6 +35,7 @@ public class EventEmitterModule implements EventEmitter, InternalModule {
35
35
  }
36
36
 
37
37
  @Override
38
+ @SuppressWarnings("deprecation")
38
39
  public void emit(final int viewId, final String eventName, final Bundle eventBody) {
39
40
  final EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(mReactContext, viewId);
40
41
  dispatcher.dispatchEvent(new com.facebook.react.uimanager.events.Event(viewId) {
@@ -65,6 +66,7 @@ public class EventEmitterModule implements EventEmitter, InternalModule {
65
66
  return Collections.singletonList((Class) EventEmitter.class);
66
67
  }
67
68
 
69
+ @SuppressWarnings("deprecation")
68
70
  private static com.facebook.react.uimanager.events.Event getReactEventFromEvent(final int viewId, final Event event) {
69
71
  return new com.facebook.react.uimanager.events.Event(viewId) {
70
72
  @Override
@@ -70,6 +70,7 @@ public class UIManagerModuleWrapper implements
70
70
  }
71
71
 
72
72
  @Override
73
+ @SuppressWarnings("deprecation")
73
74
  public <T> void addUIBlock(final int tag, final UIBlock<T> block, final Class<T> tClass) {
74
75
  UIBlockInterface uiBlock = new UIBlockInterface() {
75
76
  @Override
@@ -105,6 +106,7 @@ public class UIManagerModuleWrapper implements
105
106
  }
106
107
 
107
108
  @Override
109
+ @SuppressWarnings("deprecation")
108
110
  public void addUIBlock(final GroupUIBlock block) {
109
111
  UIBlockInterface uiBlock = new UIBlockInterface() {
110
112
  @Override
@@ -141,6 +143,7 @@ public class UIManagerModuleWrapper implements
141
143
 
142
144
  @Nullable
143
145
  @Override
146
+ @SuppressWarnings("deprecation")
144
147
  public View resolveView(int viewTag) {
145
148
  final com.facebook.react.bridge.UIManager uiManager = UIManagerHelper.getUIManagerForReactTag(getContext(), viewTag);
146
149
  if (uiManager == null) {
@@ -263,6 +266,7 @@ public class UIManagerModuleWrapper implements
263
266
  }
264
267
 
265
268
  @androidx.annotation.OptIn(markerClass = FrameworkAPI.class)
269
+ @SuppressWarnings("deprecation")
266
270
  public CallInvokerHolderImpl getJSCallInvokerHolder() {
267
271
  return (CallInvokerHolderImpl) mReactContext.getCatalystInstance().getJSCallInvokerHolder();
268
272
  }
@@ -273,5 +277,6 @@ public class UIManagerModuleWrapper implements
273
277
  }
274
278
  }
275
279
 
280
+ @SuppressWarnings("deprecation")
276
281
  interface UIBlockInterface extends com.facebook.react.uimanager.UIBlock, com.facebook.react.fabric.interop.UIBlock {
277
282
  }
@@ -20,7 +20,7 @@ object ModulePriorities {
20
20
  // {key} to {value}
21
21
  // key: full qualified class name
22
22
  // value: priority value, the higher value takes precedence
23
- "expo.modules.splashscreen.SplashScreenPackage" to 11,
23
+ "host.exp.exponent.experience.splashscreen.legacy.SplashScreenPackage" to 11,
24
24
  "expo.modules.updates.UpdatesPackage" to 10
25
25
  )
26
26
  }
@@ -40,6 +40,7 @@ public class ModuleRegistry {
40
40
  return (T) mInternalModulesMap.get(interfaceClass);
41
41
  }
42
42
 
43
+ @SuppressWarnings("unchecked")
43
44
  public <T> T getSingletonModule(String singletonName, Class<T> singletonClass) {
44
45
  return (T) mSingletonModulesMap.get(singletonName);
45
46
  }
@@ -63,6 +63,7 @@ public interface ReadableArguments {
63
63
 
64
64
  int size();
65
65
 
66
+ @SuppressWarnings("unchecked")
66
67
  default Bundle toBundle() {
67
68
  Bundle bundle = new Bundle();
68
69
  for (String key : keys()) {
@@ -0,0 +1,41 @@
1
+ package expo.modules.interfaces.taskManager
2
+
3
+ import android.content.Context
4
+ import expo.modules.core.ModulePriorities
5
+ import expo.modules.core.interfaces.DoNotStrip
6
+ import expo.modules.core.interfaces.Package
7
+
8
+ @DoNotStrip
9
+ object TaskServiceProviderHelper {
10
+ /**
11
+ Uses reflection to look through the current list of packages and attempts to find
12
+ one that provides a TaskServiceInterface implementation.
13
+ @param context Provide the application context (context.getApplicationContext())
14
+ @return A implementation of the TaskServiceInterface it a package offers it
15
+ */
16
+ @DoNotStrip
17
+ fun getTaskServiceImpl(context: Context): TaskServiceInterface? {
18
+ // Use reflection to get the packages list from ExpoModulesPackageList without
19
+ // creating the reactInstanceManager. ExpoModulesPackageList is generated by
20
+ // autolinking and should safely be callable in this way - we already have a
21
+ // few other places in our code where it is called like this.
22
+ val expoModules: Class<*>? = try {
23
+ Class.forName("expo.modules.ExpoModulesPackageList")
24
+ } catch (e: ClassNotFoundException) {
25
+ // Handle the exception, e.g., log it or fallback to a default behavior
26
+ return null
27
+ }
28
+ val getPackageList = expoModules?.getMethod("getPackageList") ?: return null
29
+
30
+ // Invoke and get the list of packages
31
+ val result = getPackageList.invoke(null) as? List<*> ?: return null
32
+ val packages = result.filterIsInstance<Package>()
33
+ .sortedByDescending { ModulePriorities.get(it::class.qualifiedName) }
34
+
35
+ // Check if any of the packages are providing a task manager implementation
36
+ return packages
37
+ .filterIsInstance<TaskServiceProviderInterface>()
38
+ .firstOrNull()
39
+ ?.getTaskServiceImpl(context)
40
+ }
41
+ }
@@ -0,0 +1,18 @@
1
+ package expo.modules.interfaces.taskManager;
2
+
3
+ import android.content.Context;
4
+
5
+ import expo.modules.core.interfaces.Package;
6
+
7
+ /**
8
+ * Interface defining a package that provides a TaskServiceInterface implementation.
9
+ * This is utilized when an app is launched in the background without an activity.
10
+ * It enables running expo-task-manager JavaScript tasks in the background via the HeadlessAppLoader.
11
+ */
12
+ public interface TaskServiceProviderInterface extends Package {
13
+ /**
14
+ * @param context Current application context
15
+ * @return A task service implementation that can be provided without having setup the whole app
16
+ */
17
+ TaskServiceInterface getTaskServiceImpl(Context context);
18
+ }
@@ -46,15 +46,15 @@ fun Promise.toBridgePromise(): com.facebook.react.bridge.Promise {
46
46
  }
47
47
 
48
48
  override fun reject(code: String, message: String?) {
49
- expoPromise.reject(code ?: unknownCode, message, null)
49
+ expoPromise.reject(code, message, null)
50
50
  }
51
51
 
52
52
  override fun reject(code: String, throwable: Throwable?) {
53
- expoPromise.reject(code ?: unknownCode, null, throwable)
53
+ expoPromise.reject(code, null, throwable)
54
54
  }
55
55
 
56
56
  override fun reject(code: String, message: String?, throwable: Throwable?) {
57
- expoPromise.reject(code ?: unknownCode, message, throwable)
57
+ expoPromise.reject(code, message, throwable)
58
58
  }
59
59
 
60
60
  override fun reject(throwable: Throwable) {
@@ -66,15 +66,15 @@ fun Promise.toBridgePromise(): com.facebook.react.bridge.Promise {
66
66
  }
67
67
 
68
68
  override fun reject(code: String, userInfo: WritableMap) {
69
- expoPromise.reject(code ?: unknownCode, null, null)
69
+ expoPromise.reject(code, null, null)
70
70
  }
71
71
 
72
72
  override fun reject(code: String, throwable: Throwable?, userInfo: WritableMap) {
73
- expoPromise.reject(code ?: unknownCode, null, throwable)
73
+ expoPromise.reject(code, null, throwable)
74
74
  }
75
75
 
76
76
  override fun reject(code: String, message: String?, userInfo: WritableMap) {
77
- expoPromise.reject(code ?: unknownCode, message, null)
77
+ expoPromise.reject(code, message, null)
78
78
  }
79
79
 
80
80
  override fun reject(code: String?, message: String?, throwable: Throwable?, userInfo: WritableMap?) {
@@ -32,10 +32,10 @@ class ClassComponentBuilder<SharedObjectType : Any>(
32
32
 
33
33
  if (eventsDefinition != null && isSharedObject) {
34
34
  listOf("__expo_onStartListeningToEvent" to SharedObject::onStartListeningToEvent, "__expo_onStopListeningToEvent" to SharedObject::onStopListeningToEvent)
35
- .forEach { (name, function) ->
35
+ .forEach { (name, listener) ->
36
36
  SyncFunctionComponent(name, arrayOf(ownerType, toAnyType<String>()), toReturnType<Unit>()) { (self, eventName) ->
37
37
  enforceType<SharedObject, String>(self, eventName)
38
- function.invoke(self, eventName)
38
+ listener.invoke(self, eventName)
39
39
  }.also { function ->
40
40
  function.enumerable(false)
41
41
  syncFunctions[name] = function
@@ -63,6 +63,7 @@ open class SharedObject(runtimeContext: RuntimeContext? = null) {
63
63
  /**
64
64
  * Called when the shared object was released.
65
65
  */
66
+ @Suppress("DEPRECATION")
66
67
  open fun sharedObjectDidRelease() = deallocate()
67
68
 
68
69
  /**
@@ -41,6 +41,7 @@ fun Bundle.toJSValue(containerProvider: JSTypeConverter.ContainerProvider): Writ
41
41
  val result = containerProvider.createMap()
42
42
 
43
43
  for (key in keySet()) {
44
+ @Suppress("DEPRECATION")
44
45
  val value = get(key)
45
46
  val convertedValue = JSTypeConverter.legacyConvertToJSValue(value, containerProvider)
46
47
  result.putGeneric(key, convertedValue)
@@ -2,7 +2,6 @@ package expo.modules.kotlin.views
2
2
 
3
3
  import android.view.View
4
4
  import android.view.ViewGroup
5
- import com.facebook.react.common.MapBuilder
6
5
  import com.facebook.react.uimanager.ReactStylesDiffMap
7
6
  import com.facebook.react.uimanager.ThemedReactContext
8
7
  import com.facebook.react.uimanager.ViewGroupManager
@@ -48,19 +47,8 @@ class GroupViewManagerWrapper(
48
47
  }
49
48
 
50
49
  override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
51
- viewWrapperDelegate.getExportedCustomDirectEventTypeConstants()?.let {
52
- val directEvents = super.getExportedCustomDirectEventTypeConstants() ?: emptyMap()
53
- val builder = MapBuilder.builder<String, Any>()
54
- directEvents.forEach { event ->
55
- builder.put(event.key, event.value)
56
- }
57
- it.forEach { event ->
58
- builder.put(event.key, event.value)
59
- }
60
- return builder.build()
61
- }
62
-
63
- return super.getExportedCustomDirectEventTypeConstants()
50
+ val expoEvent = viewWrapperDelegate.getExportedCustomDirectEventTypeConstants() ?: emptyMap()
51
+ return super.getExportedCustomDirectEventTypeConstants()?.plus(expoEvent) ?: expoEvent
64
52
  }
65
53
 
66
54
  override fun addView(parent: ViewGroup, child: View, index: Int) {
@@ -1,7 +1,6 @@
1
1
  package expo.modules.kotlin.views
2
2
 
3
3
  import android.view.View
4
- import com.facebook.react.common.MapBuilder
5
4
  import com.facebook.react.uimanager.ReactStylesDiffMap
6
5
  import com.facebook.react.uimanager.SimpleViewManager
7
6
  import com.facebook.react.uimanager.ThemedReactContext
@@ -46,18 +45,7 @@ class SimpleViewManagerWrapper(
46
45
  }
47
46
 
48
47
  override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
49
- viewWrapperDelegate.getExportedCustomDirectEventTypeConstants()?.let {
50
- val directEvents = super.getExportedCustomDirectEventTypeConstants() ?: emptyMap()
51
- val builder = MapBuilder.builder<String, Any>()
52
- directEvents.forEach { event ->
53
- builder.put(event.key, event.value)
54
- }
55
- it.forEach { event ->
56
- builder.put(event.key, event.value)
57
- }
58
- return builder.build()
59
- }
60
-
61
- return super.getExportedCustomDirectEventTypeConstants()
48
+ val expoEvent = viewWrapperDelegate.getExportedCustomDirectEventTypeConstants() ?: emptyMap()
49
+ return super.getExportedCustomDirectEventTypeConstants()?.plus(expoEvent) ?: expoEvent
62
50
  }
63
51
  }
@@ -3,7 +3,6 @@ package expo.modules.kotlin.views
3
3
  import android.content.Context
4
4
  import android.view.View
5
5
  import com.facebook.react.bridge.ReadableMap
6
- import com.facebook.react.common.MapBuilder
7
6
  import expo.modules.kotlin.ModuleHolder
8
7
  import expo.modules.kotlin.events.normalizeEventName
9
8
  import expo.modules.kotlin.exception.OnViewDidUpdatePropsException
@@ -108,16 +107,16 @@ class ViewManagerWrapperDelegate(internal var moduleHolder: ModuleHolder<*>) {
108
107
  }
109
108
 
110
109
  fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
111
- val builder = MapBuilder.builder<String, Any>()
112
- definition
113
- .callbacksDefinition
114
- ?.names
115
- ?.forEach {
116
- builder.put(
117
- normalizeEventName(it),
118
- MapBuilder.of<String, Any>("registrationName", it)
119
- )
120
- }
121
- return builder.build()
110
+ return buildMap<String, Any> {
111
+ definition
112
+ .callbacksDefinition
113
+ ?.names
114
+ ?.forEach {
115
+ put(
116
+ normalizeEventName(it),
117
+ mapOf("registrationName" to it)
118
+ )
119
+ }
120
+ }
122
121
  }
123
122
  }
@@ -47,28 +47,29 @@ type ViewConfig = {
47
47
  registrationName: string;
48
48
  }>;
49
49
  };
50
+ export interface ExpoProcess {
51
+ env: {
52
+ NODE_ENV: string;
53
+ /** Used in `@expo/metro-runtime`. */
54
+ EXPO_DEV_SERVER_ORIGIN?: string;
55
+ EXPO_ROUTER_IMPORT_MODE?: string;
56
+ EXPO_ROUTER_ABS_APP_ROOT?: string;
57
+ EXPO_ROUTER_APP_ROOT?: string;
58
+ /** Maps to the `experiments.baseUrl` property in the project Expo config. This is injected by `babel-preset-expo` and supports automatic cache invalidation. */
59
+ EXPO_BASE_URL?: string;
60
+ /** Build-time representation of the `Platform.OS` value that the current JavaScript was bundled for. Does not support platform shaking wrapped require statements. */
61
+ EXPO_OS?: string;
62
+ [key: string]: any;
63
+ };
64
+ [key: string]: any;
65
+ }
50
66
  declare global {
51
67
  /**
52
68
  * Global object containing all the native bindings installed by Expo.
53
69
  * This object is not available in projects without the `expo` package installed.
54
70
  */
55
71
  var expo: ExpoGlobal;
56
- const process: {
57
- env: {
58
- NODE_ENV: string;
59
- /** Used in `@expo/metro-runtime`. */
60
- EXPO_DEV_SERVER_ORIGIN?: string;
61
- EXPO_ROUTER_IMPORT_MODE?: string;
62
- EXPO_ROUTER_ABS_APP_ROOT?: string;
63
- EXPO_ROUTER_APP_ROOT?: string;
64
- /** Maps to the `experiments.baseUrl` property in the project Expo config. This is injected by `babel-preset-expo` and supports automatic cache invalidation. */
65
- EXPO_BASE_URL?: string;
66
- /** Build-time representation of the `Platform.OS` value that the current JavaScript was bundled for. Does not support platform shaking wrapped require statements. */
67
- EXPO_OS?: string;
68
- [key: string]: any;
69
- };
70
- [key: string]: any;
71
- };
72
+ var process: ExpoProcess;
72
73
  }
73
74
  export {};
74
75
  //# sourceMappingURL=global.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAI7B;;OAEG;IACH,YAAY,EAAE,OAAO,YAAY,CAAC;IAElC;;OAEG;IACH,YAAY,EAAE,OAAO,YAAY,CAAC;IAElC;;OAEG;IACH,SAAS,EAAE,OAAO,SAAS,CAAC;IAE5B;;OAEG;IACH,YAAY,EAAE,OAAO,YAAY,CAAC;IAIlC;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhD;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC;IAEnD;;OAEG;IAC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AE,WAAW,CAAC;CAC1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "2.0.0-preview.7",
3
+ "version": "2.0.0-preview.9",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "src/index.ts",
6
6
  "types": "build/index.d.ts",
@@ -44,5 +44,5 @@
44
44
  "@testing-library/react-native": "^12.5.2",
45
45
  "expo-module-scripts": "^4.0.0"
46
46
  },
47
- "gitHead": "4079b33541cde650111f4cc417b1c1c4b170bcb6"
47
+ "gitHead": "a1e9c35ea13fa802878d5f3132a25174a4a56d35"
48
48
  }
@@ -60,6 +60,27 @@ type ViewConfig = {
60
60
  directEventTypes: Record<string, { registrationName: string }>;
61
61
  };
62
62
 
63
+ export interface ExpoProcess {
64
+ env: {
65
+ NODE_ENV: string;
66
+ /** Used in `@expo/metro-runtime`. */
67
+ EXPO_DEV_SERVER_ORIGIN?: string;
68
+
69
+ EXPO_ROUTER_IMPORT_MODE?: string;
70
+ EXPO_ROUTER_ABS_APP_ROOT?: string;
71
+ EXPO_ROUTER_APP_ROOT?: string;
72
+
73
+ /** Maps to the `experiments.baseUrl` property in the project Expo config. This is injected by `babel-preset-expo` and supports automatic cache invalidation. */
74
+ EXPO_BASE_URL?: string;
75
+
76
+ /** Build-time representation of the `Platform.OS` value that the current JavaScript was bundled for. Does not support platform shaking wrapped require statements. */
77
+ EXPO_OS?: string;
78
+
79
+ [key: string]: any;
80
+ };
81
+ [key: string]: any;
82
+ }
83
+
63
84
  /* eslint-disable no-var */
64
85
 
65
86
  declare global {
@@ -69,24 +90,5 @@ declare global {
69
90
  */
70
91
  var expo: ExpoGlobal;
71
92
 
72
- const process: {
73
- env: {
74
- NODE_ENV: string;
75
- /** Used in `@expo/metro-runtime`. */
76
- EXPO_DEV_SERVER_ORIGIN?: string;
77
-
78
- EXPO_ROUTER_IMPORT_MODE?: string;
79
- EXPO_ROUTER_ABS_APP_ROOT?: string;
80
- EXPO_ROUTER_APP_ROOT?: string;
81
-
82
- /** Maps to the `experiments.baseUrl` property in the project Expo config. This is injected by `babel-preset-expo` and supports automatic cache invalidation. */
83
- EXPO_BASE_URL?: string;
84
-
85
- /** Build-time representation of the `Platform.OS` value that the current JavaScript was bundled for. Does not support platform shaking wrapped require statements. */
86
- EXPO_OS?: string;
87
-
88
- [key: string]: any;
89
- };
90
- [key: string]: any;
91
- };
93
+ var process: ExpoProcess;
92
94
  }
@@ -1,22 +0,0 @@
1
- // Copyright 2016-present 650 Industries. All rights reserved.
2
-
3
- #import <Foundation/Foundation.h>
4
- #import <AVFoundation/AVFoundation.h>
5
-
6
- @protocol EXBarCodeScannerInterface
7
-
8
- #if !TARGET_OS_TV
9
- - (void)setSession:(AVCaptureSession *)session;
10
- - (void)setSessionQueue:(dispatch_queue_t)sessionQueue;
11
- - (void)setOnBarCodeScanned:(void (^)(NSDictionary *))onBarCodeScanned;
12
-
13
- - (void)setIsEnabled:(BOOL)enabled;
14
- - (void)setSettings:(NSDictionary *)settings;
15
-
16
- - (void)setPreviewLayer:(AVCaptureVideoPreviewLayer *)previewLayer;
17
-
18
- - (void)maybeStartBarCodeScanning;
19
- - (void)stopBarCodeScanning;
20
- #endif
21
-
22
- @end
@@ -1,9 +0,0 @@
1
- // Copyright 2016-present 650 Industries. All rights reserved.
2
-
3
- #import <ExpoModulesCore/EXBarcodeScannerInterface.h>
4
-
5
- @protocol EXBarCodeScannerProviderInterface
6
-
7
- - (id<EXBarCodeScannerInterface>)createBarCodeScanner;
8
-
9
- @end