react-native-macos 0.71.16 → 0.71.17

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.
@@ -9,17 +9,16 @@
9
9
  */
10
10
 
11
11
  import type {PressEvent} from '../Types/CoreEventTypes';
12
+ import type {TextProps} from './TextProps';
12
13
 
13
14
  import * as PressabilityDebug from '../Pressability/PressabilityDebug';
14
15
  import usePressability from '../Pressability/usePressability';
15
16
  import flattenStyle from '../StyleSheet/flattenStyle';
16
17
  import processColor from '../StyleSheet/processColor';
17
- import StyleSheet from '../StyleSheet/StyleSheet';
18
18
  import {getAccessibilityRoleFromRole} from '../Utilities/AcessibilityMapping';
19
19
  import Platform from '../Utilities/Platform';
20
20
  import TextAncestor from './TextAncestor';
21
21
  import {NativeText, NativeVirtualText} from './TextNativeComponent';
22
- import {type TextProps} from './TextProps';
23
22
  import * as React from 'react';
24
23
  import {useContext, useMemo, useState} from 'react';
25
24
 
@@ -36,6 +35,7 @@ const Text: React.AbstractComponent<
36
35
  accessible,
37
36
  accessibilityLabel,
38
37
  accessibilityRole,
38
+ accessibilityState,
39
39
  allowFontScaling,
40
40
  'aria-busy': ariaBusy,
41
41
  'aria-checked': ariaChecked,
@@ -64,13 +64,23 @@ const Text: React.AbstractComponent<
64
64
 
65
65
  const [isHighlighted, setHighlighted] = useState(false);
66
66
 
67
- const _accessibilityState = {
68
- busy: ariaBusy ?? props.accessibilityState?.busy,
69
- checked: ariaChecked ?? props.accessibilityState?.checked,
70
- disabled: ariaDisabled ?? props.accessibilityState?.disabled,
71
- expanded: ariaExpanded ?? props.accessibilityState?.expanded,
72
- selected: ariaSelected ?? props.accessibilityState?.selected,
73
- };
67
+ let _accessibilityState;
68
+ if (
69
+ accessibilityState != null ||
70
+ ariaBusy != null ||
71
+ ariaChecked != null ||
72
+ ariaDisabled != null ||
73
+ ariaExpanded != null ||
74
+ ariaSelected != null
75
+ ) {
76
+ _accessibilityState = {
77
+ busy: ariaBusy ?? accessibilityState?.busy,
78
+ checked: ariaChecked ?? accessibilityState?.checked,
79
+ disabled: ariaDisabled ?? accessibilityState?.disabled,
80
+ expanded: ariaExpanded ?? accessibilityState?.expanded,
81
+ selected: ariaSelected ?? accessibilityState?.selected,
82
+ };
83
+ }
74
84
 
75
85
  const _disabled =
76
86
  restProps.disabled != null
@@ -174,25 +184,11 @@ const Text: React.AbstractComponent<
174
184
  ? null
175
185
  : processColor(restProps.selectionColor);
176
186
 
177
- let style = flattenStyle(restProps.style);
178
-
179
- let _selectable = restProps.selectable;
180
- if (style?.userSelect != null) {
181
- _selectable = userSelectToSelectableMap[style.userSelect];
182
- }
183
-
184
- if (style?.verticalAlign != null) {
185
- style = StyleSheet.compose(style, {
186
- textAlignVertical:
187
- verticalAlignToTextAlignVerticalMap[style.verticalAlign],
188
- });
189
- }
187
+ let style = restProps.style;
190
188
 
191
189
  if (__DEV__) {
192
190
  if (PressabilityDebug.isEnabled() && onPress != null) {
193
- style = StyleSheet.compose(restProps.style, {
194
- color: 'magenta',
195
- });
191
+ style = [restProps.style, {color: 'magenta'}];
196
192
  }
197
193
  }
198
194
 
@@ -211,10 +207,22 @@ const Text: React.AbstractComponent<
211
207
  default: accessible,
212
208
  });
213
209
 
214
- let flattenedStyle = flattenStyle(style);
210
+ style = flattenStyle(style);
211
+
212
+ if (typeof style?.fontWeight === 'number') {
213
+ style.fontWeight = style?.fontWeight.toString();
214
+ }
215
+
216
+ let _selectable = restProps.selectable;
217
+ if (style?.userSelect != null) {
218
+ _selectable = userSelectToSelectableMap[style.userSelect];
219
+ delete style.userSelect;
220
+ }
215
221
 
