react-native 0.74.0-rc.3 → 0.74.0-rc.5

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 (44) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Libraries/Core/registerCallableModule.d.ts +16 -0
  3. package/React/Base/RCTBridgeProxy+Cxx.h +20 -0
  4. package/React/Base/RCTBridgeProxy.h +2 -0
  5. package/React/Base/RCTBridgeProxy.mm +15 -0
  6. package/React/Base/RCTVersion.m +1 -1
  7. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +7 -0
  8. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +17 -2
  9. package/ReactAndroid/api/ReactAndroid.api +57 -1
  10. package/ReactAndroid/build.gradle.kts +18 -6
  11. package/ReactAndroid/gradle.properties +1 -1
  12. package/ReactAndroid/hermes-engine/build.gradle.kts +2 -0
  13. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +4 -0
  14. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +9 -35
  15. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +101 -15
  16. package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
  17. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +1 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +2 -1
  19. package/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java +2 -2
  20. package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java +1 -1
  21. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +2 -1
  22. package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/InteropUiBlockListener.kt +8 -2
  23. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  24. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +201 -0
  25. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java +4 -6
  26. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +79 -0
  27. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +1 -1
  28. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +17 -1
  29. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
  30. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +2 -0
  31. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  32. package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h +2 -2
  33. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +8 -6
  34. package/ReactCommon/yoga/yoga/algorithm/AbsoluteLayout.cpp +64 -40
  35. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +19 -20
  36. package/package.json +11 -11
  37. package/scripts/cocoapods/helpers.rb +4 -0
  38. package/scripts/cocoapods/utils.rb +26 -6
  39. package/scripts/react_native_pods.rb +2 -0
  40. package/sdks/hermesc/osx-bin/hermes +0 -0
  41. package/sdks/hermesc/osx-bin/hermesc +0 -0
  42. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  43. package/template/package.json +5 -5
  44. package/types/index.d.ts +1 -0
