react-native 0.72.0-rc.1 → 0.72.0-rc.3

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 (51) hide show
  1. package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -8
  4. package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -8
  5. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +0 -7
  6. package/Libraries/StyleSheet/StyleSheetTypes.js +0 -74
  7. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +3 -3
  8. package/React/Base/RCTVersion.m +1 -1
  9. package/React/CoreModules/RCTDevMenu.mm +3 -3
  10. package/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +12 -1
  11. package/React/Fabric/RCTSurfacePresenter.mm +4 -0
  12. package/ReactAndroid/gradle.properties +1 -1
  13. package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +10 -0
  14. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +29 -0
  15. package/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java +25 -2
  16. package/ReactAndroid/src/main/java/com/facebook/react/bridge/interop/InteropModuleRegistry.java +56 -0
  17. package/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +8 -0
  18. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +1 -0
  19. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +26 -8
  20. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +21 -0
  21. package/ReactAndroid/src/main/java/com/facebook/react/fabric/interop/InteropEvent.java +41 -0
  22. package/ReactAndroid/src/main/java/com/facebook/react/fabric/interop/InteropEventEmitter.java +65 -0
  23. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java +9 -0
  24. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  25. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java +1 -0
  26. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java +32 -0
  27. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.java +19 -0
  28. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  29. package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +0 -21
  30. package/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +0 -49
  31. package/ReactCommon/react/renderer/components/view/YogaStylableProps.h +0 -9
  32. package/ReactCommon/react/renderer/core/CoreFeatures.cpp +1 -0
  33. package/ReactCommon/react/renderer/core/CoreFeatures.h +4 -0
  34. package/ReactCommon/react/renderer/imagemanager/ImageRequest.h +7 -3
  35. package/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp +0 -11
  36. package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequest.cpp +4 -14
  37. package/package.json +9 -9
  38. package/scripts/cocoapods/__tests__/flipper-test.rb +9 -1
  39. package/scripts/cocoapods/__tests__/jsengine-test.rb +6 -2
  40. package/scripts/cocoapods/__tests__/test_utils/podSpy.rb +2 -1
  41. package/scripts/cocoapods/__tests__/utils-test.rb +0 -68
  42. package/scripts/cocoapods/flipper.rb +2 -2
  43. package/scripts/cocoapods/jsengine.rb +6 -1
  44. package/scripts/cocoapods/utils.rb +0 -7
  45. package/scripts/react_native_pods.rb +3 -6
  46. package/sdks/hermesc/linux64-bin/hermesc +0 -0
  47. package/sdks/hermesc/osx-bin/hermesc +0 -0
  48. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  49. package/template/android/app/build.gradle +7 -2
  50. package/template/package.json +5 -5
  51. package/types/index.d.ts +4 -0
@@ -193,6 +193,8 @@ public class MountItemDispatcher {
193
193
  return false;
194
194
  }
195
195
 
196
+ mItemDispatchListener.willMountItems();
197
+
196
198
  // As an optimization, execute all ViewCommands first
197
199
  // This should be:
198
200
  // 1) Performant: ViewCommands are often a replacement for SetNativeProps, which we've always
@@ -299,6 +301,9 @@ public class MountItemDispatcher {
299
301
  }
300
302
  mBatchedExecutionTime += SystemClock.uptimeMillis() - batchedExecutionStartTime;
301
303
  }
304
+
305
+ mItemDispatchListener.didMountItems();
306
+
302
307
  Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
303
308
 
304
309
  return true;
@@ -415,6 +420,10 @@ public class MountItemDispatcher {
415
420
  }
416
421
 
417
422
  public interface ItemDispatchListener {
423
+ void willMountItems();
424
+
425
+ void didMountItems();
426
+
418
427
  void didDispatchMountItems();
419
428
  }
420
429
  }
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 72,
20
20
  "patch", 0,
21
- "prerelease", "rc.1");
21
+ "prerelease", "rc.3");
22
22
  }
