react-native-macos 0.76.2 → 0.76.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 (24) hide show
  1. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -1
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/Core/setUpErrorHandling.js +1 -7
  4. package/Libraries/LogBox/Data/LogBoxData.js +2 -2
  5. package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
  6. package/React/Base/RCTVersion.m +1 -1
  7. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +52 -4
  8. package/ReactAndroid/api/ReactAndroid.api +0 -1
  9. package/ReactAndroid/cmake-utils/ReactNative-application.cmake +3 -4
  10. package/ReactAndroid/gradle.properties +1 -1
  11. package/ReactAndroid/hermes-engine/build.gradle.kts +4 -0
  12. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +2 -0
  13. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt +0 -8
  14. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  15. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +8 -1
  16. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  17. package/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputShadowNode.cpp +3 -2
  18. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +12 -1
  19. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +165 -2
  20. package/cli.js +1 -1
  21. package/package.json +8 -8
  22. package/scripts/codegen/generate-artifacts-executor.js +3 -3
  23. package/sdks/.hermesversion +1 -1
  24. package/types/modules/Codegen.d.ts +6 -0
@@ -63,7 +63,7 @@ Pod::Spec.new do |s|
63
63
  "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
64
64
  "DEFINES_MODULE" => "YES"
65
65
  }
66
- s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
66
+ s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Private/Yoga\""}
67
67
 
68
68
  s.dependency "React-Core"
69
69
  s.dependency "RCT-Folly", folly_version
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 76,
19
- patch: 2,
19
+ patch: 3,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -21,13 +21,7 @@ ExceptionsManager.installConsoleErrorReporter();
21
21
  if (!global.__fbDisableExceptionsManager) {
22
22
  const handleError = (e: mixed, isFatal: boolean) => {
23
23
  try {
24
- // TODO(T196834299): We should really use a c++ turbomodule for this
25
- if (
26
- !global.RN$handleException ||
27
- !global.RN$handleException(e, isFatal)
28
- ) {
29
- ExceptionsManager.handleException(e, isFatal);
30
- }
24
+ ExceptionsManager.handleException(e, isFatal);
31
25
  } catch (ee) {
32
26
  console.log('Failed to print error: ', ee.message);
33
27
  throw e;
@@ -82,9 +82,9 @@ let warningFilter: WarningFilter = function (format) {
82
82
  return {
83
83
  finalFormat: format,
84
84
  forceDialogImmediately: false,
85
- suppressDialog_LEGACY: true,
85
+ suppressDialog_LEGACY: false,
86
86
  suppressCompletely: false,
87
- monitorEvent: 'unknown',
87
+ monitorEvent: 'warning_unhandled',
88
88
  monitorListVersion: 0,
89
89
  monitorSampleRate: 1,
90
90
  };
@@ -60,6 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
60
60
  @property (nonatomic, assign, readonly) CGFloat zoomScale;
61
61
  @property (nonatomic, assign, readonly) CGPoint contentOffset;
62
62
  @property (nonatomic, assign, readonly) UIEdgeInsets contentInset;
63
+ @property (nullable, nonatomic, copy) NSDictionary<NSAttributedStringKey, id> *typingAttributes;
63
64
  #if TARGET_OS_OSX // [macOS
64
65
  @property (nonatomic, assign) CGFloat pointScaleFactor;
65
66
  #endif // macOS]
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(76),
26
- RCTVersionPatch: @(2),
26
+ RCTVersionPatch: @(3),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -40,7 +40,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
40
40
  #if !TARGET_OS_OSX // [macOS]
41
41
  RCTUIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
42
42
  #else // [macOS
43
- RCTPlatformView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
43
+ RCTUITextView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
44
44
  #endif // macOS]
45
45
  NSUInteger _mostRecentEventCount;
46
46
  NSAttributedString *_lastStringStateWasUpdatedWith;
@@ -67,6 +67,13 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
67
67
  */
68
68
  BOOL _comingFromJS;
69
69
  BOOL _didMoveToWindow;
70
+
71
+ /*
72
+ * Newly initialized default typing attributes contain a no-op NSParagraphStyle and NSShadow. These cause inequality
73
+ * between the AttributedString backing the input and those generated from state. We store these attributes to make
74
+ * later comparison insensitive to them.
75
+ */
76
+ NSDictionary<NSAttributedStringKey, id> *_originalTypingAttributes;
70
77
  }
71
78
 
72
79
  #pragma mark - UIView overrides
@@ -82,6 +89,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
82
89
  _ignoreNextTextInputCall = NO;
83
90
  _comingFromJS = NO;
84
91
  _didMoveToWindow = NO;
92
+ _originalTypingAttributes = [_backedTextInputView.typingAttributes copy];
85
93
 
86
94
  [self addSubview:_backedTextInputView];
87
95
  #if TARGET_OS_IOS // [macOS] [visionOS]
@@ -92,6 +100,20 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
92
100
  return self;
93
101
  }
94
102
 
103
+ - (void)updateEventEmitter:(const EventEmitter::Shared &)eventEmitter
104
+ {
105
+ [super updateEventEmitter:eventEmitter];
106
+
107
+ NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
108
+ [_backedTextInputView.defaultTextAttributes mutableCopy];
109
+
110
+ RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
111
+ eventEmitterWrapper.eventEmitter = _eventEmitter;
112
+ defaultAttributes[RCTAttributedStringEventEmitterKey] = eventEmitterWrapper;
113
+
114
+ _backedTextInputView.defaultTextAttributes = defaultAttributes;
115
+ }
116
+
95
117
  - (void)didMoveToWindow
96
118
  {
97
119
  [super didMoveToWindow];
@@ -259,8 +281,11 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
259
281
  }
260
282
 
261
283
  if (newTextInputProps.textAttributes != oldTextInputProps.textAttributes) {
262
- _backedTextInputView.defaultTextAttributes =
284
+ NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
263
285
  RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier()));
286
+ defaultAttributes[RCTAttributedStringEventEmitterKey] =
287
+ _backedTextInputView.defaultTextAttributes[RCTAttributedStringEventEmitterKey];
288
+ _backedTextInputView.defaultTextAttributes = defaultAttributes;
264
289
  }