@@ -480,14 +480,10 @@ void layoutAbsoluteDescendants(
480
480
  LayoutData& layoutMarkerData,
481
481
  uint32_t currentDepth,
482
482
  uint32_t generationCount,
483
- float currentNodeMainOffsetFromContainingBlock,
484
- float currentNodeCrossOffsetFromContainingBlock,
483
+ float currentNodeLeftOffsetFromContainingBlock,
484
+ float currentNodeTopOffsetFromContainingBlock,
485
485
  float containingNodeAvailableInnerWidth,
486
486
  float containingNodeAvailableInnerHeight) {
487
- const FlexDirection mainAxis = resolveDirection(
488
- currentNode->style().flexDirection(), currentNodeDirection);
489
- const FlexDirection crossAxis =
490
- resolveCrossDirection(mainAxis, currentNodeDirection);
491
487
  for (auto child : currentNode->getChildren()) {
492
488
  if (child->style().display() == Display::None) {
493
489
  continue;
@@ -516,45 +512,73 @@ void layoutAbsoluteDescendants(
516
512
  currentDepth,
517
513
  generationCount);
518
514
 
519
- const bool isMainAxisRow = isRow(mainAxis);
520
- const bool mainInsetsDefined = isMainAxisRow
521
- ? child->style().horizontalInsetsDefined()
522
- : child->style().verticalInsetsDefined();
523
- const bool crossInsetsDefined = isMainAxisRow
524
- ? child->style().verticalInsetsDefined()
525
- : child->style().horizontalInsetsDefined();
526
-
527
- const float childMainOffsetFromParent = mainInsetsDefined
528
- ? (child->getLayout().position(flexStartEdge(mainAxis)) -
529
- currentNodeMainOffsetFromContainingBlock)
530
- : child->getLayout().position(flexStartEdge(mainAxis));
531
- const float childCrossOffsetFromParent = crossInsetsDefined
532
- ? (child->getLayout().position(flexStartEdge(crossAxis)) -
533
- currentNodeCrossOffsetFromContainingBlock)
534
- : child->getLayout().position(flexStartEdge(crossAxis));
535
-
536
- child->setLayoutPosition(
537
- childMainOffsetFromParent, flexStartEdge(mainAxis));
538
- child->setLayoutPosition(
539
- childCrossOffsetFromParent, flexStartEdge(crossAxis));
540
-
541
- if (needsTrailingPosition(mainAxis)) {
542
- setChildTrailingPosition(currentNode, child, mainAxis);
515
+ /*
516
+ * At this point the child has its position set but only on its the
517
+ * parent's flexStart edge. Additionally, this position should be
518
+ * interpreted relative to the containing block of the child if it had
519
+ * insets defined. So we need to adjust the position by subtracting the
520
+ * the parents offset from the containing block. However, getting that
521
+ * offset is complicated since the two nodes can have different main/cross
522
+ * axes.
523
+ */
524
+ const FlexDirection parentMainAxis = resolveDirection(
525
+ currentNode->style().flexDirection(), currentNodeDirection);
526
+ const FlexDirection parentCrossAxis =
527
+ resolveCrossDirection(parentMainAxis, currentNodeDirection);
528
+
529
+ if (needsTrailingPosition(parentMainAxis)) {
530
+ const bool mainInsetsDefined = isRow(parentMainAxis)
531
+ ? child->style().horizontalInsetsDefined()
532
+ : child->style().verticalInsetsDefined();
533
+ setChildTrailingPosition(
534
+ mainInsetsDefined ? containingNode : currentNode,
535
+ child,
536
+ parentMainAxis);
543
537
  }
544
- if (needsTrailingPosition(crossAxis)) {
545
- setChildTrailingPosition(currentNode, child, crossAxis);
538
+ if (needsTrailingPosition(parentCrossAxis)) {
539
+ const bool crossInsetsDefined = isRow(parentCrossAxis)
540
+ ? child->style().horizontalInsetsDefined()
541
+ : child->style().verticalInsetsDefined();
542
+ setChildTrailingPosition(
543
+ crossInsetsDefined ? containingNode : currentNode,
544
+ child,
545
+ parentCrossAxis);
546
546
  }
547
+
548
+ /*
549
+ * At this point we know the left and top physical edges of the child are
550
+ * set with positions that are relative to the containing block if insets
551
+ * are defined
552
+ */
553
+ const float childLeftPosition =
554
+ child->getLayout().position(PhysicalEdge::Left);
555
+ const float childTopPosition =
556
+ child->getLayout().position(PhysicalEdge::Top);
557
+
558
+ const float childLeftOffsetFromParent =
559
+ child->style().horizontalInsetsDefined()
560
+ ? (childLeftPosition - currentNodeLeftOffsetFromContainingBlock)
561
+ : childLeftPosition;
562
+ const float childTopOffsetFromParent =
563
+ child->style().verticalInsetsDefined()
564
+ ? (childTopPosition - currentNodeTopOffsetFromContainingBlock)
565
+ : childTopPosition;
566
+
567
+ child->setLayoutPosition(childLeftOffsetFromParent, PhysicalEdge::Left);
568
+ child->setLayoutPosition(childTopOffsetFromParent, PhysicalEdge::Top);
547
569
  } else if (
548
570
  child->style().positionType() == PositionType::Static &&
549
571
  !child->alwaysFormsContainingBlock()) {
550
572
  const Direction childDirection =
551
573
  child->resolveDirection(currentNodeDirection);
552
- const float childMainOffsetFromContainingBlock =
553
- currentNodeMainOffsetFromContainingBlock +
554
- child->getLayout().position(flexStartEdge(mainAxis));
555
- const float childCrossOffsetFromContainingBlock =
556
- currentNodeCrossOffsetFromContainingBlock +
557
- child->getLayout().position(flexStartEdge(crossAxis));
574
+ // By now all descendants of the containing block that are not absolute
575
+ // will have their positions set for left and top.
576
+ const float childLeftOffsetFromContainingBlock =
577
+ currentNodeLeftOffsetFromContainingBlock +
578
+ child->getLayout().position(PhysicalEdge::Left);
579
+ const float childTopOffsetFromContainingBlock =
580
+ currentNodeTopOffsetFromContainingBlock +
581
+ child->getLayout().position(PhysicalEdge::Top);
558
582
 
559
583
  layoutAbsoluteDescendants(
560
584
  containingNode,
@@ -564,8 +588,8 @@ void layoutAbsoluteDescendants(
564
588
  layoutMarkerData,
565
589
  currentDepth + 1,
566
590
  generationCount,
567
- childMainOffsetFromContainingBlock,
568
- childCrossOffsetFromContainingBlock,
591
+ childLeftOffsetFromContainingBlock,
592
+ childTopOffsetFromContainingBlock,
569
593
  containingNodeAvailableInnerWidth,
570
594
  containingNodeAvailableInnerHeight);
571
595
  }
@@ -2045,26 +2045,7 @@ static void calculateLayoutImpl(
2045
2045
  }
2046
2046
 
2047
2047
  if (performLayout) {
2048
- // STEP 10: SIZING AND POSITIONING ABSOLUTE CHILDREN
2049
- // Let the containing block layout its absolute descendants. By definition
2050
- // the containing block will not be static unless we are at the root.
2051
- if (node->style().positionType() != PositionType::Static ||
2052
- node->alwaysFormsContainingBlock() || depth == 1) {
2053
- layoutAbsoluteDescendants(
2054
- node,
2055
- node,
2056
- isMainAxisRow ? sizingModeMainDim : sizingModeCrossDim,
2057
- direction,
2058
- layoutMarkerData,
2059
- depth,
2060
- generationCount,
2061
- 0.0f,
2062
- 0.0f,
2063
- availableInnerWidth,
2064
- availableInnerHeight);
2065
- }
2066
-
2067
- // STEP 11: SETTING TRAILING POSITIONS FOR CHILDREN
2048
+ // STEP 10: SETTING TRAILING POSITIONS FOR CHILDREN
2068
2049
  const bool needsMainTrailingPos = needsTrailingPosition(mainAxis);
2069
2050
  const bool needsCrossTrailingPos = needsTrailingPosition(crossAxis);
2070
2051
 
@@ -2087,6 +2068,24 @@ static void calculateLayoutImpl(
2087
2068
  }
2088
2069
  }
2089
2070
  }
2071
+
2072
+ // STEP 11: SIZING AND POSITIONING ABSOLUTE CHILDREN
2073
+ // Let the containing block layout its absolute descendants.
2074
+ if (node->style().positionType() != PositionType::Static ||
2075
+ node->alwaysFormsContainingBlock() || depth == 1) {
2076
+ layoutAbsoluteDescendants(
2077
+ node,
2078
+ node,
2079
+ isMainAxisRow ? sizingModeMainDim : sizingModeCrossDim,
2080
+ direction,
2081
+ layoutMarkerData,
2082
+ depth,
2083
+ generationCount,
2084
+ 0.0f,
2085
+ 0.0f,
2086
+ availableInnerWidth,
2087
+ availableInnerHeight);
2088
+ }
2090
2089
  }
2091
2090
  }
2092
2091
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.74.0-rc.3",
3
+ "version": "0.74.0-rc.5",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -98,16 +98,16 @@
98
98
  },
99
99
  "dependencies": {
100
100
  "@jest/create-cache-key-function": "^29.6.3",
101
- "@react-native-community/cli": "13.6.1",
102
- "@react-native-community/cli-platform-android": "13.6.1",
103
- "@react-native-community/cli-platform-ios": "13.6.1",
104
- "@react-native/assets-registry": "0.74.0",
105
- "@react-native/codegen": "0.74.2",
106
- "@react-native/community-cli-plugin": "0.74.5",
107
- "@react-native/gradle-plugin": "0.74.1",
108
- "@react-native/js-polyfills": "0.74.0",
109
- "@react-native/normalize-colors": "0.74.1",
110
- "@react-native/virtualized-lists": "0.74.1",
101
+ "@react-native-community/cli": "13.6.2",
102
+ "@react-native-community/cli-platform-android": "13.6.2",
103
+ "@react-native-community/cli-platform-ios": "13.6.2",
104
+ "@react-native/assets-registry": "0.74.76",
105
+ "@react-native/codegen": "0.74.76",
106
+ "@react-native/community-cli-plugin": "0.74.76",
107
+ "@react-native/gradle-plugin": "0.74.76",
108
+ "@react-native/js-polyfills": "0.74.76",
109
+ "@react-native/normalize-colors": "0.74.76",
110
+ "@react-native/virtualized-lists": "0.74.76",
111
111
  "abort-controller": "^3.0.0",
112
112
  "anser": "^1.4.9",
113
113
  "ansi-regex": "^5.0.0",
@@ -41,6 +41,10 @@ module Helpers
41
41
  return '13.4'
42
42
  end
43
43
 
44
+ def self.min_xcode_version_supported
45
+ return '14.3'
46
+ end
47
+
44
48
  def self.folly_config
45
49
  return {
46
50
  :version => '2024.01.01.00',
@@ -407,19 +407,39 @@ class ReactNativePodsUtils
407
407
  def self.is_using_xcode15_0(xcodebuild_manager: Xcodebuild)
408
408
  xcodebuild_version = xcodebuild_manager.version
409
409
 
410
+ if version = self.parse_xcode_version(xcodebuild_version)
411
+ return version["major"] == 15 && version["minor"] == 0
412
+ end
413
+
414
+ return false
415
+ end
416
+
417
+ def self.parse_xcode_version(version_string)
410
418
  # The output of xcodebuild -version is something like
411
419
  # Xcode 15.0
412
420
  # or
413
421
  # Xcode 14.3.1
414
422
  # We want to capture the version digits
415
- regex = /(\d+)\.(\d+)(?:\.(\d+))?/
416
- if match_data = xcodebuild_version.match(regex)
417
- major = match_data[1].to_i
418
- minor = match_data[2].to_i
419
- return major == 15 && minor == 0
423
+ match = version_string.match(/(\d+)\.(\d+)(?:\.(\d+))?/)
424
+ return nil if match.nil?
425
+
426
+ return {"str" => match[0], "major" => match[1].to_i, "minor" => match[2].to_i};
427
+ end
428
+
429
+ def self.check_minimum_required_xcode(xcodebuild_manager: Xcodebuild)
430
+ version = self.parse_xcode_version(xcodebuild_manager.version)
431
+ if (version.nil? || !Gem::Version::correct?(version["str"]))
432
+ Pod::UI.warn "Unexpected XCode version string '#{xcodebuild_manager.version}'"
433
+ return
420
434
  end
421
435
 
422
- return false
436
+ current = version["str"]
437
+ min_required = Helpers::Constants.min_xcode_version_supported
438
+
439
+ if Gem::Version::new(current) < Gem::Version::new(min_required)
440
+ Pod::UI.puts "React Native requires XCode >= #{min_required}. Found #{current}.".red
441
+ raise "Please upgrade XCode"
442
+ end
423
443
  end
424
444
 
425
445
  def self.add_compiler_flag_to_project(installer, flag, configuration: nil)
@@ -80,6 +80,8 @@ def use_react_native! (
80
80
  ENV['APP_PATH'] = app_path
81
81
  ENV['REACT_NATIVE_PATH'] = path
82
82
 
83
+ ReactNativePodsUtils.check_minimum_required_xcode()
84
+
83
85
  # Current target definition is provided by Cocoapods and it refers to the target
84
86
  # that has invoked the `use_react_native!` function.
85
87
  ReactNativePodsUtils.detect_use_frameworks(current_target_definition)
Binary file
Binary file
Binary file
@@ -11,16 +11,16 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.74.0-rc.3"
14
+ "react-native": "0.74.0-rc.5"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.20.0",
18
18
  "@babel/preset-env": "^7.20.0",
19
19
  "@babel/runtime": "^7.20.0",
20
- "@react-native/babel-preset": "0.74.2",
21
- "@react-native/eslint-config": "0.74.1",
22
- "@react-native/metro-config": "0.74.2",
23
- "@react-native/typescript-config": "0.74.1",
20
+ "@react-native/babel-preset": "0.74.76",
21
+ "@react-native/eslint-config": "0.74.76",
22
+ "@react-native/metro-config": "0.74.76",
23
+ "@react-native/typescript-config": "0.74.76",
24
24
  "@types/react": "^18.2.6",
25
25
  "@types/react-test-renderer": "^18.0.0",
26
26
  "babel-jest": "^29.6.3",
package/types/index.d.ts CHANGED
@@ -103,6 +103,7 @@ export * from '../Libraries/Components/View/View';
103
103
  export * from '../Libraries/Components/View/ViewAccessibility';
104
104
  export * from '../Libraries/Components/View/ViewPropTypes';
105
105
  export * from '../Libraries/Components/Button';
106
+ export * from '../Libraries/Core/registerCallableModule';
106
107
  export * from '../Libraries/DevToolsSettings/DevToolsSettingsManager';
107
108
  export * from '../Libraries/EventEmitter/NativeEventEmitter';
108
109
  export * from '../Libraries/EventEmitter/RCTDeviceEventEmitter';