react-native 0.73.4 → 0.73.6

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.
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
- patch: 4,
15
+ patch: 6,
16
16
  prerelease: null,
17
17
  };
@@ -192,7 +192,7 @@ export function parseComponentStack(message: string): ComponentStack {
192
192
  if (!s) {
193
193
  return null;
194
194
  }
195
- const match = s.match(/(.*) \(at (.*\.js):([\d]+)\)/);
195
+ const match = s.match(/(.*) \(at (.*\.(?:js|jsx|ts|tsx)):([\d]+)\)/);
196
196
  if (!match) {
197
197
  return null;
198
198
  }
@@ -158,6 +158,8 @@
158
158
  [attributedText insertAttributedString:propertyAttributedText atIndex:0];
159
159
  }
160
160
 
161
+ [self postprocessAttributedText:attributedText];
162
+
161
163
  NSAttributedString *newAttributedText;
162
164
  if (![_previousAttributedText isEqualToAttributedString:attributedText]) {
163
165
  // We have to follow `set prop` pattern:
@@ -191,6 +193,52 @@
191
193
  }];
192
194
  }
193
195
 
196
+ - (void)postprocessAttributedText:(NSMutableAttributedString *)attributedText
197
+ {
198
+ __block CGFloat maximumLineHeight = 0;
199
+
200
+ [attributedText enumerateAttribute:NSParagraphStyleAttributeName
201
+ inRange:NSMakeRange(0, attributedText.length)
202
+ options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired
203
+ usingBlock:^(NSParagraphStyle *paragraphStyle, __unused NSRange range, __unused BOOL *stop) {
204
+ if (!paragraphStyle) {
205
+ return;
206
+ }
207
+
208
+ maximumLineHeight = MAX(paragraphStyle.maximumLineHeight, maximumLineHeight);
209
+ }];
210
+
211
+ if (maximumLineHeight == 0) {
212
+ // `lineHeight` was not specified, nothing to do.
213
+ return;
214
+ }
215
+
216
+ __block CGFloat maximumFontLineHeight = 0;
217
+
218
+ [attributedText enumerateAttribute:NSFontAttributeName
219
+ inRange:NSMakeRange(0, attributedText.length)
220
+ options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired
221
+ usingBlock:^(UIFont *font, NSRange range, __unused BOOL *stop) {
222
+ if (!font) {
223
+ return;
224
+ }
225
+
226
+ if (maximumFontLineHeight <= font.lineHeight) {
227
+ maximumFontLineHeight = font.lineHeight;
228
+ }
229
+ }];
230
+
231
+ if (maximumLineHeight < maximumFontLineHeight) {
232
+ return;
233
+ }
234
+
235
+ CGFloat baseLineOffset = maximumLineHeight / 2.0 - maximumFontLineHeight / 2.0;
236
+
237
+ [attributedText addAttribute:NSBaselineOffsetAttributeName
238
+ value:@(baseLineOffset)
239
+ range:NSMakeRange(0, attributedText.length)];
240
+ }
241
+
194
242
  #pragma mark -
195
243
 
196
244
  - (NSAttributedString *)measurableAttributedText
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(73),
26
- RCTVersionPatch: @(4),
26
+ RCTVersionPatch: @(6),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -28,7 +28,7 @@ using namespace facebook::react;
28
28
 