216
- if (typeof flattenedStyle?.fontWeight === 'number') {
217
- flattenedStyle.fontWeight = flattenedStyle?.fontWeight.toString();
222
+ if (style?.verticalAlign != null) {
223
+ style.textAlignVertical =
224
+ verticalAlignToTextAlignVerticalMap[style.verticalAlign];
225
+ delete style.verticalAlign;
218
226
  }
219
227
 
220
228
  const _hasOnPressOrOnLongPress =
@@ -223,46 +231,46 @@ const Text: React.AbstractComponent<
223
231
  return hasTextAncestor ? (
224
232
  <NativeVirtualText
225
233
  {...restProps}
226
- accessibilityState={_accessibilityState}
227
234
  {...eventHandlersForText}
228
235
  accessibilityLabel={ariaLabel ?? accessibilityLabel}
229
236
  accessibilityRole={
230
237
  role ? getAccessibilityRoleFromRole(role) : accessibilityRole
231
238
  }
239
+ accessibilityState={_accessibilityState}
232
240
  isHighlighted={isHighlighted}
233
241
  isPressable={isPressable}
234
- selectable={_selectable}
235
242
  nativeID={id ?? nativeID}
236
243
  numberOfLines={numberOfLines}
237
- selectionColor={selectionColor}
238
- style={flattenedStyle}
239
244
  ref={forwardedRef}
245
+ selectable={_selectable}
246
+ selectionColor={selectionColor}
247
+ style={style}
240
248
  />
241
249
  ) : (
242
250
  <TextAncestor.Provider value={true}>
243
251
  <NativeText
244
252
  {...restProps}
245
253
  {...eventHandlersForText}
246
- disabled={_disabled}
247
- selectable={_selectable}
254
+ accessibilityLabel={ariaLabel ?? accessibilityLabel}
255
+ accessibilityRole={
256
+ role ? getAccessibilityRoleFromRole(role) : accessibilityRole
257
+ }
258
+ accessibilityState={nativeTextAccessibilityState}
248
259
  accessible={
249
260
  accessible == null && Platform.OS === 'android'
250
261
  ? _hasOnPressOrOnLongPress
251
262
  : _accessible
252
263
  }
253
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
254
- accessibilityState={nativeTextAccessibilityState}
255
- accessibilityRole={
256
- role ? getAccessibilityRoleFromRole(role) : accessibilityRole
257
- }
258
264
  allowFontScaling={allowFontScaling !== false}
265
+ disabled={_disabled}
259
266
  ellipsizeMode={ellipsizeMode ?? 'tail'}
260
267
  isHighlighted={isHighlighted}
261
268
  nativeID={id ?? nativeID}
262
269
  numberOfLines={numberOfLines}
263
- selectionColor={selectionColor}
264
- style={flattenedStyle}
265
270
  ref={forwardedRef}
271
+ selectable={_selectable}
272
+ selectionColor={selectionColor}
273
+ style={style}
266
274
  />
267
275
  </TextAncestor.Provider>
268
276
  );
@@ -314,7 +314,17 @@ static void attemptAsynchronousLoadOfBundleAtURL(
314
314
  return;
315
315
  }
316
316
 
317
- RCTSource *source = RCTSourceCreate(scriptURL, data, data.length);
317
+ // Prefer `Content-Location` as the canonical source URL, if given, or fall back to scriptURL.
318
+ NSURL *sourceURL = scriptURL;
319
+ NSString *contentLocationHeader = headers[@"Content-Location"];
320
+ if (contentLocationHeader) {
321
+ NSURL *contentLocationURL = [NSURL URLWithString:contentLocationHeader relativeToURL:scriptURL];
322
+ if (contentLocationURL) {
323
+ sourceURL = contentLocationURL;
324
+ }
325
+ }
326
+
327
+ RCTSource *source = RCTSourceCreate(sourceURL, data, data.length);
318
328
  parseHeaders(headers, source);
319
329
  onComplete(nil, source);
320
330
  }
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(71),
26
- RCTVersionPatch: @(16),
26
+ RCTVersionPatch: @(17),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -486,6 +486,7 @@ struct RCTInstanceCallback : public InstanceCallback {
486
486
  // Load the source asynchronously, then store it for later execution.
487
487
  dispatch_group_enter(prepareBridge);
488
488
  __block NSData *sourceCode;
489
+ __block NSURL *sourceURL = self.bundleURL;
489
490
 
490
491
  #if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include(<React/RCTDevLoadingViewProtocol.h>)
491
492
  {
@@ -501,6 +502,9 @@ struct RCTInstanceCallback : public InstanceCallback {
501
502
  }
502
503
 
503
504
  sourceCode = source.data;
505
+ if (source.url) {
506
+ sourceURL = source.url;
507
+ }
504
508
  dispatch_group_leave(prepareBridge);
505
509
  }
506
510
  onProgress:^(RCTLoadingProgress *progressData) {
@@ -519,7 +523,7 @@ struct RCTInstanceCallback : public InstanceCallback {
519
523
  dispatch_group_notify(prepareBridge, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
520
524
  RCTCxxBridge *strongSelf = weakSelf;
521
525
  if (sourceCode && strongSelf.loading) {
522
- [strongSelf executeSourceCode:sourceCode sync:NO];
526
+ [strongSelf executeSourceCode:sourceCode withSourceURL:sourceURL sync:NO];
523
527
  }
524
528
  });
525
529
  RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
@@ -1065,7 +1069,7 @@ struct RCTInstanceCallback : public InstanceCallback {
1065
1069
  [_displayLink registerModuleForFrameUpdates:module withModuleData:moduleData];
1066
1070
  }
1067
1071
 
1068
- - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
1072
+ - (void)executeSourceCode:(NSData *)sourceCode withSourceURL:(NSURL *)url sync:(BOOL)sync
1069
1073
  {
1070
1074
  // This will get called from whatever thread was actually executing JS.
1071
1075
  dispatch_block_t completion = ^{
@@ -1090,12 +1094,13 @@ struct RCTInstanceCallback : public InstanceCallback {
1090
1094
  };
1091
1095
 
1092
1096
  if (sync) {
1093
- [self executeApplicationScriptSync:sourceCode url:self.bundleURL];
1097
+ [self executeApplicationScriptSync:sourceCode url:url];
1094
1098
  completion();
1095
1099
  } else {
1096
- [self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:completion];
1100
+ [self enqueueApplicationScript:sourceCode url:url onComplete:completion];
1097
1101
  }
1098
1102
 
1103
+ // Use the original request URL here - HMRClient uses this to derive the /hot URL and entry point.
1099
1104
  [self.devSettings setupHMRClientWithBundleURL:self.bundleURL];
1100
1105
  }
1101
1106
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.71.16
1
+ VERSION_NAME=0.71.17
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -14,6 +14,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
14
14
 
15
15
  import android.app.Activity;
16
16
  import android.content.Context;
17
+ import android.content.ContextWrapper;
17
18
  import android.graphics.Canvas;
18
19
  import android.graphics.Insets;
19
20
  import android.graphics.Point;
@@ -916,6 +917,14 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
916
917
  checkForDeviceDimensionsChanges();
917
918
  }
918
919
 
920
+ private Activity getActivity() {
921
+ Context context = getContext();
922
+ while (!(context instanceof Activity) && context instanceof ContextWrapper) {
923
+ context = ((ContextWrapper) context).getBaseContext();
924
+ }
925
+ return (Activity) context;
926
+ }
927
+
919
928
  @RequiresApi(api = Build.VERSION_CODES.R)
920
929
  private void checkForKeyboardEvents() {
921
930
  getRootView().getWindowVisibleDisplayFrame(mVisibleViewArea);
@@ -933,7 +942,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
933
942
  Insets barInsets = rootInsets.getInsets(WindowInsets.Type.systemBars());
934
943
  int height = imeInsets.bottom - barInsets.bottom;
935
944
 
936
- int softInputMode = ((Activity) getContext()).getWindow().getAttributes().softInputMode;
945
+ int softInputMode = getActivity().getWindow().getAttributes().softInputMode;
937
946
  int screenY =
938
947
  softInputMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING
939
948
  ? mVisibleViewArea.bottom - height
@@ -7,9 +7,12 @@
7
7
 
8
8
  package com.facebook.react.animated;
9
9
 
10
+ import com.facebook.common.logging.FLog;
10
11
  import com.facebook.react.bridge.ReadableArray;
11
12
  import com.facebook.react.bridge.ReadableMap;
12
13
  import com.facebook.react.bridge.ReadableType;
14
+ import com.facebook.react.common.ReactConstants;
15
+ import com.facebook.react.common.build.ReactBuildConfig;
13
16
 
14
17
  /**
15
18
  * Implementation of {@link AnimationDriver} which provides a support for simple time-based
@@ -70,7 +73,17 @@ class FrameBasedAnimationDriver extends AnimationDriver {
70
73
  long timeFromStartMillis = (frameTimeNanos - mStartFrameTimeNanos) / 1000000;
71
74
  int frameIndex = (int) Math.round(timeFromStartMillis / FRAME_TIME_MILLIS);
72
75
  if (frameIndex < 0) {
73
- throw new IllegalStateException("Calculated frame index should never be lower than 0");
76
+ String message =
77
+ "Calculated frame index should never be lower than 0. Called with frameTimeNanos "
78
+ + frameTimeNanos
79
+ + " and mStartFrameTimeNanos "
80
+ + mStartFrameTimeNanos;
81
+ if (ReactBuildConfig.DEBUG) {
82
+ throw new IllegalStateException(message);
83
+ } else {
84
+ FLog.w(ReactConstants.TAG, message);
85
+ return;
86
+ }
74
87
  } else if (mHasFinished) {
75
88
  // nothing to do here
76
89
  return;
@@ -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", 71,
20
- "patch", 16,
20
+ "patch", 17,
21
21
  "prerelease", null);
22
22
  }
@@ -791,7 +791,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
791
791
 
792
792
  /** Compute mInnerTopLeftCorner */
793
793
  mInnerTopLeftCorner.x = mInnerClipTempRectForBorderRadius.left;
794
- mInnerTopLeftCorner.y = mInnerClipTempRectForBorderRadius.top * 2;
794
+ mInnerTopLeftCorner.y = mInnerClipTempRectForBorderRadius.top;
795
795
 
796
796
  getEllipseIntersectionWithLine(
797
797
  // Ellipse Bounds
@@ -817,7 +817,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
817
817
  }
818
818
 
819
819
  mInnerBottomLeftCorner.x = mInnerClipTempRectForBorderRadius.left;
820
- mInnerBottomLeftCorner.y = mInnerClipTempRectForBorderRadius.bottom * -2;
820
+ mInnerBottomLeftCorner.y = mInnerClipTempRectForBorderRadius.bottom;
821
821
 
822
822
  getEllipseIntersectionWithLine(
823
823
  // Ellipse Bounds
@@ -843,7 +843,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
843
843
  }
844
844
 
845
845
  mInnerTopRightCorner.x = mInnerClipTempRectForBorderRadius.right;
846
- mInnerTopRightCorner.y = mInnerClipTempRectForBorderRadius.top * 2;
846
+ mInnerTopRightCorner.y = mInnerClipTempRectForBorderRadius.top;
847
847
 
848
848
  getEllipseIntersectionWithLine(
849
849
  // Ellipse Bounds
@@ -869,7 +869,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
869
869
  }
870
870
 
871
871
  mInnerBottomRightCorner.x = mInnerClipTempRectForBorderRadius.right;
872
- mInnerBottomRightCorner.y = mInnerClipTempRectForBorderRadius.bottom * -2;
872
+ mInnerBottomRightCorner.y = mInnerClipTempRectForBorderRadius.bottom;
873
873
 
874
874
  getEllipseIntersectionWithLine(
875
875
  // Ellipse Bounds
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 71;
20
- int32_t Patch = 16;
20
+ int32_t Patch = 17;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -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-macos",
3
- "version": "0.71.16",
3
+ "version": "0.71.17",
4
4
  "bin": "./cli.js",
5
5
  "description": "React Native for macOS",
6
6
  "license": "MIT",
@@ -113,15 +113,16 @@
113
113
  },
114
114
  "dependencies": {
115
115
  "@jest/create-cache-key-function": "^29.2.1",
116
- "@react-native-community/cli": "10.2.2",
116
+ "@react-native-community/cli": "10.2.4",
117
117
  "@react-native-community/cli-platform-android": "10.2.0",
118
- "@react-native-community/cli-platform-ios": "10.2.1",
118
+ "@react-native-community/cli-platform-ios": "10.2.4",
119
119
  "@react-native-community/cli-tools": "10.1.1",
120
120
  "@react-native/assets": "1.0.0",
121
121
  "@react-native/normalize-color": "2.1.0",
122
122
  "@react-native/polyfills": "2.0.0",
123
123
  "abort-controller": "^3.0.0",
124
124
  "anser": "^1.4.9",
125
+ "ansi-regex": "^5.0.0",
125
126
  "base64-js": "^1.1.2",
126
127
  "deprecated-react-native-prop-types": "^3.0.1",
127
128
  "event-target-shim": "^5.0.1",
@@ -129,15 +130,15 @@
129
130
  "jest-environment-node": "^29.2.1",
130
131
  "jsc-android": "^250231.0.0",
131
132
  "memoize-one": "^5.0.0",
132
- "metro-react-native-babel-transformer": "0.73.9",
133
- "metro-runtime": "0.73.9",
134
- "metro-source-map": "0.73.9",
133
+ "metro-react-native-babel-transformer": "0.73.10",
134
+ "metro-runtime": "0.73.10",
135
+ "metro-source-map": "0.73.10",
135
136
  "mkdirp": "^0.5.1",
136
137
  "nullthrows": "^1.1.1",
137
138
  "pretty-format": "^26.5.2",
138
139
  "promise": "^8.3.0",
139
140
  "react-devtools-core": "^4.26.1",
140
- "react-native-gradle-plugin": "^0.71.17",
141
+ "react-native-gradle-plugin": "^0.71.19",
141
142
  "react-refresh": "^0.4.0",
142
143
  "react-shallow-renderer": "^16.15.0",
143
144
  "regenerator-runtime": "^0.13.2",
@@ -186,8 +187,8 @@
186
187
  "jest": "^29.2.1",
187
188
  "jest-junit": "^10.0.0",
188
189
  "jscodeshift": "^0.13.1",
189
- "metro-babel-register": "0.73.9",
190
- "metro-memory-fs": "0.73.9",
190
+ "metro-babel-register": "0.73.10",
191
+ "metro-memory-fs": "0.73.10",
191
192
  "mkdirp": "^0.5.1",
192
193
  "mock-fs": "^5.1.4",
193
194
  "prettier": "^2.4.1",
@@ -275,7 +275,7 @@ class CodegenUtils
275
275
  :config_key => config_key
276
276
  )
277
277
  react_codegen_spec = codegen_utils.get_react_codegen_spec(
278
- File.join(react_native_path, "package.json"),
278
+ File.join(relative_installation_root, react_native_path, "package.json"),
279
279
  :folly_version => folly_version,
280
280
  :fabric_enabled => fabric_enabled,
281
281
  :hermes_enabled => hermes_enabled,
@@ -131,6 +131,18 @@ class ReactNativePodsUtils
131
131
  end
132
132
  end
133
133
 
134
+ def self.apply_xcode_15_patch(installer)
135
+ installer.target_installation_results.pod_target_installation_results
136
+ .each do |pod_name, target_installation_result|
137
+ target_installation_result.native_target.build_configurations.each do |config|
138
+ # unary_function and binary_function are no longer provided in C++17 and newer standard modes as part of Xcode 15. They can be re-enabled with setting _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
139
+ # Ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Deprecations
140
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited) '
141
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << '"_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION" '
142
+ end
143
+ end
144
+ end
145
+
134
146
  private
135
147
 
136
148
  def self.fix_library_search_path(config)
@@ -226,6 +226,7 @@ def react_native_post_install(installer, react_native_path = "../node_modules/re
226
226
  ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
227
227
  ReactNativePodsUtils.fix_library_search_paths(installer)
228
228
  ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
229
+ ReactNativePodsUtils.apply_xcode_15_patch(installer)
229
230
 
230
231
  NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
231
232
  is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "react": "18.2.0",
15
- "react-native-macos": "0.71.16"
15
+ "react-native-macos": "0.71.17"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@babel/core": "^7.20.0",
@@ -26,7 +26,7 @@
26
26
  "babel-jest": "^29.2.1",
27
27
  "eslint": "^8.19.0",
28
28
  "jest": "^29.2.1",
29
- "metro-react-native-babel-preset": "0.73.9",
29
+ "metro-react-native-babel-preset": "0.73.10",
30
30
  "prettier": "^2.4.1",
31
31
  "react-test-renderer": "18.2.0",
32
32
  "typescript": "4.8.4"