react-native 0.74.1 → 0.74.2

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.
@@ -1135,12 +1135,14 @@ function InternalTextInput(props: Props): React.Node {
1135
1135
  };
1136
1136
 
1137
1137
  const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
1138
-
1139
1138
  const [lastNativeText, setLastNativeText] = useState<?Stringish>(props.value);
1140
1139
  const [lastNativeSelectionState, setLastNativeSelection] = useState<{|
1141
- selection: ?Selection,
1140
+ selection: Selection,
1142
1141
  mostRecentEventCount: number,
1143
- |}>({selection, mostRecentEventCount});
1142
+ |}>({
1143
+ selection: {start: -1, end: -1},
1144
+ mostRecentEventCount: mostRecentEventCount,
1145
+ });
1144
1146
 
1145
1147
  const lastNativeSelection = lastNativeSelectionState.selection;
1146
1148
 
@@ -1498,6 +1500,7 @@ function InternalTextInput(props: Props): React.Node {
1498
1500
  onSelectionChange={_onSelectionChange}
1499
1501
  onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
1500
1502
  selection={selection}
1503
+ selectionColor={selectionColor}
1501
1504
  style={StyleSheet.compose(
1502
1505
  useMultilineDefaultStyle ? styles.multilineDefault : null,
1503
1506
  style,
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 74,
19
- patch: 1,
19
+ patch: 2,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
- RCTVersionPatch: @(1),
26
+ RCTVersionPatch: @(2),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.74.1
1
+ VERSION_NAME=0.74.2
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", 74,
20
- "patch", 1,
20
+ "patch", 2,
21
21
  "prerelease", null);
22
22
  }
@@ -653,11 +653,12 @@ public class ReactHostImpl implements ReactHost {
653
653
  ReactContext currentContext = getCurrentReactContext();
654
654
  if (currentContext != null) {
655
655
  currentContext.onActivityResult(activity, requestCode, resultCode, data);
656
+ } else {
657
+ ReactSoftExceptionLogger.logSoftException(
658
+ TAG,
659
+ new ReactNoCrashSoftException(
660
+ "Tried to access onActivityResult while context is not ready"));
656
661
  }
657
- ReactSoftExceptionLogger.logSoftException(
658
- TAG,
659
- new ReactNoCrashSoftException(
660
- "Tried to access onActivityResult while context is not ready"));
661
662
  }
662
663
 
663
664
  /* To be called when focus has changed for the hosting window. */
@@ -670,11 +671,12 @@ public class ReactHostImpl implements ReactHost {
670
671
  ReactContext currentContext = getCurrentReactContext();
671
672
  if (currentContext != null) {
672
673
  currentContext.onWindowFocusChange(hasFocus);
674
+ } else {
675
+ ReactSoftExceptionLogger.logSoftException(
676
+ TAG,
677
+ new ReactNoCrashSoftException(
678
+ "Tried to access onWindowFocusChange while context is not ready"));
673
679
  }
674
- ReactSoftExceptionLogger.logSoftException(
675
- TAG,
676
- new ReactNoCrashSoftException(
677
- "Tried to access onWindowFocusChange while context is not ready"));
678
680
  }
679
681
 
680
682
  /* This method will give JS the opportunity to receive intents via Linking.
@@ -701,10 +703,11 @@ public class ReactHostImpl implements ReactHost {
701
703
  }
702
704
  }
703
705
  currentContext.onNewIntent(getCurrentActivity(), intent);
706
+ } else {
707
+ ReactSoftExceptionLogger.logSoftException(
708
+ TAG,
709
+ new ReactNoCrashSoftException("Tried to access onNewIntent while context is not ready"));
704
710
  }
705
- ReactSoftExceptionLogger.logSoftException(
706
- TAG,
707
- new ReactNoCrashSoftException("Tried to access onNewIntent while context is not ready"));
708
711
  }
709
712
 
710
713
  @ThreadConfined(UI)
@@ -1523,9 +1526,9 @@ public class ReactHostImpl implements ReactHost {
1523
1526
 
1524
1527
  // Step 3: Stop all React Native surfaces
1525
1528
  stopAttachedSurfaces(method, reactInstance);
1526
-
1527
- // TODO(T161461674): Should we clear mAttachedSurfaces?
1528
- // Not clearing mAttachedSurfaces could lead to a memory leak.
1529
+ synchronized (mAttachedSurfaces) {
1530
+ mAttachedSurfaces.clear();
1531
+ }
1529
1532
 
1530
1533
  return task;
1531
1534
  },
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 74;
20
- int32_t Patch = 1;
20
+ int32_t Patch = 2;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -36,6 +36,56 @@ static jsi::Value textInputMetricsPayload(
36
36
  return payload;
37
37
  };
38
38
 
39
+ static jsi::Value textInputMetricsScrollPayload(
40
+ jsi::Runtime& runtime,
41
+ const TextInputMetrics& textInputMetrics) {
42
+ auto payload = jsi::Object(runtime);
43
+
44
+ {
45
+ auto contentOffset = jsi::Object(runtime);
46
+ contentOffset.setProperty(runtime, "x", textInputMetrics.contentOffset.x);
47
+ contentOffset.setProperty(runtime, "y", textInputMetrics.contentOffset.y);
48
+ payload.setProperty(runtime, "contentOffset", contentOffset);
49
+ }
50
+
51
+ {
52
+ auto contentInset = jsi::Object(runtime);
53
+ contentInset.setProperty(runtime, "top", textInputMetrics.contentInset.top);
54
+ contentInset.setProperty(
55
+ runtime, "left", textInputMetrics.contentInset.left);
56
+ contentInset.setProperty(
57
+ runtime, "bottom", textInputMetrics.contentInset.bottom);
58
+ contentInset.setProperty(
59
+ runtime, "right", textInputMetrics.contentInset.right);
60
+ payload.setProperty(runtime, "contentInset", contentInset);
61
+ }
62
+
63
+ {
64
+ auto contentSize = jsi::Object(runtime);
65
+ contentSize.setProperty(
66
+ runtime, "width", textInputMetrics.contentSize.width);
67
+ contentSize.setProperty(
68
+ runtime, "height", textInputMetrics.contentSize.height);
69
+ payload.setProperty(runtime, "contentSize", contentSize);
70
+ }
71
+
72
+ {
73
+ auto layoutMeasurement = jsi::Object(runtime);
74
+ layoutMeasurement.setProperty(
75
+ runtime, "width", textInputMetrics.layoutMeasurement.width);
76
+ layoutMeasurement.setProperty(
77
+ runtime, "height", textInputMetrics.layoutMeasurement.height);
78
+ payload.setProperty(runtime, "layoutMeasurement", layoutMeasurement);
79
+ }
80
+
81
+ payload.setProperty(
82
+ runtime,
83
+ "zoomScale",
84
+ textInputMetrics.zoomScale ? textInputMetrics.zoomScale : 1);
85
+
86
+ return payload;
87
+ };
88
+
39
89
  static jsi::Value textInputMetricsContentSizePayload(
40
90
  jsi::Runtime& runtime,
41
91
  const TextInputMetrics& textInputMetrics) {
@@ -140,7 +190,9 @@ void TextInputEventEmitter::onKeyPressSync(
140
190
 
141
191
  void TextInputEventEmitter::onScroll(
142
192
  const TextInputMetrics& textInputMetrics) const {
143
- dispatchTextInputEvent("scroll", textInputMetrics);
193
+ dispatchEvent("scroll", [textInputMetrics](jsi::Runtime& runtime) {
194
+ return textInputMetricsScrollPayload(runtime, textInputMetrics);
195
+ });
144
196
  }
145
197
 
146
198
  void TextInputEventEmitter::dispatchTextInputEvent(
package/cli.js CHANGED
@@ -17,6 +17,7 @@ const {get} = require('https');
17
17
  const {URL} = require('url');
18
18
 
19
19
  const isNpxRuntime = process.env.npm_lifecycle_event === 'npx';
20
+ const isInitCommand = process.argv[2] === 'init';
20
21
  const DEFAULT_REGISTRY_HOST =
21
22
  process.env.npm_config_registry ?? 'https://registry.npmjs.org/';
22
23
  const HEAD = '1000.0.0';
@@ -44,8 +45,10 @@ async function getLatestVersion(registryHost = DEFAULT_REGISTRY_HOST) {
44
45
  * @see https://github.com/react-native-community/discussions-and-proposals/tree/main/proposals/0759-react-native-frameworks.md
45
46
  */
46
47
  function warnWhenRunningInit() {
47
- if (process.argv[2] === 'init') {
48
- console.warn('\nRunning: npx @react-native-community/cli init\n');
48
+ if (isInitCommand) {
49
+ console.warn(
50
+ `\nRunning: ${chalk.grey.bold('npx @react-native-community/cli init')}\n`,
51
+ );
49
52
  }
50
53
  }
51
54
 
@@ -59,7 +62,12 @@ function warnWhenRunningInit() {
59
62
  *
60
63
  */
61
64
  async function main() {
62
- if (isNpxRuntime && !process.env.SKIP && currentVersion !== HEAD) {
65
+ if (
66
+ isNpxRuntime &&
67
+ !process.env.SKIP &&
68
+ currentVersion !== HEAD &&
69
+ isInitCommand
70
+ ) {
63
71
  try {
64
72
  const latest = await getLatestVersion();
65
73
  if (latest !== currentVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.74.1",
3
+ "version": "0.74.2",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -107,16 +107,16 @@
107
107
  },
108
108
  "dependencies": {
109
109
  "@jest/create-cache-key-function": "^29.6.3",
110
- "@react-native-community/cli": "13.6.6",
111
- "@react-native-community/cli-platform-android": "13.6.6",
112
- "@react-native-community/cli-platform-ios": "13.6.6",
113
- "@react-native/assets-registry": "0.74.83",
114
- "@react-native/codegen": "0.74.83",
115
- "@react-native/community-cli-plugin": "0.74.83",
116
- "@react-native/gradle-plugin": "0.74.83",
117
- "@react-native/js-polyfills": "0.74.83",
118
- "@react-native/normalize-colors": "0.74.83",
119
- "@react-native/virtualized-lists": "0.74.83",
110
+ "@react-native-community/cli": "13.6.8",
111
+ "@react-native-community/cli-platform-android": "13.6.8",
112
+ "@react-native-community/cli-platform-ios": "13.6.8",
113
+ "@react-native/assets-registry": "0.74.84",
114
+ "@react-native/codegen": "0.74.84",
115
+ "@react-native/community-cli-plugin": "0.74.84",
116
+ "@react-native/gradle-plugin": "0.74.84",
117
+ "@react-native/js-polyfills": "0.74.84",
118
+ "@react-native/normalize-colors": "0.74.84",
119
+ "@react-native/virtualized-lists": "0.74.84",
120
120
  "abort-controller": "^3.0.0",
121
121
  "anser": "^1.4.9",
122
122
  "ansi-regex": "^5.0.0",
@@ -67,7 +67,7 @@ module PrivacyManifestUtils
67
67
  end
68
68
 
69
69
  def self.ensure_reference(file_path, user_project, target)
70
- reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
70
+ reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
71
71
  unless reference_exists
72
72
  # We try to find the main group, but if it doesn't exist, we default to adding the file to the project root – both work
73
73
  file_root = user_project.root_object.main_group.children.find { |group|
@@ -80,7 +80,7 @@ module PrivacyManifestUtils
80
80
 
81
81
  def self.get_privacyinfo_file_path(user_project, targets)
82
82
  file_refs = targets.flat_map { |target| target.resources_build_phase.files_references }
83
- existing_file = file_refs.find { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
83
+ existing_file = file_refs.find { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
84
84
  if existing_file
85
85
  return existing_file.real_path
86
86
  end
@@ -108,11 +108,12 @@ module PrivacyManifestUtils
108
108
  if File.basename(file_path) == 'PrivacyInfo.xcprivacy'
109
109
  content = Xcodeproj::Plist.read_from_path(file_path)
110
110
  accessed_api_types = content["NSPrivacyAccessedAPITypes"]
111
- accessed_api_types.each do |accessed_api|
112
- api_type = accessed_api["NSPrivacyAccessedAPIType"]
113
- reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
114
- used_apis[api_type] ||= []
115
- used_apis[api_type] += reasons
111
+ accessed_api_types&.each do |accessed_api|
112
+ api_type = accessed_api["NSPrivacyAccessedAPIType"]
113
+ reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
114
+ next unless api_type
115
+ used_apis[api_type] ||= []
116
+ used_apis[api_type] += reasons
116
117
  end
117
118
  end
118
119
  end
@@ -42,8 +42,15 @@ EOF
42
42
  patch -p1 config.sub fix_glog_0.3.5_apple_silicon.patch
43
43
  fi
44
44
 
45
- export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
46
- export CXX="$CC"
45
+ XCRUN="$(which xcrun)"
46
+ if [ -n "$XCRUN" ]; then
47
+ export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
48
+ export CXX="$CC"
49
+ else
50
+ export CC="$CC:-$(which gcc)"
51
+ export CXX="$CXX:-$(which g++ || true)"
52
+ fi
53
+ export CXX="$CXX:-$CC"
47
54
 
48
55
  # Remove automake symlink if it exists
49
56
  if [ -h "test-driver" ]; then
@@ -292,7 +292,9 @@ def react_native_post_install(
292
292
  ReactNativePodsUtils.set_use_hermes_build_setting(installer, hermes_enabled)
293
293
  ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
294
294
  ReactNativePodsUtils.set_ccache_compiler_and_linker_build_settings(installer, react_native_path, ccache_enabled)
295
- ReactNativePodsUtils.apply_xcode_15_patch(installer)
295
+ if Environment.new().ruby_platform().include?('darwin')
296
+ ReactNativePodsUtils.apply_xcode_15_patch(installer)
297
+ end
296
298
  ReactNativePodsUtils.updateOSDeploymentTarget(installer)
297
299
  ReactNativePodsUtils.set_dynamic_frameworks_flags(installer)
298
300
  ReactNativePodsUtils.add_ndebug_flag_to_pods_in_release(installer)
@@ -1 +1 @@
1
- hermes-2024-04-25-RNv0.74.1-b54a3a01c531f4f5f1904cb0770033e8b7153dff
1
+ hermes-2024-06-03-RNv0.74.2-bb1e74fe1e95c2b5a2f4f9311152da052badc2bc
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.1"
14
+ "react-native": "0.74.2"
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.83",
21
- "@react-native/eslint-config": "0.74.83",
22
- "@react-native/metro-config": "0.74.83",
23
- "@react-native/typescript-config": "0.74.83",
20
+ "@react-native/babel-preset": "0.74.84",
21
+ "@react-native/eslint-config": "0.74.84",
22
+ "@react-native/metro-config": "0.74.84",
23
+ "@react-native/typescript-config": "0.74.84",
24
24
  "@types/react": "^18.2.6",
25
25
  "@types/react-test-renderer": "^18.0.0",
26
26
  "babel-jest": "^29.6.3",