265
290
 
266
291
  #if !TARGET_OS_OSX // [macOS]
@@ -448,6 +473,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
448
473
 
449
474
  - (void)textInputDidChangeSelection
450
475
  {
476
+ [self _updateTypingAttributes];
451
477
  if (_comingFromJS) {
452
478
  return;
453
479
  }
@@ -768,10 +794,31 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
768
794
  [_backedTextInputView scrollRangeToVisible:NSMakeRange(offsetStart, 0)];
769
795
  }
770
796
  [self _restoreTextSelection];
797
+ [self _updateTypingAttributes];
771
798
  _lastStringStateWasUpdatedWith = attributedString;
772
799
  #endif // [macOS]
773
800
  }
774
801
 
802
+ // Ensure that newly typed text will inherit any custom attributes. We follow the logic of RN Android, where attributes
803
+ // to the left of the cursor are copied into new text, unless we are at the start of the field, in which case we will
804
+ // copy the attributes from text to the right. This allows consistency between backed input and new AttributedText
805
+ // https://github.com/facebook/react-native/blob/3102a58df38d96f3dacef0530e4dbb399037fcd2/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/SetSpanOperation.kt#L30
806
+ - (void)_updateTypingAttributes
807
+ {
808
+ if (_backedTextInputView.attributedText.length > 0) {
809
+ #if !TARGET_OS_OSX // [macOS]
810
+ NSUInteger offsetStart = [_backedTextInputView offsetFromPosition:_backedTextInputView.beginningOfDocument
811
+ toPosition:_backedTextInputView.selectedTextRange.start];
812
+ #else // [macOS
813
+ NSUInteger offsetStart = [_backedTextInputView selectedTextRange].location;
814
+ #endif // macOS]
815
+
816
+ NSUInteger samplePoint = offsetStart == 0 ? 0 : offsetStart - 1;
817
+ _backedTextInputView.typingAttributes = [_backedTextInputView.attributedText attributesAtIndex:samplePoint
818
+ effectiveRange:NULL];
819
+ }
820
+ }
821
+
775
822
  - (void)_setMultiline:(BOOL)multiline
