react-native 0.72.6 → 0.72.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.
Files changed (25) hide show
  1. package/Libraries/Animated/NativeAnimatedHelper.js +6 -3
  2. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +6 -2
  3. package/Libraries/Core/ReactNativeVersion.js +1 -1
  4. package/Libraries/LogBox/Data/LogBoxData.js +2 -1
  5. package/Libraries/LogBox/Data/parseLogBoxLog.js +50 -20
  6. package/Libraries/promiseRejectionTrackingOptions.js +21 -7
  7. package/React/Base/RCTVersion.m +1 -1
  8. package/ReactAndroid/gradle.properties +1 -1
  9. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +1 -0
  10. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  11. package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +5 -0
  12. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +1 -0
  13. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +22 -6
  14. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java +19 -2
  15. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  16. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +22 -6
  17. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +4 -0
  18. package/flow-typed/npm/ansi-regex_v5.x.x.js +14 -0
  19. package/package.json +7 -6
  20. package/scripts/cocoapods/__tests__/codegen-test.rb +10 -11
  21. package/scripts/cocoapods/codegen.rb +5 -16
  22. package/scripts/codegen/generate-legacy-interop-components.js +8 -2
  23. package/sdks/hermesc/osx-bin/hermesc +0 -0
  24. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  25. package/template/package.json +1 -1