@@ -50,6 +50,7 @@ public class ThemedReactContext extends ReactContext {
50
50
  if (reactApplicationContext.hasCatalystInstance()) {
51
51
  initializeWithInstance(reactApplicationContext.getCatalystInstance());
52
52
  }
53
+ initializeInteropModules(reactApplicationContext);
53
54
  mReactApplicationContext = reactApplicationContext;
54
55
  mModuleName = moduleName;
55
56
  mSurfaceId = surfaceId;
@@ -10,11 +10,15 @@ package com.facebook.react.uimanager;
10
10
  import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
11
11
 
12
12
  import androidx.annotation.Nullable;
13
+ import androidx.annotation.VisibleForTesting;
13
14
  import com.facebook.react.common.MapBuilder;
15
+ import com.facebook.react.config.ReactFeatureFlags;
14
16
  import com.facebook.systrace.SystraceMessage;
15
17
  import java.util.ArrayList;
18
+ import java.util.HashSet;
16
19
  import java.util.List;
17
20
  import java.util.Map;
21
+ import java.util.Set;
18
22
 
19
23
  /**
20
24
  * Helps generate constants map for {@link UIManagerModule} by collecting and merging constants from
@@ -113,6 +117,13 @@ import java.util.Map;
113
117
 
114
118
  Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
115
119
  if (viewManagerBubblingEvents != null) {
120
+
121
+ if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
122
+ // For Fabric, events needs to be fired with a "top" prefix.
123
+ // For the sake of Fabric Interop, here we normalize events adding "top" in their
124
+ // name if the user hasn't provided it.
125
+ normalizeEventTypes(viewManagerBubblingEvents);
126
+ }
116
127
  recursiveMerge(cumulativeBubblingEventTypes, viewManagerBubblingEvents);
117
128
  recursiveMerge(viewManagerBubblingEvents, defaultBubblingEvents);
118
129
  viewManagerConstants.put(BUBBLING_EVENTS_KEY, viewManagerBubblingEvents);
@@ -145,6 +156,27 @@ import java.util.Map;
145
156
  return viewManagerConstants;
146
157
  }
147
158
 
159
+ @VisibleForTesting
160
+ /* package */ static void normalizeEventTypes(Map events) {
161
+ if (events == null) {
162
+ return;
163
+ }
164
+ Set<String> keysToNormalize = new HashSet<>();
165
+ for (Object key : events.keySet()) {
166
+ if (key instanceof String) {
167
+ String keyString = (String) key;
168
+ if (!keyString.startsWith("top")) {
169
+ keysToNormalize.add(keyString);
170
+ }
171
+ }
172
+ }
173
+ for (String oldKey : keysToNormalize) {
174
+ Object value = events.get(oldKey);
175
+ String newKey = "top" + oldKey.substring(0, 1).toUpperCase() + oldKey.substring(1);
176
+ events.put(newKey, value);
177
+ }
178
+ }
179
+
148
180
  /** Merges {@param source} map into {@param dest} map recursively */
149
181
  private static void recursiveMerge(@Nullable Map dest, @Nullable Map source) {
150
182
  if (dest == null || source == null || source.isEmpty()) {
@@ -18,6 +18,7 @@ import com.facebook.react.bridge.UIManager;
18
18
  import com.facebook.react.bridge.UIManagerListener;
19
19
  import com.facebook.react.bridge.UiThreadUtil;
20
20
  import com.facebook.react.uimanager.UIManagerHelper;
21
+ import com.facebook.react.uimanager.common.UIManagerType;
21
22
  import com.facebook.react.uimanager.common.ViewUtil;
22
23
  import com.facebook.react.views.scroll.ReactScrollViewHelper.HasSmoothScroll;
23
24
  import com.facebook.react.views.view.ReactViewGroup;
@@ -89,6 +90,14 @@ public class MaintainVisibleScrollPositionHelper<ScrollViewT extends ViewGroup &
89
90
  * been updated.
90
91
  */
91
92
  public void updateScrollPosition() {
93
+ // On Fabric this will be called internally in `didMountItems`.
94
+ if (ViewUtil.getUIManagerType(mScrollView.getId()) == UIManagerType.FABRIC) {
95
+ return;
96
+ }
97
+ updateScrollPositionInternal();
98
+ }
99
+
100
+ private void updateScrollPositionInternal() {
92
101
  if (mConfig == null || mFirstVisibleView == null || mPrevFirstVisibleFrame == null) {
93
102
  return;
94
103
  }
@@ -169,6 +178,16 @@ public class MaintainVisibleScrollPositionHelper<ScrollViewT extends ViewGroup &
169
178
  });
170
179
  }
171
180
 
181
+ @Override
182
+ public void willMountItems(UIManager uiManager) {
183
+ computeTargetView();
184
+ }
185
+
186
+ @Override
187
+ public void didMountItems(UIManager uiManager) {
188
+ updateScrollPositionInternal();
189
+ }
190
+
172
191
  @Override
173
192
  public void didDispatchMountItems(UIManager uiManager) {
174
193
  // noop
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 72;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.1";
21
+ std::string_view Prerelease = "rc.3";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -369,21 +369,6 @@ void YogaLayoutableShadowNode::updateYogaProps() {
369
369
  YGStyle result{baseStyle};
370
370
 
371
371
  // Aliases with precedence
372
- if (!props.inset.isUndefined()) {
373
- result.position()[YGEdgeAll] = props.inset;
374
- }
375
- if (!props.insetBlock.isUndefined()) {
376
- result.position()[YGEdgeVertical] = props.insetBlock;
377
- }
378
- if (!props.insetInline.isUndefined()) {
379
- result.position()[YGEdgeHorizontal] = props.insetInline;
380
- }
381
- if (!props.insetInlineEnd.isUndefined()) {
382
- result.position()[YGEdgeEnd] = props.insetInlineEnd;
383
- }
384
- if (!props.insetInlineStart.isUndefined()) {
385
- result.position()[YGEdgeStart] = props.insetInlineStart;
386
- }
387
372
  if (!props.marginInline.isUndefined()) {
388
373
  result.margin()[YGEdgeHorizontal] = props.marginInline;
389
374
  }
@@ -410,12 +395,6 @@ void YogaLayoutableShadowNode::updateYogaProps() {
410
395
  }
411
396
 
412
397
  // Aliases without precedence
413
- if (CompactValue(result.position()[YGEdgeBottom]).isUndefined()) {
414
- result.position()[YGEdgeBottom] = props.insetBlockEnd;
415
- }
416
- if (CompactValue(result.position()[YGEdgeTop]).isUndefined()) {
417
- result.position()[YGEdgeTop] = props.insetBlockStart;
418
- }
419
398
  if (CompactValue(result.margin()[YGEdgeTop]).isUndefined()) {
420
399
  result.margin()[YGEdgeTop] = props.marginBlockStart;
421
400
  }
@@ -136,13 +136,6 @@ void YogaStylableProps::setProp(
136
136
  static const auto defaults = YogaStylableProps{};
137
137
 
138
138
  // Aliases
139
- RAW_SET_PROP_SWITCH_CASE(inset, "inset");
140
- RAW_SET_PROP_SWITCH_CASE(insetBlock, "insetBlock");
141
- RAW_SET_PROP_SWITCH_CASE(insetBlockEnd, "insetBlockEnd");
142
- RAW_SET_PROP_SWITCH_CASE(insetBlockStart, "insetBlockStart");
143
- RAW_SET_PROP_SWITCH_CASE(insetInline, "insetInline");
144
- RAW_SET_PROP_SWITCH_CASE(insetInlineEnd, "insetInlineEnd");
145
- RAW_SET_PROP_SWITCH_CASE(insetInlineStart, "insetInlineStart");
146
139
  RAW_SET_PROP_SWITCH_CASE(marginInline, "marginInline");
147
140
  RAW_SET_PROP_SWITCH_CASE(marginInlineStart, "marginInlineStart");
148
141
  RAW_SET_PROP_SWITCH_CASE(marginInlineEnd, "marginInlineEnd");
@@ -242,48 +235,6 @@ void YogaStylableProps::convertRawPropAliases(
242
235
  const PropsParserContext &context,
243
236
  YogaStylableProps const &sourceProps,
244
237
  RawProps const &rawProps) {
245
- inset = convertRawProp(
246
- context,
247
- rawProps,
248
- "inset",
249
- sourceProps.inset,
250
- CompactValue::ofUndefined());
251
- insetBlock = convertRawProp(
252
- context,
253
- rawProps,
254
- "insetBlock",
255
- sourceProps.insetBlock,
256
- CompactValue::ofUndefined());
257
- insetBlockEnd = convertRawProp(
258
- context,
259
- rawProps,
260
- "insetBlockEnd",
261
- sourceProps.insetBlockEnd,
262
- CompactValue::ofUndefined());
263
- insetBlockStart = convertRawProp(
264
- context,
265
- rawProps,
266
- "insetBlockStart",
267
- sourceProps.insetBlockStart,
268
- CompactValue::ofUndefined());
269
- insetInline = convertRawProp(
270
- context,
271
- rawProps,
272
- "insetInline",
273
- sourceProps.insetInline,
274
- CompactValue::ofUndefined());
275
- insetInlineEnd = convertRawProp(
276
- context,
277
- rawProps,
278
- "insetInlineEnd",
279
- sourceProps.insetInlineEnd,
280
- CompactValue::ofUndefined());
281
- insetInlineStart = convertRawProp(
282
- context,
283
- rawProps,
284
- "insetInlineStart",
285
- sourceProps.insetInlineStart,
286
- CompactValue::ofUndefined());
287
238
  marginInline = convertRawProp(
288
239
  context,
289
240
  rawProps,
@@ -43,11 +43,6 @@ class YogaStylableProps : public Props {
43
43
 
44
44
  // Duplicates of existing properties with different names, taking
45
45
  // precedence. E.g. "marginBlock" instead of "marginVertical"
46
- CompactValue inset;
47
- CompactValue insetInline;
48
- CompactValue insetInlineEnd;
49
- CompactValue insetInlineStart;
50
-
51
46
  CompactValue marginInline;
52
47
  CompactValue marginInlineStart;
53
48
  CompactValue marginInlineEnd;
@@ -61,10 +56,6 @@ class YogaStylableProps : public Props {
61
56
  // BlockEnd/BlockStart map to top/bottom (no writing mode), but we preserve
62
57
  // Yoga's precedence and prefer specific edges (e.g. top) to ones which are
63
58
  // flow relative (e.g. blockStart).
64
- CompactValue insetBlock;
65
- CompactValue insetBlockEnd;
66
- CompactValue insetBlockStart;
67
-
68
59
  CompactValue marginBlockStart;
69
60
  CompactValue marginBlockEnd;
70
61
 
@@ -16,6 +16,7 @@ bool CoreFeatures::blockPaintForUseLayoutEffect = false;
16
16
  bool CoreFeatures::useNativeState = false;
17
17
  bool CoreFeatures::cacheNSTextStorage = false;
18
18
  bool CoreFeatures::cacheLastTextMeasurement = false;
19
+ bool CoreFeatures::cancelImageDownloadsOnRecycle = false;
19
20
 
20
21
  } // namespace react
21
22
  } // namespace facebook
@@ -44,6 +44,10 @@ class CoreFeatures {
44
44
  // This flag enables a caching mechanism to avoid subsequents measurements
45
45
  // of the same Text with the same constrainst.
46
46
  static bool cacheLastTextMeasurement;
47
+
48
+ // Fabric was not cancelling image downloads when <ImageView /> was removed
49
+ // from view hierarchy. This feature flag enables this feature.
50
+ static bool cancelImageDownloadsOnRecycle;
47
51
  };
48
52
 
49
53
  } // namespace react
@@ -35,20 +35,24 @@ class ImageRequest final {
35
35
  /*
36
36
  * The move constructor.
37
37
  */
38
- ImageRequest(ImageRequest &&other) noexcept;
38
+ ImageRequest(ImageRequest &&other) noexcept = default;
39
39
 
40
40
  /*
41
41
  * `ImageRequest` does not support copying by design.
42
42
  */
43
43
  ImageRequest(const ImageRequest &other) = delete;
44
44
 
45
- ~ImageRequest();
46
-
47
45
  /**
48
46
  * Set cancelation function.
49
47
  */
50
48
  void setCancelationFunction(std::function<void(void)> cancelationFunction);
51
49
 
50
+ /*
51
+ * Calls cancel function if one is defined. Should be when downloading
52
+ * image isn't needed anymore. E.g. <ImageView /> was removed.
53
+ */
54
+ void cancel() const;
55
+
52
56
  /*
53
57
  * Returns the Image Source associated with the request.
54
58
  */
@@ -18,17 +18,6 @@ ImageRequest::ImageRequest(
18
18
  // Not implemented.
19
19
  }
20
20
 
21
- ImageRequest::ImageRequest(ImageRequest &&other) noexcept
22
- : imageSource_(std::move(other.imageSource_)),
23
- telemetry_(std::move(other.telemetry_)),
24
- coordinator_(std::move(other.coordinator_)) {
25
- // Not implemented.
26
- }
27
-
28
- ImageRequest::~ImageRequest() {
29
- // Not implemented.
30
- }
31
-
32
21
  const ImageResponseObserverCoordinator &ImageRequest::getObserverCoordinator()
33
22
  const {
34
23
  // Not implemented
@@ -17,27 +17,17 @@ ImageRequest::ImageRequest(
17
17
  coordinator_ = std::make_shared<ImageResponseObserverCoordinator>();
18
18
  }
19
19
 
20
- ImageRequest::ImageRequest(ImageRequest &&other) noexcept
21
- : imageSource_(std::move(other.imageSource_)),
22
- telemetry_(std::move(other.telemetry_)),
23
- coordinator_(std::move(other.coordinator_)) {
24
- other.coordinator_ = nullptr;
25
- other.cancelRequest_ = nullptr;
26
- other.telemetry_ = nullptr;
27
- other.imageSource_ = {};
20
+ void ImageRequest::setCancelationFunction(
21
+ std::function<void(void)> cancelationFunction) {
22
+ cancelRequest_ = cancelationFunction;
28
23
  }
29
24
 
30
- ImageRequest::~ImageRequest() {
25
+ void ImageRequest::cancel() const {
31
26
  if (cancelRequest_) {
32
27
  cancelRequest_();
33
28
  }
34
29
  }
35
30
 
36
- void ImageRequest::setCancelationFunction(
37
- std::function<void(void)> cancelationFunction) {
38
- cancelRequest_ = cancelationFunction;
39
- }
40
-
41
31
  const ImageSource &ImageRequest::getImageSource() const {
42
32
  return imageSource_;
43
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.72.0-rc.1",
3
+ "version": "0.72.0-rc.3",
4
4
  "bin": "./cli.js",
5
5
  "description": "A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -79,27 +79,27 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@jest/create-cache-key-function": "^29.2.1",
82
- "@react-native-community/cli": "11.1.1",
83
- "@react-native-community/cli-platform-android": "11.1.1",
84
- "@react-native-community/cli-platform-ios": "11.1.1",
82
+ "@react-native-community/cli": "11.2.3",
83
+ "@react-native-community/cli-platform-android": "11.2.3",
84
+ "@react-native-community/cli-platform-ios": "11.2.3",
85
85
  "@react-native/assets-registry": "^0.72.0",
86
86
  "@react-native/codegen": "^0.72.4",
87
- "@react-native/gradle-plugin": "^0.72.6",
87
+ "@react-native/gradle-plugin": "^0.72.7",
88
88
  "@react-native/js-polyfills": "^0.72.1",
89
89
  "@react-native/normalize-colors": "^0.72.0",
90
90
  "@react-native/virtualized-lists": "^0.72.4",
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.0.0",
94
+ "deprecated-react-native-prop-types": "4.1.0",
95
95
  "event-target-shim": "^5.0.1",
96
96
  "flow-enums-runtime": "^0.0.5",
97
97
  "invariant": "^2.2.4",
98
98
  "jest-environment-node": "^29.2.1",
99
99
  "jsc-android": "^250231.0.0",
100
100
  "memoize-one": "^5.0.0",
101
- "metro-runtime": "0.76.0",
102
- "metro-source-map": "0.76.0",
101
+ "metro-runtime": "0.76.4",
102
+ "metro-source-map": "0.76.4",
103
103
  "mkdirp": "^0.5.1",
104
104
  "nullthrows": "^1.1.1",
105
105
  "pretty-format": "^26.5.2",
@@ -108,7 +108,7 @@
108
108
  "react-refresh": "^0.4.0",
109
109
  "react-shallow-renderer": "^16.15.0",
110
110
  "regenerator-runtime": "^0.13.2",
111
- "scheduler": "^0.23.0",
111
+ "scheduler": "0.24.0-canary-efb381bbf-20230505",
112
112
  "stacktrace-parser": "^0.1.10",
113
113
  "use-sync-external-store": "^1.0.0",
114
114
  "whatwg-fetch": "^3.0.0",
@@ -82,7 +82,7 @@ class FlipperTests < Test::Unit::TestCase
82
82
  assert_equal(config.build_settings['SWIFT_VERSION'], '4.1')
83
83
  end
84
84
 
85
- reactCore_target = installer.target_with_name("React-Core")
85
+ reactCore_target = installer.target_with_name("React-RCTAppDelegate")
86
86
  reactCore_target.build_configurations.each do |config|
87
87
  if config.name == 'Debug' || config.name == 'CustomConfig' then
88
88
  assert_equal(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'], ['$(inherited)', 'FB_SONARKIT_ENABLED=1'])
@@ -144,6 +144,14 @@ class FlipperTests < Test::Unit::TestCase
144
144
  BuildConfigurationMock.new("Release", is_debug: false),
145
145
  BuildConfigurationMock.new("CustomConfig", is_debug: true),
146
146
  ]
147
+ ),
148
+ TargetMock.new(
149
+ "React-RCTAppDelegate",
150
+ [
151
+ BuildConfigurationMock.new("Debug", is_debug: true),
152
+ BuildConfigurationMock.new("Release", is_debug: false),
153
+ BuildConfigurationMock.new("CustomConfig", is_debug: true),
154
+ ]
147
155
  )
148
156
  ]
149
157
  )
@@ -105,7 +105,9 @@ class JSEngineTests < Test::Unit::TestCase
105
105
  assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
106
106
  assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
107
107
  assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
108
- assert_equal($podInvocation["hermes-engine"][:podspec], "../../sdks/hermes/hermes-engine.podspec")
108
+ hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
109
+ assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
110
+ assert_equal(hermes_engine_pod_invocation[:tag], "")
109
111
  end
110
112
 
111
113
  def test_setupHermes_installsPods_installsFabricSubspecWhenFabricEnabled
@@ -118,7 +120,9 @@ class JSEngineTests < Test::Unit::TestCase
118
120
  # Assert
119
121
  assert_equal($podInvocationCount, 4)
120
122
  assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
121
- assert_equal($podInvocation["hermes-engine"][:podspec], "../../sdks/hermes/hermes-engine.podspec")
123
+ hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
124
+ assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
125
+ assert_equal(hermes_engine_pod_invocation[:tag], "")
122
126
  assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
123
127
  assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
124
128
  end
@@ -26,7 +26,7 @@ def podSpy_cleanUp
26
26
  $podInvocationCount = 0
27
27
  end
28
28
 
29
- def pod(name, version = nil, path: nil, configurations: nil, modular_headers: nil, podspec: nil)
29
+ def pod(name, version = nil, path: nil, configurations: nil, modular_headers: nil, podspec: nil, tag: nil)
30
30
  $podInvocationCount += 1
31
31
  params = {}
32
32
  if version != nil then params[:version] = version end
@@ -34,5 +34,6 @@ def pod(name, version = nil, path: nil, configurations: nil, modular_headers: ni
34
34
  if configurations != nil then params[:configurations] = configurations end
35
35
  if modular_headers != nil then params[:modular_headers] = modular_headers end
36
36
  if podspec != nil then params[:podspec] = podspec end
37
+ if tag != nil then params[:tag] = tag end
37
38
  $podInvocation[name] = params
38
39
  end
@@ -677,74 +677,6 @@ class UtilsTests < Test::Unit::TestCase
677
677
  assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited)")
678
678
  end
679
679
  end
680
-
681
- # ============================= #
682
- # Test - Enable Hermes Profiler #
683
- # ============================= #
684
-
685
- def test_enableHermesProfiler_whenEnableHermesProfileIsTrue_setsFlagsInRelease
686
- # Arrange
687
- first_target = prepare_target("FirstTarget")
688
- second_target = prepare_target("SecondTarget")
689
- third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
690
- user_project_mock = UserProjectMock.new("a/path", [
691
- prepare_config("Debug"),
692
- prepare_config("Release"),
693
- ],
694
- :native_targets => [
695
- first_target,
696
- second_target
697
- ]
698
- )
699
- pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
700
- installer = InstallerMock.new(pods_projects_mock, [
701
- AggregatedProjectMock.new(user_project_mock)
702
- ])
703
-
704
- # Act
705
- ReactNativePodsUtils.enable_hermes_profiler(installer, enable_hermes_profiler: true)
706
-
707
- # Assert
708
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
709
- target_installation_result.native_target.build_configurations.each do |config|
710
- if config.name != "Release"
711
- assert_nil(config.build_settings["OTHER_CFLAGS"])
712
- else
713
- assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited) -DRCT_REMOTE_PROFILE=1")
714
- end
715
- end
716
- end
717
- end
718
-
719
- def test_enableHermesProfiler_whenEnableHermesProfileIsFalse_doesNothing
720
- # Arrange
721
- first_target = prepare_target("FirstTarget")
722
- second_target = prepare_target("SecondTarget")
723
- third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
724
- user_project_mock = UserProjectMock.new("a/path", [
725
- prepare_config("Debug"),
726
- prepare_config("Release"),
727
- ],
728
- :native_targets => [
729
- first_target,
730
- second_target
731
- ]
732
- )
733
- pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
734
- installer = InstallerMock.new(pods_projects_mock, [
735
- AggregatedProjectMock.new(user_project_mock)
736
- ])
737
-
738
- # Act
739
- ReactNativePodsUtils.enable_hermes_profiler(installer)
740
-
741
- # Assert
742
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
743
- target_installation_result.native_target.build_configurations.each do |config|
744
- assert_nil(config.build_settings["OTHER_CFLAGS"])
745
- end
746
- end
747
- end
748
680
  end
749
681
 
750
682
  # ===== #
@@ -77,8 +77,8 @@ def flipper_post_install(installer)
77
77
  end
78
78
  end
79
79
 
80
- # Enable flipper for React-Core Debug configuration
81
- if target.name == 'React-Core'
80
+ # Enable flipper for React-RCTAppDelegate Debug configuration
81
+ if target.name == 'React-RCTAppDelegate'
82
82
  target.build_configurations.each do |config|
83
83
  if config.debug?
84
84
  config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'FB_SONARKIT_ENABLED=1']
@@ -30,7 +30,12 @@ def setup_hermes!(react_native_path: "../node_modules/react-native", fabric_enab
30
30
  abort unless prep_status == 0
31
31
 
32
32
  pod 'React-jsi', :path => "#{react_native_path}/ReactCommon/jsi"
33
- pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes/hermes-engine.podspec"
33
+ # This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes.
34
+ # We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/*
35
+ hermestag_file = File.join(react_native_path, "sdks", ".hermesversion")
36
+ hermestag = File.exist?(hermestag_file) ? File.read(hermestag_file).strip : ''
37
+
38
+ pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag
34
39
  pod 'React-hermes', :path => "#{react_native_path}/ReactCommon/hermes"
35
40
  pod 'libevent', '~> 2.1.12'
36
41
  end
@@ -220,13 +220,6 @@ class ReactNativePodsUtils
220
220
  end
221
221
  end
222
222
 
223
- def self.enable_hermes_profiler(installer, enable_hermes_profiler: false)
224
- return if !enable_hermes_profiler
225
-
226
- Pod::UI.puts "[Hermes Profiler] Enable Hermes Sample profiler"
227
- self.add_compiler_flag_to_pods(installer, "-DRCT_REMOTE_PROFILE=1", configuration: "Release")
228
- end
229
-
230
223
  # ========= #
231
224
  # Utilities #
232
225
  # ========= #
@@ -222,11 +222,10 @@ end
222
222
  # - mac_catalyst_enabled: whether we are running the Pod on a Mac Catalyst project or not.
223
223
  # - enable_hermes_profiler: whether the hermes profiler should be turned on in Release mode
224
224
  def react_native_post_install(
225
- installer, react_native_path = "../node_modules/react-native",
226
- mac_catalyst_enabled: false,
227
- enable_hermes_profiler: false
225
+ installer,
226
+ react_native_path = "../node_modules/react-native",
227
+ mac_catalyst_enabled: false
228
228
  )
229
- enable_hermes_profiler = enable_hermes_profiler || ENV["ENABLE_HERMES_PROFILER"] == "1"
230
229
  ReactNativePodsUtils.turn_off_resource_bundle_react_core(installer)
231
230
 
232
231
  ReactNativePodsUtils.apply_mac_catalyst_patches(installer) if mac_catalyst_enabled
@@ -242,13 +241,11 @@ def react_native_post_install(
242
241
  ReactNativePodsUtils.update_search_paths(installer)
243
242
  ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
244
243
  ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
245
- ReactNativePodsUtils.enable_hermes_profiler(installer, enable_hermes_profiler: enable_hermes_profiler)
246
244
 
247
245
  NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
248
246
  is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"
249
247
  NewArchitectureHelper.modify_flags_for_new_architecture(installer, is_new_arch_enabled)
250
248
 
251
-
252
249
  Pod::UI.puts "Pod install took #{Time.now.to_i - $START_TIME} [s] to run".green
253
250
  end
254
251
 
Binary file
Binary file
Binary file