776
823
  {
777
824
  [_backedTextInputView removeFromSuperview];
@@ -842,9 +889,10 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
842
889
  fontHasBeenUpdatedBySystem;
843
890
 
844
891
  if (shouldFallbackToBareTextComparison) {
845
- return ([newText.string isEqualToString:oldText.string]);
892
+ return [newText.string isEqualToString:oldText.string];
846
893
  } else {
847
- return ([newText isEqualToAttributedString:oldText]);
894
+ return RCTIsAttributedStringEffectivelySame(
895
+ newText, oldText, _originalTypingAttributes, static_cast<const TextInputProps &>(*_props).textAttributes);
848
896
  }
849
897
  }
850
898
 
@@ -3306,7 +3306,6 @@ public final class com/facebook/react/modules/core/TimingModule : com/facebook/f
3306
3306
  public fun createTimer (DDDZ)V
3307
3307
  public fun deleteTimer (D)V
3308
3308
  public fun emitTimeDriftWarning (Ljava/lang/String;)V
3309
- public fun initialize ()V
3310
3309
  public fun invalidate ()V
3311
3310
  public fun setSendIdleEvents (Z)V
3312
3311
  }
@@ -31,12 +31,11 @@ if(CCACHE_FOUND)
31
31
  endif(CCACHE_FOUND)
32
32
 
33
33
  set(BUILD_DIR ${PROJECT_BUILD_DIR})
34
- if(CMAKE_HOST_WIN32)
35
- string(REPLACE "\\" "/" BUILD_DIR ${BUILD_DIR})
36
- endif()
34
+ file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
35
+ file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR)
37
36
 