@@ -562,10 +562,13 @@ function transformDataType(value: number | string): number | string {
562
562
  if (typeof value !== 'string') {
563
563
  return value;
564
564
  }
565
- if (/deg$/.test(value)) {
565
+
566
+ // Normalize degrees and radians to a number expressed in radians
567
+ if (value.endsWith('deg')) {
566
568
  const degrees = parseFloat(value) || 0;
567
- const radians = (degrees * Math.PI) / 180.0;
568
- return radians;
569
+ return (degrees * Math.PI) / 180.0;
570
+ } else if (value.endsWith('rad')) {
571
+ return parseFloat(value) || 0;
569
572
  } else {
570
573
  return value;
571
574
  }
@@ -96,15 +96,19 @@ Pod::Spec.new do |s|
96
96
  s.dependency "React-utils"
97
97
  s.dependency "React-debug"
98
98
 
99
+ rel_path_from_pods_root_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(Pod::Config.instance.installation_root)
100
+ rel_path_from_pods_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(File.join(Pod::Config.instance.installation_root, 'Pods'))
101
+
102
+
99
103
  s.script_phases = {
100
104
  :name => "Generate Legacy Components Interop",
101
105
  :script => "
102
106
  WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"
103
107
  source $WITH_ENVIRONMENT
104
- ${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{ENV['APP_PATH']} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
108
+ ${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{rel_path_from_pods_to_app} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
105
109
  ",
106
110
  :execution_position => :before_compile,
107
- :input_files => ["#{ENV['APP_PATH']}/react-native.config.js"],
111
+ :input_files => ["#{rel_path_from_pods_root_to_app}/react-native.config.js"],
108
112
  :output_files => ["${REACT_NATIVE_PATH}/Libraries/AppDelegate/RCTLegacyInteropComponents.mm"],
109
113
  }
110
114
  end
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 72,
15
- patch: 6,
15
+ patch: 8,
16
16
  prerelease: null,
17
17
  };
@@ -30,6 +30,7 @@ export type LogData = $ReadOnly<{|
30
30
  message: Message,
31
31
  category: Category,
32
32
  componentStack: ComponentStack,
33
+ stack?: string,
33
34
  |}>;
34
35
 
35
36
  export type Observer = (
@@ -198,7 +199,7 @@ export function addLog(log: LogData): void {
198
199
  // otherwise spammy logs would pause rendering.
199
200
  setImmediate(() => {
200
201
  try {
201
- const stack = parseErrorStack(errorForStackTrace?.stack);
202
+ const stack = parseErrorStack(log.stack ?? errorForStackTrace?.stack);
202
203
 
203
204
  appendNewLog(
204
205
  new LogBoxLog({
@@ -14,12 +14,38 @@ import type {LogBoxLogData} from './LogBoxLog';
14
14
  import parseErrorStack from '../../Core/Devtools/parseErrorStack';
15
15
  import UTFSequence from '../../UTFSequence';
16
16
  import stringifySafe from '../../Utilities/stringifySafe';
17
+ import ansiRegex from 'ansi-regex';
18
+
19
+ const ANSI_REGEX = ansiRegex().source;
17
20
 
18
21
  const BABEL_TRANSFORM_ERROR_FORMAT =
19
22
  /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/;
23
+
24
+ // https://github.com/babel/babel/blob/33dbb85e9e9fe36915273080ecc42aee62ed0ade/packages/babel-code-frame/src/index.ts#L183-L184
25
+ const BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp(
26
+ [
27
+ // Beginning of a line (per 'm' flag)
28
+ '^',
29
+ // Optional ANSI escapes for colors
30
+ `(?:${ANSI_REGEX})*`,
31
+ // Marker
32
+ '>',
33
+ // Optional ANSI escapes for colors
34
+ `(?:${ANSI_REGEX})*`,
35
+ // Left padding for line number
36
+ ' +',
37
+ // Line number
38
+ '[0-9]+',
39
+ // Gutter
40
+ ' \\|',
41
+ ].join(''),
42
+ 'm',
43
+ );
44
+
20
45
  const BABEL_CODE_FRAME_ERROR_FORMAT =
21
46
  // eslint-disable-next-line no-control-regex
22
47
  /^(?:TransformError )?(?:.*):? (?:.*?)(\/.*): ([\s\S]+?)\n([ >]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u;
48
+
23
49
  const METRO_ERROR_FORMAT =
24
50
  /^(?:InternalError Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u;
25
51
 
@@ -241,27 +267,31 @@ export function parseLogBoxException(
241
267
  };
242
268
  }
243
269
 
244
- const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);
270
+ // Perform a cheap match first before trying to parse the full message, which
271
+ // can get expensive for arbitrary input.
272
+ if (BABEL_CODE_FRAME_MARKER_PATTERN.test(message)) {
273
+ const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);
245
274
 
246
- if (babelCodeFrameError) {
247
- // Codeframe errors are thrown from any use of buildCodeFrameError.
248
- const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);
249
- return {
250
- level: 'syntax',
251
- stack: [],
252
- isComponentError: false,
253
- componentStack: [],
254
- codeFrame: {
255
- fileName,
256
- location: null, // We are not given the location.
257
- content: codeFrame,
258
- },
259
- message: {
260
- content,
261
- substitutions: [],
262
- },
263
- category: `${fileName}-${1}-${1}`,
264
- };
275
+ if (babelCodeFrameError) {
276
+ // Codeframe errors are thrown from any use of buildCodeFrameError.
277
+ const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);
278
+ return {
279
+ level: 'syntax',
280
+ stack: [],
281
+ isComponentError: false,
282
+ componentStack: [],
283
+ codeFrame: {
284
+ fileName,
285
+ location: null, // We are not given the location.
286
+ content: codeFrame,
287
+ },
288
+ message: {
289
+ content,
290
+ substitutions: [],
291
+ },
292
+ category: `${fileName}-${1}-${1}`,
293
+ };
294
+ }
265
295
  }
266
296
 
267
297
  if (message.match(/^TransformError /)) {
@@ -10,6 +10,8 @@
10
10
 
11
11
  import typeof {enable} from 'promise/setimmediate/rejection-tracking';
12
12
 
13
+ import LogBox from './LogBox/LogBox';
14
+
13
15
  type ExtractOptionsType = <P>(((options?: ?P) => void)) => P;
14
16
 
15
17
  let rejectionTrackingOptions: $Call<ExtractOptionsType, enable> = {
@@ -36,17 +38,29 @@ let rejectionTrackingOptions: $Call<ExtractOptionsType, enable> = {
36
38
  }
37
39
  }
38
40
 
39
- const warning =
40
- `Possible Unhandled Promise Rejection (id: ${id}):\n` +
41
- `${message ?? ''}\n` +
42
- (stack == null ? '' : stack);
43
- console.warn(warning);
41
+ const warning = `Possible unhandled promise rejection (id: ${id}):\n${
42
+ message ?? ''
43
+ }`;
44
+ if (__DEV__) {
45
+ LogBox.addLog({
46
+ level: 'warn',
47
+ message: {
48
+ content: warning,
49
+ substitutions: [],
50
+ },
51
+ componentStack: [],
52
+ stack,
53
+ category: 'possible_unhandled_promise_rejection',
54
+ });
55
+ } else {
56
+ console.warn(warning);
57
+ }
44
58
  },
45
59
  onHandled: id => {
46
60
  const warning =
47
- `Promise Rejection Handled (id: ${id})\n` +
61
+ `Promise rejection handled (id: ${id})\n` +
48
62
  'This means you can ignore any previous messages of the form ' +
49
- `"Possible Unhandled Promise Rejection (id: ${id}):"`;
63
+ `"Possible unhandled promise rejection (id: ${id}):"`;
50
64
  console.warn(warning);
51
65
  },
52
66
  };
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(72),
26
- RCTVersionPatch: @(6),
26
+ RCTVersionPatch: @(8),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.72.6
1
+ VERSION_NAME=0.72.8
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -429,6 +429,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
429
429
  mEventDispatcher.unregisterEventEmitter(FABRIC);
430
430
 
431
431
  mReactApplicationContext.unregisterComponentCallbacks(mViewManagerRegistry);
432
+ mViewManagerRegistry.invalidate();
432
433
 
433
434
  // Remove lifecycle listeners (onHostResume, onHostPause) since the FabricUIManager is going
434
435
  // away. Then stop the mDispatchUIFrameCallback false will cause the choreographer
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 72,
20
- "patch", 6,
20
+ "patch", 8,
21
21
  "prerelease", null);
22
22
  }
@@ -25,6 +25,7 @@ import com.facebook.react.modules.blob.BlobModule;
25
25
  import com.facebook.react.modules.blob.FileReaderModule;
26
26
  import com.facebook.react.modules.camera.ImageStoreManager;
27
27
  import com.facebook.react.modules.clipboard.ClipboardModule;
28
+ import com.facebook.react.modules.devloading.DevLoadingModule;
28
29
  import com.facebook.react.modules.devtoolssettings.DevToolsSettingsManagerModule;
29
30
  import com.facebook.react.modules.dialog.DialogModule;
30
31
  import com.facebook.react.modules.fresco.FrescoModule;
@@ -72,6 +73,7 @@ import javax.inject.Provider;
72
73
  AppearanceModule.class,
73
74
  AppStateModule.class,
74
75
  BlobModule.class,
76
+ DevLoadingModule.class,
75
77
  FileReaderModule.class,
76
78
  ClipboardModule.class,
77
79
  DialogModule.class,
@@ -113,6 +115,8 @@ public class MainReactPackage extends TurboReactPackage implements ViewManagerOn
113
115
  return new AppStateModule(context);
114
116
  case BlobModule.NAME:
115
117
  return new BlobModule(context);
118
+ case DevLoadingModule.NAME:
119
+ return new DevLoadingModule(context);
116
120
  case FileReaderModule.NAME:
117
121
  return new FileReaderModule(context);
118
122
  case ClipboardModule.NAME:
@@ -371,6 +375,7 @@ public class MainReactPackage extends TurboReactPackage implements ViewManagerOn
371
375
  AppearanceModule.class,
372
376
  AppStateModule.class,
373
377
  BlobModule.class,
378
+ DevLoadingModule.class,
374
379
  FileReaderModule.class,
375
380
  ClipboardModule.class,
376
381
  DialogModule.class,
@@ -792,6 +792,7 @@ public class UIImplementation {
792
792
 
793
793
  public void onCatalystInstanceDestroyed() {
794
794
  mViewOperationsEnabled = false;
795
+ mViewManagers.invalidate();
795
796
  }
796
797
 
797
798
  public void setViewHierarchyUpdateDebugListener(
@@ -103,12 +103,28 @@ public final class ViewManagerRegistry implements ComponentCallbacks2 {
103
103
  viewManagers = new ArrayList<>(mViewManagers.values());
104
104
  }
105
105
  Runnable runnable =
106
- new Runnable() {
107
- @Override
108
- public void run() {
109
- for (ViewManager viewManager : viewManagers) {
110
- viewManager.onSurfaceStopped(surfaceId);
111
- }
106
+ () -> {
107
+ for (ViewManager viewManager : viewManagers) {
108
+ viewManager.onSurfaceStopped(surfaceId);
109
+ }
110
+ };
111
+ if (UiThreadUtil.isOnUiThread()) {
112
+ runnable.run();
113
+ } else {
114
+ UiThreadUtil.runOnUiThread(runnable);
115
+ }
116
+ }
117
+
118
+ /** Called on instance destroy */
119
+ public void invalidate() {
120
+ final List<ViewManager> viewManagers;
121
+ synchronized (this) {
122
+ viewManagers = new ArrayList<>(mViewManagers.values());
123
+ }
124
+ Runnable runnable =
125
+ () -> {
126
+ for (ViewManager viewManager : viewManagers) {
127
+ viewManager.invalidate();
112
128
  }
113
129
  };
114
130
  if (UiThreadUtil.isOnUiThread()) {
@@ -204,6 +204,11 @@ import java.util.Map;
204
204
  mDefaultValue = defaultValue;
205
205
  }
206
206
 
207
+ public ColorPropSetter(ReactPropGroup prop, Method setter, int index, int defaultValue) {
208
+ super(prop, "mixed", setter, index);
209
+ mDefaultValue = defaultValue;
210
+ }
211
+
207
212
  @Override
208
213
  protected Object getValueOrDefault(Object value, Context context) {
209
214
  if (value == null) {
@@ -331,6 +336,10 @@ import java.util.Map;
331
336
  super(prop, "mixed", setter);
332
337
  }
333
338
 
339
+ public BoxedColorPropSetter(ReactPropGroup prop, Method setter, int index) {
340
+ super(prop, "mixed", setter, index);
341
+ }
342
+
334
343
  @Override
335
344
  protected @Nullable Object getValueOrDefault(Object value, Context context) {
336
345
  if (value != null) {
@@ -463,7 +472,11 @@ import java.util.Map;
463
472
  }
464
473
  } else if (propTypeClass == int.class) {
465
474
  for (int i = 0; i < names.length; i++) {
466
- props.put(names[i], new IntPropSetter(annotation, method, i, annotation.defaultInt()));
475
+ if ("Color".equals(annotation.customType())) {
476
+ props.put(names[i], new ColorPropSetter(annotation, method, i, annotation.defaultInt()));
477
+ } else {
478
+ props.put(names[i], new IntPropSetter(annotation, method, i, annotation.defaultInt()));
479
+ }
467
480
  }
468
481
  } else if (propTypeClass == float.class) {
469
482
  for (int i = 0; i < names.length; i++) {
@@ -476,7 +489,11 @@ import java.util.Map;
476
489
  }
477
490
  } else if (propTypeClass == Integer.class) {
478
491
  for (int i = 0; i < names.length; i++) {
479
- props.put(names[i], new BoxedIntPropSetter(annotation, method, i));
492
+ if ("Color".equals(annotation.customType())) {
493
+ props.put(names[i], new BoxedColorPropSetter(annotation, method, i));
494
+ } else {
495
+ props.put(names[i], new BoxedIntPropSetter(annotation, method, i));
496
+ }
480
497
  }
481
498
  } else {
482
499
  throw new RuntimeException(
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 72;
20
- int32_t Patch = 6;
20
+ int32_t Patch = 8;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -74,19 +74,35 @@ static Class getViewManagerFromComponentName(const std::string &componentName)
74
74
  return nil;
75
75
  }
76
76
 
77
- static std::shared_ptr<void> const constructCoordinator(
78
- ContextContainer::Shared const &contextContainer,
79
- ComponentDescriptor::Flavor const &flavor)
77
+ static Class getViewManagerClass(const std::string &componentName, RCTBridge *bridge)
78
+ {
79
+ Class viewManager = getViewManagerFromComponentName(componentName);
80
+ if (viewManager != nil) {
81
+ return viewManager;
82
+ }
83
+
84
+ // If all the heuristics fail, let's try to retrieve the view manager from the bridge/bridgeProxy
85
+ if (bridge != nil) {
86
+ return [[bridge moduleForName:RCTNSStringFromString(componentName)] class];
87
+ }
88
+
89
+ return nil;
90
+ }
91
+
92
+ static const std::shared_ptr<void> constructCoordinator(
93
+ const ContextContainer::Shared &contextContainer,
94
+ const ComponentDescriptor::Flavor &flavor)
80
95
  {
81
- auto componentName = *std::static_pointer_cast<std::string const>(flavor);
82
- Class viewManagerClass = getViewManagerFromComponentName(componentName);
83
- assert(viewManagerClass);
84
96
  auto optionalBridge = contextContainer->find<std::shared_ptr<void>>("Bridge");
85
97
  RCTBridge *bridge;
86
98
  if (optionalBridge) {
87
99
  bridge = unwrapManagedObjectWeakly(optionalBridge.value());
88
100
  }
89
101
 
102
+ auto componentName = *std::static_pointer_cast<std::string const>(flavor);
103
+ Class viewManagerClass = getViewManagerClass(componentName, bridge);
104
+ assert(viewManagerClass);
105
+
90
106
  auto optionalEventDispatcher = contextContainer->find<std::shared_ptr<void>>("RCTEventDispatcher");
91
107
  RCTEventDispatcher *eventDispatcher;
92
108
  if (optionalEventDispatcher) {
@@ -92,6 +92,10 @@ using namespace facebook::react;
92
92
  if (props.isObject()) {
93
93
  NSDictionary<NSString *, id> *convertedProps = convertFollyDynamicToId(props);
94
94
  [_componentData setProps:convertedProps forView:view];
95
+
96
+ if ([view respondsToSelector:@selector(didSetProps:)]) {
97
+ [view performSelector:@selector(didSetProps:) withObject:[convertedProps allKeys]];
98
+ }
95
99
  }
96
100
  }
97
101
 
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @flow strict
3
+ * @format
4
+ */
5
+
6
+ declare module 'ansi-regex' {
7
+ declare export type Options = {
8
+ /**
9
+ * Match only the first ANSI escape.
10
+ */
11
+ +onlyFirst?: boolean,
12
+ };
13
+ declare export default function ansiRegex(options?: Options): RegExp;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.72.6",
3
+ "version": "0.72.8",
4
4
  "bin": "./cli.js",
5
5
  "description": "A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -79,11 +79,11 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@jest/create-cache-key-function": "^29.2.1",
82
- "@react-native-community/cli": "11.3.7",
83
- "@react-native-community/cli-platform-android": "11.3.7",
84
- "@react-native-community/cli-platform-ios": "11.3.7",
82
+ "@react-native-community/cli": "11.3.10",
83
+ "@react-native-community/cli-platform-android": "11.3.10",
84
+ "@react-native-community/cli-platform-ios": "11.3.10",
85
85
  "@react-native/assets-registry": "^0.72.0",
86
- "@react-native/codegen": "^0.72.7",
86
+ "@react-native/codegen": "^0.72.8",
87
87
  "@react-native/gradle-plugin": "^0.72.11",
88
88
  "@react-native/js-polyfills": "^0.72.1",
89
89
  "@react-native/normalize-colors": "^0.72.0",
@@ -91,7 +91,8 @@
91
91
  "abort-controller": "^3.0.0",
92
92
  "anser": "^1.4.9",
93
93
  "base64-js": "^1.1.2",
94
- "deprecated-react-native-prop-types": "4.1.0",
94
+ "deprecated-react-native-prop-types": "^4.2.3",
95
+ "ansi-regex": "^5.0.0",
95
96
  "event-target-shim": "^5.0.1",
96
97
  "flow-enums-runtime": "^0.0.5",
97
98
  "invariant": "^2.2.4",
@@ -68,7 +68,7 @@ class CodegenTests < Test::Unit::TestCase
68
68
  assert_equal(Pod::Executable.executed_commands.length, 0)
69
69
  end
70
70
 
71
- def testCheckAndGenerateEmptyThirdPartyProvider_whenHeaderMissingAndCodegenMissing_raiseError()
71
+ def testCheckAndGenerateEmptyThirdPartyProvider_whenHeaderMissingAndCodegenMissing_dontBuildCodegen()
72
72
 
73
73
  # Arrange
74
74
  FileMock.mocked_existing_files([
@@ -76,7 +76,7 @@ class CodegenTests < Test::Unit::TestCase
76
76
  ])
77
77
 
78
78
  # Act
79
- assert_raise {
79
+ assert_nothing_raised {
80
80
  checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock)
81
81
  }
82
82
 
@@ -84,16 +84,16 @@ class CodegenTests < Test::Unit::TestCase
84
84
  assert_equal(Pathname.pwd_invocation_count, 1)
85
85
  assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
86
86
  assert_equal(FileMock.exist_invocation_params, [
87
- @prefix + "/React/Fabric/" + @third_party_provider_header
87
+ @prefix + "/React/Fabric/" + @third_party_provider_header,
88
+ @prefix + "/React/Fabric/tmpSchemaList.txt",
88
89
  ])
89
90
  assert_equal(DirMock.exist_invocation_params, [
90
91
  @base_path + "/"+ @prefix + "/../react-native-codegen",
91
- @base_path + "/"+ @prefix + "/../@react-native/codegen",
92
92
  ])
93
- assert_equal(Pod::UI.collected_messages, [])
93
+ assert_equal(Pod::UI.collected_messages, ["[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider"])
94
94
  assert_equal($collected_commands, [])
95
- assert_equal(FileMock.open_files.length, 0)
96
- assert_equal(Pod::Executable.executed_commands.length, 0)
95
+ assert_equal(FileMock.open_files.length, 1)
96
+ assert_equal(Pod::Executable.executed_commands.length, 1)
97
97
  end
98
98
 
99
99
  def testCheckAndGenerateEmptyThirdPartyProvider_whenImplementationMissingAndCodegenrepoExists_dontBuildCodegen()
@@ -145,7 +145,7 @@ class CodegenTests < Test::Unit::TestCase
145
145
 
146
146
  def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen()
147
147
  # Arrange
148
- codegen_cli_path = @base_path + "/" + @prefix + "/../@react-native/codegen"
148
+ codegen_cli_path = @base_path + "/" + @prefix + "/../react-native-codegen"
149
149
  DirMock.mocked_existing_dirs([
150
150
  codegen_cli_path,
151
151
  ])
@@ -160,15 +160,14 @@ class CodegenTests < Test::Unit::TestCase
160
160
  @prefix + "/React/Fabric/" + @tmp_schema_list_file
161
161
  ])
162
162
  assert_equal(DirMock.exist_invocation_params, [
163
- @base_path + "/" + @prefix + "/../react-native-codegen",
164
163
  codegen_cli_path,
165
164
  codegen_cli_path + "/lib",
166
165
  ])
167
166
  assert_equal(Pod::UI.collected_messages, [
168
- "[Codegen] building #{codegen_cli_path}.",
167
+ "[Codegen] building #{codegen_cli_path}",
169
168
  "[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider"
170
169
  ])
171
- assert_equal($collected_commands, ["~/app/ios/../../../@react-native/codegen/scripts/oss/build.sh"])
170
+ assert_equal($collected_commands, ["~/app/ios/../../../react-native-codegen/scripts/oss/build.sh"])
172
171
  assert_equal(FileMock.open_files[0].collected_write, ["[]"])
173
172
  assert_equal(FileMock.open_files[0].fsync_invocation_count, 1)
174
173
  assert_equal(Pod::Executable.executed_commands[0], {
@@ -11,23 +11,12 @@
11
11
  # - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes.
12
12
  # @throws an error if it could not find the codegen folder.
13
13
  def build_codegen!(react_native_path, relative_installation_root, dir_manager: Dir)
14
- codegen_repo_path = "#{relative_installation_root}/#{react_native_path}/../react-native-codegen";
15
- codegen_npm_path = "#{relative_installation_root}/#{react_native_path}/../@react-native/codegen";
16
- codegen_cli_path = ""
14
+ codegen_repo_path = "#{relative_installation_root}/#{react_native_path}/../react-native-codegen";
15
+ return unless dir_manager.exist?(codegen_repo_path) && !dir_manager.exist?("#{codegen_repo_path}/lib")
17
16
 
18
- if dir_manager.exist?(codegen_repo_path)
19
- codegen_cli_path = codegen_repo_path
20
- elsif dir_manager.exist?(codegen_npm_path)
21
- codegen_cli_path = codegen_npm_path
22
- else
23
- raise "[codegen] Could not find react-native-codegen."
24
- end
25
-
26
- if !dir_manager.exist?("#{codegen_cli_path}/lib")
27
- Pod::UI.puts "[Codegen] building #{codegen_cli_path}."
28
- system("#{codegen_cli_path}/scripts/oss/build.sh")
29
- end
30
- end
17
+ Pod::UI.puts "[Codegen] building #{codegen_repo_path}"
18
+ system("#{codegen_repo_path}/scripts/oss/build.sh")
19
+ end
31
20
 
32
21
  # It generates an empty `ThirdPartyProvider`, required by Fabric to load the components
33
22
  #
@@ -11,6 +11,7 @@
11
11
 
12
12
  const yargs = require('yargs');
13
13
  const fs = require('fs');
14
+ const p = require('path');
14
15
 
15
16
  const CONFIG_FILE_NAME = 'react-native.config.js';
16
17
  const PROJECT_FIELD = 'project';
@@ -93,7 +94,11 @@ function extractComponentsNames(reactNativeConfig) {
93
94
  }
94
95
 
95
96
  function generateRCTLegacyInteropComponents() {
96
- const configFilePath = `${appRoot}/${CONFIG_FILE_NAME}`;
97
+ const cwd = process.cwd();
98
+ const configFilePath = p.join(cwd, appRoot, CONFIG_FILE_NAME);
99
+ console.log(
100
+ `Looking for a react-native.config.js file at ${configFilePath}...`,
101
+ );
97
102
  let reactNativeConfig = null;
98
103
  try {
99
104
  reactNativeConfig = require(configFilePath);
@@ -107,7 +112,7 @@ function generateRCTLegacyInteropComponents() {
107
112
  console.log('Skip LegacyInterop generation');
108
113
  return;
109
114
  }
110
-
115
+ console.log(`Components found: ${componentNames}`);
111
116
  let componentsArray = componentNames.map(name => `\t\t\t@"${name}",`);
112
117
  // Remove the last comma
113
118
  if (componentsArray.length > 0) {
@@ -118,6 +123,7 @@ function generateRCTLegacyInteropComponents() {
118
123
 
119
124
  const filePath = `${outputPath}/${OUTPUT_FILE_NAME}`;
120
125
  fs.writeFileSync(filePath, fileBody(componentsArray.join('\n')));
126
+ console.log(`${filePath} updated!`);
121
127
  }
122
128
 
123
129
  generateRCTLegacyInteropComponents();
Binary file
Binary file
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.72.6"
14
+ "react-native": "0.72.8"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.20.0",