29
29
  @implementation RCTViewComponentView {
30
30
  UIColor *_backgroundColor;
31
- CALayer *_borderLayer;
31
+ __weak CALayer *_borderLayer;
32
32
  BOOL _needsInvalidateLayer;
33
33
  BOOL _isJSResponder;
34
34
  BOOL _removeClippedSubviews;
@@ -397,9 +397,7 @@ using namespace facebook::react;
397
397
  _layoutMetrics = layoutMetrics;
398
398
  _needsInvalidateLayer = YES;
399
399
 
400
- if (_borderLayer) {
401
- _borderLayer.frame = self.layer.bounds;
402
- }
400
+ _borderLayer.frame = self.layer.bounds;
403
401
 
404
402
  if (_contentView) {
405
403
  _contentView.frame = RCTCGRectFromRect(_layoutMetrics.getContentFrame());
@@ -601,10 +599,7 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
601
599
 
602
600
  if (useCoreAnimationBorderRendering) {
603
601
  layer.mask = nil;
604
- if (_borderLayer) {
605
- [_borderLayer removeFromSuperlayer];
606
- _borderLayer = nil;
607
- }
602
+ [_borderLayer removeFromSuperlayer];
608
603
 
609
604
  layer.borderWidth = (CGFloat)borderMetrics.borderWidths.left;
610
605
  CGColorRef borderColor = RCTCreateCGColorRefFromSharedColor(borderMetrics.borderColors.left);
@@ -617,11 +612,12 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
617
612
  layer.backgroundColor = _backgroundColor.CGColor;
618
613
  } else {
619
614
  if (!_borderLayer) {
620
- _borderLayer = [CALayer new];
621
- _borderLayer.zPosition = -1024.0f;
622
- _borderLayer.frame = layer.bounds;
623
- _borderLayer.magnificationFilter = kCAFilterNearest;
624
- [layer addSublayer:_borderLayer];
615
+ CALayer *borderLayer = [CALayer new];
616
+ borderLayer.zPosition = -1024.0f;
617
+ borderLayer.frame = layer.bounds;
618
+ borderLayer.magnificationFilter = kCAFilterNearest;
619
+ [layer addSublayer:borderLayer];
620
+ _borderLayer = borderLayer;
625
621
  }
626
622
 
627
623
  layer.backgroundColor = nil;
@@ -662,6 +658,10 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
662
658
  }
663
659
  }
664
660
 
661
+ // If mutations are applied inside of Animation block, it may cause _borderLayer to be animated.
662
+ // To stop that, imperatively remove all animations from _borderLayer.
663
+ [_borderLayer removeAllAnimations];
664
+
665
665
  // Stage 2.5. Custom Clipping Mask
666
666
  CAShapeLayer *maskLayer = nil;
667
667
  CGFloat cornerRadius = 0;
@@ -20,6 +20,7 @@ folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_C
20
20
  folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
21
21
  folly_version = '2022.05.16.00'
22
22
  boost_compiler_flags = '-Wno-documentation'
23
+ new_arch_flags = ENV['RCT_NEW_ARCH_ENABLED'] == '1' ? ' -DRCT_NEW_ARCH_ENABLED=1' : ''
23
24
 
24
25
  header_search_paths = [
25
26
  "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"",
@@ -52,13 +53,13 @@ Pod::Spec.new do |s|
52
53
  s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}"
53
54
  s.exclude_files = "**/tests/*",
54
55
  "**/android/*",
55
- s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
56
+ s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags + new_arch_flags
56
57
  s.header_dir = header_dir
57
58
  s.module_name = module_name
58
59
  s.framework = ["JavaScriptCore", "MobileCoreServices"]
59
60
  s.pod_target_xcconfig = {
60
61
  "HEADER_SEARCH_PATHS" => header_search_paths,
61
- "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags,
62
+ "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags + new_arch_flags,
62
63
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20"
63
64
  }.merge!(ENV['USE_FRAMEWORKS'] != nil ? {
64
65
  "PUBLIC_HEADERS_FOLDER_PATH" => "#{module_name}.framework/Headers/#{header_dir}"
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.4
1
+ VERSION_NAME=0.73.6
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -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", 73,
20
- "patch", 4,
20
+ "patch", 6,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 73;
20
- int32_t Patch = 4;
20
+ int32_t Patch = 6;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.73.4",
3
+ "version": "0.73.6",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -93,11 +93,11 @@
93
93
  },
94
94
  "dependencies": {
95
95
  "@jest/create-cache-key-function": "^29.6.3",
96
- "@react-native-community/cli": "12.3.2",
97
- "@react-native-community/cli-platform-android": "12.3.2",
98
- "@react-native-community/cli-platform-ios": "12.3.2",
96
+ "@react-native-community/cli": "12.3.6",
97
+ "@react-native-community/cli-platform-android": "12.3.6",
98
+ "@react-native-community/cli-platform-ios": "12.3.6",
99
99
  "@react-native/assets-registry": "0.73.1",
100
- "@react-native/community-cli-plugin": "0.73.16",
100
+ "@react-native/community-cli-plugin": "0.73.17",
101
101
  "@react-native/codegen": "0.73.3",
102
102
  "@react-native/gradle-plugin": "0.73.4",
103
103
  "@react-native/js-polyfills": "0.73.1",
@@ -104,6 +104,10 @@ class NewArchitectureHelper
104
104
  current_config = hash["pod_target_xcconfig"] != nil ? hash["pod_target_xcconfig"] : {}
105
105
  current_headers = current_config["HEADER_SEARCH_PATHS"] != nil ? current_config["HEADER_SEARCH_PATHS"] : ""
106
106
 
107
+ flags_to_add = new_arch_enabled ?
108
+ "#{@@folly_compiler_flags} -DRCT_NEW_ARCH_ENABLED=1" :
109
+ "#{@@folly_compiler_flags}"
110
+
107
111
  header_search_paths = ["\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\""]
108
112
  if ENV['USE_FRAMEWORKS']
109
113
  header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\""
@@ -123,7 +127,7 @@ class NewArchitectureHelper
123
127
  }
124
128
  end
125
129
  header_search_paths_string = header_search_paths.join(" ")
126
- spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}"
130
+ spec.compiler_flags = compiler_flags.empty? ? "$(inherited) #{flags_to_add}" : "$(inherited) #{compiler_flags} #{flags_to_add}"
127
131
  current_config["HEADER_SEARCH_PATHS"] = current_headers.empty? ?
128
132
  header_search_paths_string :
129
133
  "#{current_headers} #{header_search_paths_string}"
@@ -86,6 +86,27 @@ class ReactNativePodsUtils
86
86
  end
87
87
  end
88
88
 
89
+ def self.fix_flipper_for_xcode_15_3(installer)
90
+ installer.pods_project.targets.each do |target|
91
+ if target.name == 'Flipper'
92
+ file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
93
+ if !File.exist?(file_path)
94
+ return
95
+ end
96
+
97
+ contents = File.read(file_path)
98
+ if contents.include?('#include <functional>')
99
+ return
100
+ end
101
+ mod_content = contents.gsub("#pragma once", "#pragma once\n#include <functional>")
102
+ File.chmod(0755, file_path)
103
+ File.open(file_path, 'w') do |file|
104
+ file.puts(mod_content)
105
+ end
106
+ end
107
+ end
108
+ end
109
+
89
110
  def self.set_use_hermes_build_setting(installer, hermes_enabled)
90
111
  Pod::UI.puts("Setting USE_HERMES build settings")
91
112
  projects = self.extract_projects(installer)
@@ -32,7 +32,13 @@ const REACT_NATIVE_PACKAGE_ROOT_FOLDER = path.join(__dirname, '..', '..');
32
32
 
33
33
  const CODEGEN_DEPENDENCY_NAME = '@react-native/codegen';
34
34
  const CODEGEN_REPO_PATH = `${REACT_NATIVE_REPOSITORY_ROOT}/packages/react-native-codegen`;
35
- const CODEGEN_NPM_PATH = `${REACT_NATIVE_PACKAGE_ROOT_FOLDER}/../${CODEGEN_DEPENDENCY_NAME}`;
35
+ // This is a change for 0.73-stable only since this piece of code was replaced:
36
+ // https://github.com/facebook/react-native/commit/9071a3a0b0e11ad711927651bcb2412f553b6fe9
37
+ const CODEGEN_NPM_PATH = path.dirname(
38
+ require.resolve(path.join(CODEGEN_DEPENDENCY_NAME, 'package.json'), {
39
+ paths: [REACT_NATIVE_PACKAGE_ROOT_FOLDER],
40
+ }),
41
+ );
36
42
  const CORE_LIBRARIES_WITH_OUTPUT_FOLDER = {
37
43
  rncore: path.join(REACT_NATIVE_PACKAGE_ROOT_FOLDER, 'ReactCommon'),
38
44
  FBReactNativeSpec: null,
@@ -189,33 +195,34 @@ function handleThirdPartyLibraries(
189
195
  codegenConfigKey,
190
196
  ) {
191
197
  // Determine which of these are codegen-enabled libraries
192
- const configDir =
193
- baseCodegenConfigFileDir ||
194
- path.join(REACT_NATIVE_PACKAGE_ROOT_FOLDER, '..');
198
+ const configDir = baseCodegenConfigFileDir || process.cwd();
195
199
  console.log(
196
200
  `\n\n[Codegen] >>>>> Searching for codegen-enabled libraries in ${configDir}`,
197
201
  );
198
202
 
199
203
  // Handle third-party libraries
204
+ const resolveOptions = {paths: [configDir]};
200
205
  Object.keys(dependencies).forEach(dependency => {
201
206
  if (dependency === REACT_NATIVE_DEPENDENCY_NAME) {
202
207
  // react-native should already be added.
203
208
  return;
204
209
  }
205
- const codegenConfigFileDir = path.join(configDir, dependency);
206
- const configFilePath = path.join(
207
- codegenConfigFileDir,
208
- codegenConfigFilename,
209
- );
210
- if (fs.existsSync(configFilePath)) {
210
+
211
+ try {
212
+ const configFilePath = require.resolve(
213
+ `${dependency}/${codegenConfigFilename}`,
214
+ resolveOptions,
215
+ );
211
216
  const configFile = JSON.parse(fs.readFileSync(configFilePath));
212
217
  extractLibrariesFromJSON(
213
218
  configFile,
214
219
  libraries,
215
220
  codegenConfigKey,
216
221
  dependency,
217
- codegenConfigFileDir,
222
+ path.dirname(configFilePath),
218
223
  );
224
+ } catch (_) {
225
+ // ignore
219
226
  }
220
227
  });
221
228
  }
@@ -308,6 +308,7 @@ def react_native_post_install(
308
308
  ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
309
309
  ReactNativePodsUtils.apply_xcode_15_patch(installer)
310
310
  ReactNativePodsUtils.updateOSDeploymentTarget(installer)
311
+ ReactNativePodsUtils.fix_flipper_for_xcode_15_3(installer)
311
312
 
312
313
  NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
313
314
  NewArchitectureHelper.modify_flags_for_new_architecture(installer, NewArchitectureHelper.new_arch_enabled)
@@ -13,7 +13,7 @@
13
13
  # ./with-environment.sh command
14
14
 
15
15
  # Start with a default
16
- NODE_BINARY=$(command -v node)
16
+ NODE_BINARY=$(command -v node || echo "")
17
17
  export NODE_BINARY
18
18
 
19
19
  # Override the default with the global environment
@@ -1 +1 @@
1
- hermes-2023-11-17-RNv0.73.0-21043a3fc062be445e56a2c10ecd8be028dd9cc5
1
+ hermes-2024-02-20-RNv0.73.5-18f99ace4213052c5e7cdbcd39ee9766cd5df7e4
@@ -7,6 +7,7 @@ require 'net/http'
7
7
  require 'rexml/document'
8
8
 
9
9
  HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
10
+ ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"
10
11
 
11
12
  module HermesEngineSourceType
12
13
  LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
@@ -30,7 +31,7 @@ end
30
31
  # - To use a specific tarball, install the dependencies with:
31
32
  # `HERMES_ENGINE_TARBALL_PATH=<path_to_tarball> bundle exec pod install`
32
33
  # - To force a build from source, install the dependencies with:
33
- # `BUILD_FROM_SOURCE=true bundle exec pod install`
34
+ # `RCT_BUILD_HERMES_FROM_SOURCE=true bundle exec pod install`
34
35
  # If none of the two are provided, Cocoapods will check whether there is a tarball for the current version
35
36
  # (either release or nightly). If not, it will fall back to building from source (the latest commit on main).
36
37
  #
@@ -85,11 +86,11 @@ def hermes_commit_envvar_defined()
85
86
  end
86
87
 
87
88
  def force_build_from_tag(react_native_path)
88
- return ENV['BUILD_FROM_SOURCE'] === 'true' && File.exist?(hermestag_file(react_native_path))
89
+ return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
89
90
  end
90
91
 
91
92
  def force_build_from_main(react_native_path)
92
- return ENV['BUILD_FROM_SOURCE'] === 'true' && !File.exist?(hermestag_file(react_native_path))
93
+ return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && !File.exist?(hermestag_file(react_native_path))
93
94
  end
94
95
 
95
96
  def release_artifact_exists(version)
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.73.4"
14
+ "react-native": "0.73.6"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.20.0",