38
37
  file(GLOB input_SRC CONFIGURE_DEPENDS
39
- *.cpp
38
+ ${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp
40
39
  ${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
41
40
 
42
41
  add_library(${CMAKE_PROJECT_NAME} SHARED ${input_SRC})
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.76.2
1
+ VERSION_NAME=0.76.3
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -36,9 +36,13 @@ fun getSDKPath(): String {
36
36
  fun getSDKManagerPath(): String {
37
37
  val metaSdkManagerPath = File("${getSDKPath()}/cmdline-tools/latest/bin/sdkmanager")
38
38
  val ossSdkManagerPath = File("${getSDKPath()}/tools/bin/sdkmanager")
39
+ val windowsMetaSdkManagerPath = File("${getSDKPath()}/cmdline-tools/latest/bin/sdkmanager.bat")
40
+ val windowsOssSdkManagerPath = File("${getSDKPath()}/tools/bin/sdkmanager.bat")
39
41
  return when {
40
42
  metaSdkManagerPath.exists() -> metaSdkManagerPath.absolutePath
43
+ windowsMetaSdkManagerPath.exists() -> windowsMetaSdkManagerPath.absolutePath
41
44
  ossSdkManagerPath.exists() -> ossSdkManagerPath.absolutePath
45
+ windowsOssSdkManagerPath.exists() -> windowsOssSdkManagerPath.absolutePath
42
46
  else -> throw GradleException("Could not find sdkmanager executable.")
43
47
  }
44
48
  }
@@ -65,6 +65,7 @@ public open class JavaTimerManager(
65
65
 
66
66
  init {
67
67
  reactApplicationContext.addLifecycleEventListener(this)
68
+ HeadlessJsTaskContext.getInstance(reactApplicationContext).addTaskEventListener(this)
68
69
  }
69
70
 
70
71
  override fun onHostPause() {
@@ -103,6 +104,7 @@ public open class JavaTimerManager(
103
104
  }
104
105
 
105
106
  public open fun onInstanceDestroy() {
107
+ HeadlessJsTaskContext.getInstance(reactApplicationContext).removeTaskEventListener(this)
106
108
  reactApplicationContext.removeLifecycleEventListener(this)
107
109
  clearFrameCallback()
108
110
  clearChoreographerIdleCallback()
@@ -12,7 +12,6 @@ import com.facebook.react.bridge.ReactApplicationContext
12
12
  import com.facebook.react.bridge.WritableArray
13
13
  import com.facebook.react.common.annotations.VisibleForTesting
14
14
  import com.facebook.react.devsupport.interfaces.DevSupportManager
15
- import com.facebook.react.jstasks.HeadlessJsTaskContext
16
15
  import com.facebook.react.module.annotations.ReactModule
17
16
 
18
17
  /** Native module for JS timer execution. Timers fire on frame boundaries. */
@@ -24,11 +23,6 @@ public class TimingModule(
24
23
  private val javaTimerManager: JavaTimerManager =
25
24
  JavaTimerManager(reactContext, this, ReactChoreographer.getInstance(), devSupportManager)
26
25
 
27
- override fun initialize() {
28
- HeadlessJsTaskContext.getInstance(getReactApplicationContext())
29
- .addTaskEventListener(javaTimerManager)
30
- }
31
-
32
26
  override fun createTimer(
33
27
  callbackIDDouble: Double,
34
28
  durationDouble: Double,
@@ -68,8 +62,6 @@ public class TimingModule(
68
62
  }
69
63
 
70
64
  override fun invalidate() {
71
- val headlessJsTaskContext = HeadlessJsTaskContext.getInstance(getReactApplicationContext())
72
- headlessJsTaskContext.removeTaskEventListener(javaTimerManager)
73
65
  javaTimerManager.onInstanceDestroy()
74
66
  }
75
67
 
@@ -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", 76,
20
- "patch", 2,
20
+ "patch", 3,
21
21
  "prerelease", null);
22
22
  }
@@ -296,7 +296,14 @@ public class ReactModalHostView(context: ThemedReactContext) :
296
296
  * changed. This has the pleasant side-effect of us not having to preface all Modals with "top:
297
297
  * statusBarHeight", since that margin will be included in the FrameLayout.
298
298
  */
299
- get() = FrameLayout(context).apply { addView(dialogRootViewGroup) }
299
+ get() =
300
+ FrameLayout(context).apply {
301
+ addView(dialogRootViewGroup)
302
+ if (!statusBarTranslucent) {
303
+ // this is needed to prevent content hiding behind systems bars < API 30
304
+ this.fitsSystemWindows = true
305
+ }
306
+ }
300
307
 
301
308
  /**
302
309
  * updateProperties will update the properties that do not require us to recreate the dialog
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 76;
20
- int32_t Patch = 2;
20
+ int32_t Patch = 3;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -83,7 +83,7 @@ AttributedString TextInputShadowNode::getAttributedString(
83
83
  .string = getConcreteProps().text,
84
84
  .textAttributes = textAttributes,
85
85
  // TODO: Is this really meant to be by value?
86
- .parentShadowView = ShadowView{}});
86
+ .parentShadowView = ShadowView(*this)});
87
87
 
88
88
  auto attachments = Attachments{};
89
89
  BaseTextShadowNode::buildAttributedString(
@@ -110,7 +110,8 @@ void TextInputShadowNode::updateStateIfNeeded(
110
110
  (!state.layoutManager || state.layoutManager == textLayoutManager_) &&
111
111
  "`StateData` refers to a different `TextLayoutManager`");
112
112
 
113
- if (state.reactTreeAttributedString == reactTreeAttributedString &&
113
+ if (state.reactTreeAttributedString.isContentEqual(
114
+ reactTreeAttributedString) &&
114
115
  state.layoutManager == textLayoutManager_) {
115
116
  return;
116
117
  }
@@ -22,7 +22,7 @@ NSString *const RCTTextAttributesAccessibilityRoleAttributeName = @"Accessibilit
22
22
  /*
23
23
  * Creates `NSTextAttributes` from given `facebook::react::TextAttributes`
24
24
  */
25
- NSDictionary<NSAttributedStringKey, id> *RCTNSTextAttributesFromTextAttributes(
25
+ NSMutableDictionary<NSAttributedStringKey, id> *RCTNSTextAttributesFromTextAttributes(
26
26
  const facebook::react::TextAttributes &textAttributes);
27
27
 
28
28
  /*
@@ -41,6 +41,17 @@ NSString *RCTNSStringFromStringApplyingTextTransform(NSString *string, facebook:
41
41
 
42
42
  void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText);
43
43
 
44
+ /*
45
+ * Whether two `NSAttributedString` lead to the same underlying displayed text, even if they are not strictly equal.
46
+ * I.e. is one string substitutable for the other when backing a control (which may have some ignorable attributes
47
+ * provided).
48
+ */
49
+ BOOL RCTIsAttributedStringEffectivelySame(
50
+ NSAttributedString *text1,
51
+ NSAttributedString *text2,
52
+ NSDictionary<NSAttributedStringKey, id> *insensitiveAttributes,
53
+ const facebook::react::TextAttributes &baseTextAttributes);
54
+
44
55
  @interface RCTWeakEventEmitterWrapper : NSObject
45
56
  @property (nonatomic, assign) facebook::react::SharedEventEmitter eventEmitter;
46
57
  @end
@@ -35,6 +35,24 @@ using namespace facebook::react;
35
35
  _weakEventEmitter.reset();
36
36
  }
37
37
 
38
+ - (BOOL)isEqual:(id)object
39
+ {
40
+ // We consider the underlying EventEmitter as the identity
41
+ if (![object isKindOfClass:[self class]]) {
42
+ return NO;
43
+ }
44
+
45
+ auto thisEventEmitter = [self eventEmitter];
46
+ auto otherEventEmitter = [((RCTWeakEventEmitterWrapper *)object) eventEmitter];
47
+ return thisEventEmitter == otherEventEmitter;
48
+ }
49
+
50
+ - (NSUInteger)hash
51
+ {
52
+ // We consider the underlying EventEmitter as the identity
53
+ return (NSUInteger)_weakEventEmitter.lock().get();
54
+ }
55
+
38
56
  @end
39
57
 
40
58
  inline static UIFontWeight RCTUIFontWeightFromInteger(NSInteger fontWeight)
@@ -184,7 +202,8 @@ inline static RCTUIColor *RCTEffectiveBackgroundColorFromTextAttributes(const Te
184
202
  return effectiveBackgroundColor ? effectiveBackgroundColor : [RCTUIColor clearColor]; // [macOS]
185
203
  }
186
204
 
187
- NSDictionary<NSAttributedStringKey, id> *RCTNSTextAttributesFromTextAttributes(const TextAttributes &textAttributes)
205
+ NSMutableDictionary<NSAttributedStringKey, id> *RCTNSTextAttributesFromTextAttributes(
206
+ const TextAttributes &textAttributes)
188
207
  {
189
208
  NSMutableDictionary<NSAttributedStringKey, id> *attributes = [NSMutableDictionary dictionaryWithCapacity:10];
190
209
 
@@ -308,7 +327,7 @@ NSDictionary<NSAttributedStringKey, id> *RCTNSTextAttributesFromTextAttributes(c
308
327
  attributes[RCTTextAttributesAccessibilityRoleAttributeName] = [NSString stringWithUTF8String:roleStr.c_str()];
309
328
  }
310
329
 
311
- return [attributes copy];
330
+ return attributes;
312
331
  }
313
332
 
314
333
  void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText)
@@ -472,3 +491,147 @@ NSString *RCTNSStringFromStringApplyingTextTransform(NSString *string, TextTrans
472
491
  return string;
473
492
  }
474
493
  }
494
+
495
+ static BOOL RCTIsParagraphStyleEffectivelySame(
496
+ NSParagraphStyle *style1,
497
+ NSParagraphStyle *style2,
498
+ const TextAttributes &baseTextAttributes)
499
+ {
500
+ if (style1 == nil || style2 == nil) {
501
+ return style1 == nil && style2 == nil;
502
+ }
503
+
504
+ // The NSParagraphStyle included as part of typingAttributes may eventually resolve "natural" directions to
505
+ // physical direction, so we should compare resolved directions
506
+ auto naturalAlignment =
507
+ baseTextAttributes.layoutDirection.value_or(LayoutDirection::LeftToRight) == LayoutDirection::LeftToRight
508
+ ? NSTextAlignmentLeft
509
+ : NSTextAlignmentRight;
510
+
511
+ NSWritingDirection naturalBaseWritingDirection = baseTextAttributes.baseWritingDirection.has_value()
512
+ ? RCTNSWritingDirectionFromWritingDirection(baseTextAttributes.baseWritingDirection.value())
513
+ : [NSParagraphStyle defaultWritingDirectionForLanguage:nil];
514
+
515
+ if (style1.alignment == NSTextAlignmentNatural || style1.baseWritingDirection == NSWritingDirectionNatural) {
516
+ NSMutableParagraphStyle *mutableStyle1 = [style1 mutableCopy];
517
+ style1 = mutableStyle1;
518
+
519
+ if (mutableStyle1.alignment == NSTextAlignmentNatural) {
520
+ mutableStyle1.alignment = naturalAlignment;
521
+ }
522
+
523
+ if (mutableStyle1.baseWritingDirection == NSWritingDirectionNatural) {
524
+ mutableStyle1.baseWritingDirection = naturalBaseWritingDirection;
525
+ }
526
+ }
527
+
528
+ if (style2.alignment == NSTextAlignmentNatural || style2.baseWritingDirection == NSWritingDirectionNatural) {
529
+ NSMutableParagraphStyle *mutableStyle2 = [style2 mutableCopy];
530
+ style2 = mutableStyle2;
531
+
532
+ if (mutableStyle2.alignment == NSTextAlignmentNatural) {
533
+ mutableStyle2.alignment = naturalAlignment;
534
+ }
535
+
536
+ if (mutableStyle2.baseWritingDirection == NSWritingDirectionNatural) {
537
+ mutableStyle2.baseWritingDirection = naturalBaseWritingDirection;
538
+ }
539
+ }
540
+
541
+ return [style1 isEqual:style2];
542
+ }
543
+
544
+ static BOOL RCTIsAttributeEffectivelySame(
545
+ NSAttributedStringKey attributeKey,
546
+ NSDictionary<NSAttributedStringKey, id> *attributes1,
547
+ NSDictionary<NSAttributedStringKey, id> *attributes2,
548
+ NSDictionary<NSAttributedStringKey, id> *insensitiveAttributes,
549
+ const TextAttributes &baseTextAttributes)
550
+ {
551
+ id attribute1 = attributes1[attributeKey] ?: insensitiveAttributes[attributeKey];
552
+ id attribute2 = attributes2[attributeKey] ?: insensitiveAttributes[attributeKey];
553
+
554
+ // Normalize attributes which can inexact but still effectively the same
555
+ if ([attributeKey isEqualToString:NSParagraphStyleAttributeName]) {
556
+ return RCTIsParagraphStyleEffectivelySame(attribute1, attribute2, baseTextAttributes);
557
+ }
558
+
559
+ // Otherwise rely on built-in comparison
560
+ return [attribute1 isEqual:attribute2];
561
+ }
562
+
563
+ BOOL RCTIsAttributedStringEffectivelySame(
564
+ NSAttributedString *text1,
565
+ NSAttributedString *text2,
566
+ NSDictionary<NSAttributedStringKey, id> *insensitiveAttributes,
567
+ const TextAttributes &baseTextAttributes)
568
+ {
569
+ if (![text1.string isEqualToString:text2.string]) {
570
+ return NO;
571
+ }
572
+
573
+ // We check that for every fragment in the old string
574
+ // 1. The new string's fragment overlapping the first spans the same characters
575
+ // 2. The attributes of each matching fragment are the same, ignoring those which match insensitive attibutes
576
+ __block BOOL areAttributesSame = YES;
577
+ [text1 enumerateAttributesInRange:NSMakeRange(0, text1.length)
578
+ options:0
579
+ usingBlock:^(
580
+ NSDictionary<NSAttributedStringKey, id> *text1Attributes,
581
+ NSRange text1Range,
582
+ BOOL *text1Stop) {
583
+ [text2 enumerateAttributesInRange:text1Range
584
+ options:0
585
+ usingBlock:^(
586
+ NSDictionary<NSAttributedStringKey, id> *text2Attributes,
587
+ NSRange text2Range,
588
+ BOOL *text2Stop) {
589
+ if (!NSEqualRanges(text1Range, text2Range)) {
590
+ areAttributesSame = NO;
591
+ *text1Stop = YES;
592
+ *text2Stop = YES;
593
+ return;
594
+ }
595
+
596
+ // Compare every attribute in text1 to the corresponding attribute
597
+ // in text2, or the set of insensitive attributes if not present
598
+ for (NSAttributedStringKey key in text1Attributes) {
599
+ if (!RCTIsAttributeEffectivelySame(
600
+ key,
601
+ text1Attributes,
602
+ text2Attributes,
603
+ insensitiveAttributes,
604
+ baseTextAttributes)) {
605
+ areAttributesSame = NO;
606
+ *text1Stop = YES;
607
+ *text2Stop = YES;
608
+ return;
609
+ }
610
+ }
611
+
612
+ for (NSAttributedStringKey key in text2Attributes) {
613
+ // We have already compared this attribute if it is present in
614
+ // both
615
+ if (text1Attributes[key] != nil) {
616
+ continue;
617
+ }
618
+
619
+ // But we still need to compare attributes if it is only present
620
+ // in text 2, to compare against insensitive attributes
621
+ if (!RCTIsAttributeEffectivelySame(
622
+ key,
623
+ text1Attributes,
624
+ text2Attributes,
625
+ insensitiveAttributes,
626
+ baseTextAttributes)) {
627
+ areAttributesSame = NO;
628
+ *text1Stop = YES;
629
+ *text2Stop = YES;
630
+ return;
631
+ }
632
+ }
633
+ }];
634
+ }];
635
+
636
+ return areAttributesSame;
637
+ }
package/cli.js CHANGED
@@ -204,7 +204,7 @@ async function main() {
204
204
 
205
205
  const proc = spawn(
206
206
  'npx',
207
- ['@react-native-community/cli', ...process.argv.slice(2)],
207
+ ['@react-native-community/cli@latest', ...process.argv.slice(2)],
208
208
  {
209
209
  stdio: 'inherit',
210
210
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.76.2",
3
+ "version": "0.76.3",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -111,13 +111,13 @@
111
111
  },
112
112
  "dependencies": {
113
113
  "@jest/create-cache-key-function": "^29.6.3",
114
- "@react-native-mac/virtualized-lists": "0.76.2",
115
- "@react-native/assets-registry": "0.76.2",
116
- "@react-native/codegen": "0.76.2",
117
- "@react-native/community-cli-plugin": "0.76.2",
118
- "@react-native/gradle-plugin": "0.76.2",
119
- "@react-native/js-polyfills": "0.76.2",
120
- "@react-native/normalize-colors": "0.76.2",
114
+ "@react-native-mac/virtualized-lists": "0.76.3",
115
+ "@react-native/assets-registry": "0.76.3",
116
+ "@react-native/codegen": "0.76.3",
117
+ "@react-native/community-cli-plugin": "0.76.3",
118
+ "@react-native/gradle-plugin": "0.76.3",
119
+ "@react-native/js-polyfills": "0.76.3",
120
+ "@react-native/normalize-colors": "0.76.3",
121
121
  "abort-controller": "^3.0.0",
122
122
  "anser": "^1.4.9",
123
123
  "ansi-regex": "^5.0.0",
@@ -494,7 +494,7 @@ function rootCodegenTargetNeedsThirdPartyComponentProvider(pkgJson, platform) {
494
494
  function dependencyNeedsThirdPartyComponentProvider(
495
495
  schemaInfo,
496
496
  platform,
497
- appCondegenConfigSpec,
497
+ appCodegenConfigSpec,
498
498
  ) {
499
499
  // Filter the react native core library out.
500
500
  // In the future, core library and third party library should
@@ -505,7 +505,7 @@ function dependencyNeedsThirdPartyComponentProvider(
505
505
  // the symbols defined in the app.
506
506
  return (
507
507
  !isReactNativeCoreLibrary(schemaInfo.library.config.name, platform) &&
508
- schemaInfo.library.config.name !== appCondegenConfigSpec
508
+ schemaInfo.library.config.name !== appCodegenConfigSpec
509
509
  );
510
510
  }
511
511
 
@@ -721,7 +721,7 @@ function execute(projectRoot, targetPlatform, baseOutputPath) {
721
721
  dependencyNeedsThirdPartyComponentProvider(
722
722
  schemaInfo,
723
723
  platform,
724
- pkgJson.codegenConfig?.appCondegenConfigSpec,
724
+ pkgJson.codegenConfig?.name,
725
725
  ),
726
726
  );
727
727
  const schemas = filteredSchemas.map(schemaInfo => schemaInfo.schema);
@@ -1 +1 @@
1
- hermes-2024-09-09-RNv0.76.0-db6d12e202e15f7a446d8848d6ca8f7abb3cfb32
1
+ hermes-2024-11-12-RNv0.76.2-5b4aa20c719830dcf5684832b89a6edb95ac3d64
@@ -41,6 +41,7 @@ declare module 'react-native/Libraries/Utilities/codegenNativeComponent' {
41
41
 
42
42
  declare module 'react-native/Libraries/Types/CodegenTypes' {
43
43
  import type {NativeSyntheticEvent} from 'react-native';
44
+ import type {EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter';
44
45
 
45
46
  // Event types
46
47
  // We're not using the PaperName, it is only used to codegen view config settings
@@ -59,6 +60,7 @@ declare module 'react-native/Libraries/Types/CodegenTypes' {
59
60
  export type Float = number;
60
61
  export type Int32 = number;
61
62
  export type UnsafeObject = object;
63
+ export type UnsafeMixed = unknown;
62
64
 
63
65
  type DefaultTypes = number | boolean | string | ReadonlyArray<string>;
64
66
  // Default handling, ignore the unused value
@@ -71,4 +73,8 @@ declare module 'react-native/Libraries/Types/CodegenTypes' {
71
73
  Type extends DefaultTypes,
72
74
  Value extends Type | string | undefined | null,
73
75
  > = Type | undefined | null;
76
+
77
+ export type EventEmitter<T> = (
78
+ handler: (arg: T) => void | Promise<void>,
79
+ ) => EventSubscription;
74
80
  }