expo-modules-core 0.4.4 → 0.4.8

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/CHANGELOG.md CHANGED
@@ -10,6 +10,26 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.4.8 — 2021-11-11
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix Gradle error when running Gradle from outside of the project directory. ([#15109](https://github.com/expo/expo/pull/15109) by [@kudo](https://github.com/kudo))
18
+
19
+ ## 0.4.7 — 2021-10-28
20
+
21
+ ### 🐛 Bug fixes
22
+
23
+ - Fix iOS app freezing in remote debugging mode. ([#14922](https://github.com/expo/expo/pull/14922) by [@kudo](https://github.com/kudo))
24
+
25
+ ## 0.4.6 — 2021-10-27
26
+
27
+ _This version does not introduce any user-facing changes._
28
+
29
+ ## 0.4.5 — 2021-10-25
30
+
31
+ _This version does not introduce any user-facing changes._
32
+
13
33
  ## 0.4.4 — 2021-10-15
14
34
 
15
35
  ### 🐛 Bug fixes
package/README.md CHANGED
@@ -8,7 +8,7 @@ For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-
8
8
 
9
9
  # Installation in bare React Native projects
10
10
 
11
- For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/expo/expo/tree/master/packages/react-native-unimodules) before continuing.
11
+ For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
12
12
 
13
13
  ### Add the package to your npm dependencies
14
14
 
@@ -55,23 +55,23 @@ end
55
55
  ```groovy
56
56
  // app/build.gradle
57
57
 
58
- apply from: new File(["node", "--print", "require.resolve('react-native-unimodules/package.json')"].execute().text.trim(), "../gradle.groovy")
59
- apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute().text.trim(), "../react.gradle")
60
- apply from: new File(["node", "--print", "require.resolve('expo-updates/package.json')"].execute().text.trim(), "../scripts/create-manifest-android.gradle")
58
+ apply from: new File(["node", "--print", "require.resolve('react-native-unimodules/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy")
59
+ apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../react.gradle")
60
+ apply from: new File(["node", "--print", "require.resolve('expo-updates/package.json')"].execute(null, rootDir).text.trim(), "../scripts/create-manifest-android.gradle")
61
61
 
62
62
  // ...
63
63
 
64
- apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute().text.trim(), "../native_modules.gradle");
64
+ apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
65
65
  applyNativeModulesAppBuildGradle(project)
66
66
  ```
67
67
 
68
68
  ```groovy
69
69
  // settings.gradle
70
70
 
71
- apply from: new File(["node", "--print", "require.resolve('react-native-unimodules/package.json')"].execute().text.trim(), "../gradle.groovy");
71
+ apply from: new File(["node", "--print", "require.resolve('react-native-unimodules/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy");
72
72
  includeUnimodulesProjects()
73
73
 
74
- apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute().text.trim(), "../native_modules.gradle");
74
+ apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
75
75
  applyNativeModulesSettingsGradle(settings)
76
76
  ```
77
77
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.4.4'
6
+ version = '0.4.8'
7
7
 
8
8
  buildscript {
9
9
  // Simple helper that allows the root project to override versions declared by this library.
@@ -56,8 +56,9 @@ android {
56
56
  defaultConfig {
57
57
  minSdkVersion safeExtGet("minSdkVersion", 21)
58
58
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
59
+ consumerProguardFiles 'proguard-rules.pro'
59
60
  versionCode 1
60
- versionName "0.4.4"
61
+ versionName "0.4.8"
61
62
  }
62
63
  lintOptions {
63
64
  abortOnError false
@@ -1,6 +1,6 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
- #import <ExpoModulesCore/EXBarCodeScannerInterface.h>
3
+ #import <ExpoModulesCore/EXBarcodeScannerInterface.h>
4
4
 
5
5
  @protocol EXBarCodeScannerProviderInterface
6
6
 
@@ -32,6 +32,7 @@ static const NSString *methodInfoArgumentsCountKey = @"argumentsCount";
32
32
 
33
33
  @interface RCTBridge (RegisterAdditionalModuleClasses)
34
34
 
35
+ - (NSArray<RCTModuleData *> *)registerModulesForClasses:(NSArray<Class> *)moduleClasses;
35
36
  - (void)registerAdditionalModuleClasses:(NSArray<Class> *)modules;
36
37
 
37
38
  @end
@@ -248,7 +249,7 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
248
249
  [bridge uiManager];
249
250
 
250
251
  // Register the view managers as additional modules.
251
- [bridge registerAdditionalModuleClasses:additionalModuleClasses];
252
+ [self registerAdditionalModuleClasses:additionalModuleClasses inBridge:bridge];
252
253
 
253
254
  // Bridge's `registerAdditionalModuleClasses:` method doesn't register
254
255
  // components in UIManager — we need to register them on our own.
@@ -263,6 +264,32 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
263
264
  [_exModuleRegistry initialize];
264
265
  }
265
266
 
267
+ - (void)registerAdditionalModuleClasses:(NSArray<Class> *)moduleClasses inBridge:(RCTBridge *)bridge
268
+ {
269
+ // In remote debugging mode, i.e. executorClass is `RCTWebSocketExecutor`,
270
+ // there is a deadlock issue in `registerAdditionalModuleClasses:` and causes app freezed.
271
+ // - The JS thread acquired the `RCTCxxBridge._moduleRegistryLock` lock in `RCTCxxBridge._initializeBridgeLocked`
272
+ // = it further goes into RCTObjcExecutor and tries to get module config from main thread
273
+ // - The main thread is pending in `RCTCxxBridge.registerAdditionalModuleClasses` where trying to acquire the same lock.
274
+ // To workaround the deadlock, we tend to use the non-locked registration and mutate the bridge internal module data.
275
+ // Since JS thread in this situation is waiting for main thread, it's safe to mutate module data without lock.
276
+ // The only risk should be the internal `_moduleRegistryCreated` flag without lock protection.
277
+ // As we just workaround in `RCTWebSocketExecutor` case, the risk of `_moduleRegistryCreated` race condition should be lower.
278
+ //
279
+ // Learn more about the non-locked initialization:
280
+ // https://github.com/facebook/react-native/blob/757bb75fbf837714725d7b2af62149e8e2a7ee51/React/CxxBridge/RCTCxxBridge.mm#L922-L935
281
+ // See the `_moduleRegistryCreated` false case
282
+ if ([NSStringFromClass([bridge executorClass]) isEqualToString:@"RCTWebSocketExecutor"]) {
283
+ NSNumber *moduleRegistryCreated = [bridge valueForKey:@"_moduleRegistryCreated"];
284
+ if (![moduleRegistryCreated boolValue]) {
285
+ [bridge registerModulesForClasses:moduleClasses];
286
+ return;
287
+ }
288
+ }
289
+
290
+ [bridge registerAdditionalModuleClasses:moduleClasses];
291
+ }
292
+
266
293
  - (void)registerComponentDataForModuleClasses:(NSArray<Class> *)moduleClasses inBridge:(RCTBridge *)bridge
267
294
  {
268
295
  // Hacky way to get a dictionary with `RCTComponentData` from UIManager.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "0.4.4",
3
+ "version": "0.4.8",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "@testing-library/react-hooks": "^7.0.1",
43
43
  "expo-module-scripts": "^2.0.0"
44
44
  },
45
- "gitHead": "e30402e90972d9e1838d7b63a40a71a41398a772"
45
+ "gitHead": "f93456e96091501a9b9f99246846cee29336a964"
46
46
  }