react-native-macos 0.81.7 → 0.81.9

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 (35) hide show
  1. package/Libraries/Blob/RCTBlobManager.h +0 -0
  2. package/Libraries/Blob/RCTBlobManager.mm +0 -0
  3. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/Libraries/StyleSheet/normalizeColor.js +0 -0
  6. package/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +36 -5
  7. package/Libraries/Text/TextInput/Multiline/RCTWrappedTextView.m +10 -0
  8. package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +1 -1
  9. package/React/Base/RCTJavaScriptLoader.h +0 -0
  10. package/React/Base/RCTJavaScriptLoader.mm +0 -0
  11. package/React/Base/RCTVersion.m +1 -1
  12. package/React/CoreModules/RCTDeviceInfo.mm +1 -1
  13. package/React/CxxBridge/RCTCxxBridge.mm +16 -7
  14. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +163 -3
  15. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputNativeCommands.h +20 -0
  16. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +9 -2
  17. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +3 -1
  18. package/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm +12 -0
  19. package/React/Fabric/Mounting/RCTMountingManager.mm +6 -1
  20. package/React/Views/RCTComponentData.mm +1 -1
  21. package/ReactAndroid/gradle.properties +1 -1
  22. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  23. package/ReactCommon/React-FabricComponents.podspec +19 -8
  24. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  25. package/gradle/libs.versions.toml +1 -1
  26. package/local-cli/cli.js +0 -0
  27. package/package.json +3 -3
  28. package/react-native.config.js +4 -0
  29. package/scripts/compose-source-maps.js +0 -0
  30. package/scripts/featureflags/index.js +47 -0
  31. package/scripts/find-node-for-xcode.sh +0 -0
  32. package/scripts/ios-prebuild/cli.js +136 -0
  33. package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +0 -0
  34. package/third-party-podspecs/RCT-Folly.podspec +1 -1
  35. package/third-party-podspecs/fmt.podspec +2 -2
File without changes
File without changes
@@ -17,6 +17,6 @@ export const version: $ReadOnly<{
17
17
  }> = {
18
18
  major: 0,
19
19
  minor: 81,
20
- patch: 7,
20
+ patch: 9,
21
21
  prerelease: null,
22
22
  };
File without changes
@@ -26,6 +26,7 @@
26
26
  #endif // [macOS]
27
27
  NSArray<NSString *> *_acceptDragAndDropTypes;
28
28
  #if TARGET_OS_OSX // [macOS
29
+ BOOL _enableFocusRing;
29
30
  NSArray<NSPasteboardType> *_readablePasteboardTypes;
30
31
  #endif // macOS]
31
32
  }
@@ -64,6 +65,7 @@ static RCTUIColor *defaultPlaceholderColor(void) // [macOS]
64
65
  // Fix blurry text on non-retina displays.
65
66
  self.canDrawSubviewsIntoLayer = YES;
66
67
  self.allowsUndo = YES;
68
+ _enableFocusRing = YES;
67
69
  #endif // macOS]
68
70
 
69
71
  _textInputDelegateAdapter = [[RCTBackedTextViewDelegateAdapter alloc] initWithTextView:self];
@@ -258,6 +260,26 @@ static RCTUIColor *defaultPlaceholderColor(void) // [macOS]
258
260
 
259
261
  return success;
260
262
  }
263
+
264
+ - (NSFocusRingType)focusRingType
265
+ {
266
+ return _enableFocusRing ? NSFocusRingTypeDefault : NSFocusRingTypeNone;
267
+ }
268
+
269
+ - (void)setEnableFocusRing:(BOOL)enableFocusRing
270
+ {
271
+ if (_enableFocusRing != enableFocusRing) {
272
+ _enableFocusRing = enableFocusRing;
273
+ }
274
+
275
+ [super setFocusRingType:self.focusRingType];
276
+ [self setKeyboardFocusRingNeedsDisplayInRect:self.bounds];
277
+ }
278
+
279
+ - (BOOL)enableFocusRing
280
+ {
281
+ return _enableFocusRing;
282
+ }
261
283
  #endif // macOS]
262
284
 
263
285
  - (void)setDefaultTextAttributes:(NSDictionary<NSAttributedStringKey, id> *)defaultTextAttributes
@@ -284,6 +306,7 @@ static RCTUIColor *defaultPlaceholderColor(void) // [macOS]
284
306
 
285
307
  - (void)setDisableKeyboardShortcuts:(BOOL)disableKeyboardShortcuts
286
308
  {
309
+ _disableKeyboardShortcuts = disableKeyboardShortcuts;
287
310
  #if TARGET_OS_IOS
288
311
  // Initialize the initial values only once
289
312
  if (_initialValueLeadingBarButtonGroups == nil) {
@@ -300,7 +323,6 @@ static RCTUIColor *defaultPlaceholderColor(void) // [macOS]
300
323
  self.inputAssistantItem.leadingBarButtonGroups = _initialValueLeadingBarButtonGroups;
301
324
  self.inputAssistantItem.trailingBarButtonGroups = _initialValueTrailingBarButtonGroups;
302
325
  }
303
- _disableKeyboardShortcuts = disableKeyboardShortcuts;
304
326
  #endif
305
327
  }
306
328
 
@@ -328,10 +350,19 @@ static RCTUIColor *defaultPlaceholderColor(void) // [macOS]
328
350
  #if !TARGET_OS_OSX // [macOS]
329
351
  [super setAttributedText:attributedText];
330
352
  #else // [macOS
331
- // Break undo coalescing when the text is changed by JS (e.g. autocomplete).
332
- [self breakUndoCoalescing];
333
- // Avoid Exception thrown while executing UI block: *** -[NSBigMutableString replaceCharactersInRange:withString:]: nil argument
334
- [self.textStorage setAttributedString:attributedText ?: [NSAttributedString new]];
353
+ if (self.ghostTextChanging) {
354
+ // Ghost text changes should not be on the undo stack. Disable undo
355
+ // registration around the text storage mutation so Cmd+Z skips over
356
+ // ghost text insertions/removals.
357
+ [self.undoManager disableUndoRegistration];
358
+ [self.textStorage setAttributedString:attributedText ?: [NSAttributedString new]];
359
+ [self.undoManager enableUndoRegistration];
360
+ } else {
361
+ // Break undo coalescing when the text is changed by JS (e.g. autocomplete).
362
+ [self breakUndoCoalescing];
363
+ // Avoid Exception thrown while executing UI block: *** -[NSBigMutableString replaceCharactersInRange:withString:]: nil argument
364
+ [self.textStorage setAttributedString:attributedText ?: [NSAttributedString new]];
365
+ }
335
366
  #endif // macOS]
336
367
  [self textDidChange];
337
368
  }
@@ -49,6 +49,9 @@
49
49
  _forwardingTextView.textContainer.containerSize = NSMakeSize(FLT_MAX, FLT_MAX);
50
50
  _forwardingTextView.textContainer.widthTracksTextView = YES;
51
51
  _forwardingTextView.textInputDelegate = self;
52
+ if ([_forwardingTextView respondsToSelector:@selector(setEnableFocusRing:)]) {
53
+ [_forwardingTextView setEnableFocusRing:YES];
54
+ }
52
55
 
53
56
  _scrollView.documentView = _forwardingTextView;
54
57
  _scrollView.contentView.postsBoundsChangedNotifications = YES;
@@ -197,12 +200,19 @@
197
200
 
198
201
  - (BOOL)enableFocusRing
199
202
  {
203
+ if ([_forwardingTextView respondsToSelector:@selector(enableFocusRing)]) {
204
+ return [_forwardingTextView enableFocusRing];
205
+ }
206
+
200
207
  return _scrollView.enableFocusRing;
201
208
  }
202
209
 
203
210
  - (void)setEnableFocusRing:(BOOL)enableFocusRing
204
211
  {
205
212
  _scrollView.enableFocusRing = enableFocusRing;
213
+ if ([_forwardingTextView respondsToSelector:@selector(setEnableFocusRing:)]) {
214
+ [_forwardingTextView setEnableFocusRing:enableFocusRing];
215
+ }
206
216
  }
207
217
 
208
218
  @end
@@ -423,6 +423,7 @@
423
423
 
424
424
  - (void)setDisableKeyboardShortcuts:(BOOL)disableKeyboardShortcuts
425
425
  {
426
+ _disableKeyboardShortcuts = disableKeyboardShortcuts;
426
427
  #if TARGET_OS_IOS
427
428
  // Initialize the initial values only once
428
429
  if (_initialValueLeadingBarButtonGroups == nil) {
@@ -439,7 +440,6 @@
439
440
  self.inputAssistantItem.leadingBarButtonGroups = _initialValueLeadingBarButtonGroups;
440
441
  self.inputAssistantItem.trailingBarButtonGroups = _initialValueTrailingBarButtonGroups;
441
442
  }
442
- _disableKeyboardShortcuts = disableKeyboardShortcuts;
443
443
  #endif
444
444
  }
445
445
 
File without changes
File without changes
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(81),
26
- RCTVersionPatch: @(7),
26
+ RCTVersionPatch: @(9),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -84,7 +84,7 @@ RCT_EXPORT_MODULE()
84
84
 
85
85
  _currentInterfaceDimensions = [self _exportedDimensions];
86
86
 
87
- #if !TARGET_OS_OSX // [macOS]
87
+ #if TARGET_OS_IOS // [macOS] [visionOS]
88
88
  [[NSNotificationCenter defaultCenter] addObserver:self
89
89
  selector:@selector(interfaceOrientationDidChange)
90
90
  name:UIApplicationDidBecomeActiveNotification
@@ -1115,12 +1115,12 @@ struct RCTInstanceCallback : public InstanceCallback {
1115
1115
  _valid = NO;
1116
1116
  _moduleRegistryCreated = NO;
1117
1117
 
1118
- dispatch_async(dispatch_get_main_queue(), ^{
1119
- if (self->_jsMessageThread) {
1120
- // Make sure initializeBridge completed
1121
- self->_jsMessageThread->runOnQueueSync([] {});
1122
- }
1123
-
1118
+ // [macOS
1119
+ // The JS thread may be waiting on the main thread to finish initializing so
1120
+ // we cannot call `_jsMessageThread->runOnQueueSync()` here without causing a
1121
+ // deadlock. We haven't upstreamed this fix because as of writing, 0.87.0-rc.0
1122
+ // is out and old arch is deprecated.
1123
+ void (^postFailToLoadNotification)(void) = ^{
1124
1124
  self->_reactInstance.reset();
1125
1125
  self->_jsMessageThread.reset();
1126
1126
 
@@ -1133,7 +1133,16 @@ struct RCTInstanceCallback : public InstanceCallback {
1133
1133
  }
1134
1134
 
1135
1135
  RCTFatal(error);
1136
- });
1136
+ };
1137
+
1138
+ if (self->_jsMessageThread) {
1139
+ // Make sure initializeBridge completed
1140
+ self->_jsMessageThread->runOnQueue(
1141
+ [postFailToLoadNotification] { dispatch_async(dispatch_get_main_queue(), postFailToLoadNotification); });
1142
+ } else {
1143
+ dispatch_async(dispatch_get_main_queue(), postFailToLoadNotification);
1144
+ }
1145
+ // macOS]
1137
1146
  }
1138
1147
 
1139
1148
  RCT_NOT_IMPLEMENTED(-(instancetype)initWithDelegate
@@ -103,6 +103,10 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
103
103
 
104
104
  BOOL _hasInputAccessoryView;
105
105
  CGSize _previousContentSize;
106
+ #if TARGET_OS_OSX // [macOS
107
+ NSString *_ghostText;
108
+ NSInteger _ghostTextPosition;
109
+ #endif // macOS]
106
110
  }
107
111
 
108
112
  #pragma mark - UIView overrides
@@ -514,6 +518,10 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
514
518
  _lastStringStateWasUpdatedWith = nil;
515
519
  _ignoreNextTextInputCall = NO;
516
520
  _didMoveToWindow = NO;
521
+ #if TARGET_OS_OSX // [macOS
522
+ _ghostText = nil;
523
+ _ghostTextPosition = 0;
524
+ #endif // macOS]
517
525
  [_backedTextInputView resignFirstResponder];
518
526
  }
519
527
 
@@ -538,6 +546,10 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
538
546
 
539
547
  - (void)textInputDidEndEditing
540
548
  {
549
+ #if TARGET_OS_OSX // [macOS
550
+ [self setGhostText:nil];
551
+ #endif // macOS]
552
+
541
553
  if (_eventEmitter) {
542
554
  static_cast<const TextInputEventEmitter &>(*_eventEmitter).onEndEditing([self _textInputMetrics]);
543
555
  static_cast<const TextInputEventEmitter &>(*_eventEmitter).onBlur([self _textInputMetrics]);
@@ -572,6 +584,12 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
572
584
 
573
585
  - (NSString *)textInputShouldChangeText:(NSString *)text inRange:(NSRange)range
574
586
  {
587
+ #if TARGET_OS_OSX // [macOS
588
+ // Clear ghost text before the text change so the undo manager's snapshot
589
+ // of the pre-edit state never contains ghost text.
590
+ [self setGhostText:nil];
591
+ #endif // macOS]
592
+
575
593
  const auto &props = static_cast<const TextInputProps &>(*_props);
576
594
 
577
595
  if (!_backedTextInputView.textWasPasted) {
@@ -617,6 +635,17 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
617
635
  return;
618
636
  }
619
637
 
638
+ #if TARGET_OS_OSX // [macOS
639
+ if (_ghostText != nil) {
640
+ NSAttributedString *attributedStringWithoutGhostText = [self removingGhostTextFromString:_backedTextInputView.attributedText strict:NO];
641
+ if (attributedStringWithoutGhostText != nil && ![attributedStringWithoutGhostText isEqual:_backedTextInputView.attributedText]) {
642
+ _backedTextInputView.attributedText = attributedStringWithoutGhostText;
643
+ }
644
+ _ghostText = nil;
645
+ _ghostTextPosition = 0;
646
+ }
647
+ #endif // macOS]
648
+
620
649
  if (_ignoreNextTextInputCall && [_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
621
650
  _ignoreNextTextInputCall = NO;
622
651
  return;
@@ -632,6 +661,14 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
632
661
 
633
662
  - (void)textInputDidChangeSelection
634
663
  {
664
+ #if TARGET_OS_OSX // [macOS
665
+ // Clear ghost text on any user selection change, matching Paper behavior.
666
+ // This prevents the user from selecting ghost text.
667
+ if (_ghostText != nil && !_comingFromJS && !_backedTextInputView.ghostTextChanging) {
668
+ [self setGhostText:nil];
669
+ }
670
+ #endif // macOS]
671
+
635
672
  if (_comingFromJS) {
636
673
  return;
637
674
  }
@@ -805,6 +842,115 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
805
842
  }
806
843
  }
807
844
 
845
+ #if TARGET_OS_OSX // [macOS
846
+ #pragma mark - Ghost Text
847
+
848
+ - (NSDictionary<NSAttributedStringKey, id> *)ghostTextAttributes
849
+ {
850
+ NSMutableDictionary<NSAttributedStringKey, id> *textAttributes =
851
+ [_backedTextInputView.defaultTextAttributes mutableCopy] ?: [NSMutableDictionary new];
852
+
853
+ [textAttributes setValue:_backedTextInputView.placeholderColor ?: [RCTPlatformColor placeholderTextColor]
854
+ forKey:NSForegroundColorAttributeName];
855
+
856
+ return textAttributes;
857
+ }
858
+
859
+ - (void)setGhostText:(NSString *)ghostText
860
+ {
861
+ NSRange selectedRange = [_backedTextInputView selectedTextRange];
862
+ NSInteger selectionStart = selectedRange.location;
863
+ NSInteger selectionEnd = selectedRange.location + selectedRange.length;
864
+ NSString *newGhostText = ghostText.length > 0 ? ghostText : nil;
865
+
866
+ if (selectionStart != selectionEnd) {
867
+ newGhostText = nil;
868
+ }
869
+
870
+ if ((_ghostText == nil && newGhostText == nil) || [_ghostText isEqual:newGhostText]) {
871
+ return;
872
+ }
873
+
874
+ if (_backedTextInputView.ghostTextChanging) {
875
+ // look out for nested callbacks -- this can happen for example when selection changes in response to
876
+ // attributed text changing. Such callbacks are initiated by Apple, or we could suppress this other ways.
877
+ return;
878
+ }
879
+
880
+ _backedTextInputView.ghostTextChanging = YES;
881
+
882
+ if (_ghostText != nil) {
883
+ // When setGhostText: is called after making a standard edit, the ghost text may already be gone
884
+ BOOL ghostTextMayAlreadyBeGone = newGhostText == nil;
885
+ NSAttributedString *attributedStringWithoutGhostText = [self removingGhostTextFromString:_backedTextInputView.attributedText strict:!ghostTextMayAlreadyBeGone];
886
+
887
+ if (attributedStringWithoutGhostText != nil) {
888
+ _backedTextInputView.attributedText = attributedStringWithoutGhostText;
889
+ [_backedTextInputView setSelectedTextRange:NSMakeRange(selectionStart, selectionEnd - selectionStart) notifyDelegate:NO];
890
+ }
891
+ }
892
+
893
+ _ghostText = [newGhostText copy];
894
+ _ghostTextPosition = selectionStart;
895
+
896
+ if (_ghostText != nil) {
897
+ NSMutableAttributedString *attributedString = [_backedTextInputView.attributedText mutableCopy];
898
+ NSAttributedString *ghostAttributedString = [[NSAttributedString alloc] initWithString:_ghostText
899
+ attributes:self.ghostTextAttributes];
900
+
901
+ [attributedString insertAttributedString:ghostAttributedString atIndex:_ghostTextPosition];
902
+ _backedTextInputView.attributedText = attributedString;
903
+ [_backedTextInputView setSelectedTextRange:NSMakeRange(_ghostTextPosition, 0) notifyDelegate:NO];
904
+ }
905
+
906
+ _backedTextInputView.ghostTextChanging = NO;
907
+ }
908
+
909
+ /**
910
+ * Attempts to remove the ghost text from a provided string given our current state.
911
+ *
912
+ * If `strict` mode is enabled, this method assumes the ghost text exists exactly
913
+ * where we expect it to be. We assert and return `nil` if we don't find the expected ghost text.
914
+ * It's the responsibility of the caller to make sure the result isn't `nil`.
915
+ *
916
+ * If disabled, we allow for the possibility that the ghost text has already been removed,
917
+ * which can happen if a delegate callback is trying to remove ghost text after invoking `setAttributedText:`.
918
+ */
919
+ - (NSAttributedString *)removingGhostTextFromString:(NSAttributedString *)string strict:(BOOL)strict
920
+ {
921
+ if (_ghostText == nil) {
922
+ return string;
923
+ }
924
+
925
+ NSRange ghostTextRange = NSMakeRange(_ghostTextPosition, _ghostText.length);
926
+ NSMutableAttributedString *attributedString = [string mutableCopy];
927
+
928
+ if ([attributedString length] < NSMaxRange(ghostTextRange)) {
929
+ if (strict) {
930
+ RCTAssert(false, @"Ghost text not fully present in text view text");
931
+ return nil;
932
+ } else {
933
+ return string;
934
+ }
935
+ }
936
+
937
+ NSString *actualGhostText = [[attributedString attributedSubstringFromRange:ghostTextRange] string];
938
+
939
+ if (![actualGhostText isEqual:_ghostText]) {
940
+ if (strict) {
941
+ RCTAssert(false, @"Ghost text does not match text view text");
942
+ return nil;
943
+ } else {
944
+ return string;
945
+ }
946
+ }
947
+
948
+ [attributedString deleteCharactersInRange:ghostTextRange];
949
+ return attributedString;
950
+ }
951
+
952
+ #endif // macOS]
953
+
808
954
  #pragma mark - Native Commands
809
955
 
810
956
  - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
@@ -818,7 +964,10 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
818
964
  [_backedTextInputView becomeFirstResponder];
819
965
  #else // [macOS
820
966
  NSWindow *window = [_backedTextInputView window];
821
- [window makeFirstResponder:_backedTextInputView];
967
+ NSResponder *responder = [_backedTextInputView respondsToSelector:@selector(responder)]
968
+ ? _backedTextInputView.responder
969
+ : (NSResponder *)_backedTextInputView;
970
+ [window makeFirstResponder:responder];
822
971
  #endif // macOS]
823
972
 
824
973
  const auto &props = static_cast<const TextInputProps &>(*_props);
@@ -842,8 +991,19 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
842
991
  [_backedTextInputView resignFirstResponder];
843
992
  #else // [macOS
844
993
  NSWindow *window = [_backedTextInputView window];
845
- if ([window firstResponder] == _backedTextInputView.responder) {
994
+ // On macOS, when an NSTextField is focused, the window's firstResponder is the
995
+ // field editor (an NSTextView), not the text field itself. Check currentEditor
996
+ // to determine if the text field is actively being edited.
997
+ if ([_backedTextInputView isKindOfClass:[NSTextField class]] &&
998
+ [(NSTextField *)_backedTextInputView currentEditor] != nil) {
846
999
  [window makeFirstResponder:nil];
1000
+ } else {
1001
+ NSResponder *responder = [_backedTextInputView respondsToSelector:@selector(responder)]
1002
+ ? _backedTextInputView.responder
1003
+ : (NSResponder *)_backedTextInputView;
1004
+ if ([window firstResponder] == responder) {
1005
+ [window makeFirstResponder:nil];
1006
+ }
847
1007
  }
848
1008
  #endif // macOS]
849
1009
  }
@@ -881,7 +1041,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
881
1041
  #else // [macOS
882
1042
  NSInteger startPosition = MIN(start, end);
883
1043
  NSInteger endPosition = MAX(start, end);
884
- [_backedTextInputView setSelectedTextRange:NSMakeRange(startPosition, endPosition - startPosition) notifyDelegate:YES];
1044
+ [_backedTextInputView setSelectedTextRange:NSMakeRange(startPosition, endPosition - startPosition) notifyDelegate:NO];
885
1045
  #endif // macOS]
886
1046
  _comingFromJS = NO;
887
1047
  }
@@ -18,6 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
18
18
  value:(NSString *__nullable)value
19
19
  start:(NSInteger)start
20
20
  end:(NSInteger)end;
21
+ #if TARGET_OS_OSX // [macOS
22
+ - (void)setGhostText:(NSString *__nullable)ghostText;
23
+ #endif // macOS]
21
24
  @end
22
25
 
23
26
  RCT_EXTERN inline void
@@ -96,6 +99,23 @@ RCTTextInputHandleCommand(id<RCTTextInputViewProtocol> componentView, const NSSt
96
99
  return;
97
100
  }
98
101
 
102
+ #if TARGET_OS_OSX // [macOS
103
+ if ([commandName isEqualToString:@"setGhostText"]) {
104
+ #if RCT_DEBUG
105
+ if ([args count] != 1) {
106
+ RCTLogError(
107
+ @"%@ command %@ received %d arguments, expected %d.", @"TextInput", commandName, (int)[args count], 1);
108
+ return;
109
+ }
110
+ #endif
111
+
112
+ NSObject *arg0 = args[0];
113
+ NSString *value = [arg0 isKindOfClass:[NSNull class]] ? nil : (NSString *)arg0;
114
+ [componentView setGhostText:value];
115
+ return;
116
+ }
117
+ #endif // macOS]
118
+
99
119
  #if RCT_DEBUG
100
120
  RCTLogError(@"%@ received command %@, which is not a supported command.", @"TextInput", commandName);
101
121
  #endif
@@ -58,16 +58,23 @@ void RCTCopyBackedTextInput(
58
58
  toTextInput.clearButtonMode = fromTextInput.clearButtonMode;
59
59
  #endif // [macOS]
60
60
  toTextInput.scrollEnabled = fromTextInput.scrollEnabled;
61
+ toTextInput.disableKeyboardShortcuts = fromTextInput.disableKeyboardShortcuts;
62
+ toTextInput.acceptDragAndDropTypes = fromTextInput.acceptDragAndDropTypes;
61
63
  #if !TARGET_OS_OSX // [macOS]
62
64
  toTextInput.secureTextEntry = fromTextInput.secureTextEntry;
63
65
  toTextInput.keyboardType = fromTextInput.keyboardType;
64
66
  toTextInput.textContentType = fromTextInput.textContentType;
65
67
  toTextInput.smartInsertDeleteType = fromTextInput.smartInsertDeleteType;
66
68
  toTextInput.passwordRules = fromTextInput.passwordRules;
67
- toTextInput.disableKeyboardShortcuts = fromTextInput.disableKeyboardShortcuts;
68
- toTextInput.acceptDragAndDropTypes = fromTextInput.acceptDragAndDropTypes;
69
69
 
70
70
  [toTextInput setSelectedTextRange:fromTextInput.selectedTextRange notifyDelegate:NO];
71
+ #else // [macOS]
72
+ toTextInput.enableFocusRing = fromTextInput.enableFocusRing;
73
+ toTextInput.pointScaleFactor = fromTextInput.pointScaleFactor;
74
+ toTextInput.automaticSpellingCorrectionEnabled = fromTextInput.automaticSpellingCorrectionEnabled;
75
+ toTextInput.grammarCheckingEnabled = fromTextInput.grammarCheckingEnabled;
76
+ toTextInput.continuousSpellCheckingEnabled = fromTextInput.continuousSpellCheckingEnabled;
77
+ [toTextInput setSelectedTextRange:[fromTextInput selectedTextRange] notifyDelegate:NO];
71
78
  #endif // [macOS]
72
79
  }
73
80
 
@@ -1762,7 +1762,9 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // [macOS]
1762
1762
 
1763
1763
  - (void)blur
1764
1764
  {
1765
- [[self window] resignFirstResponder];
1765
+ if ([[self window] firstResponder] == self) {
1766
+ [[self window] makeFirstResponder:nil];
1767
+ }
1766
1768
  }
1767
1769
 
1768
1770
  - (BOOL)needsPanelToBecomeKey
@@ -171,6 +171,18 @@ static BOOL sIsAccessibilityUsed = NO;
171
171
  [self _unhideIfNeeded];
172
172
  return [super accessibilityChildren];
173
173
  }
174
+
175
+ - (BOOL)acceptsFirstResponder
176
+ {
177
+ [self _unhideIfNeeded];
178
+ return [super acceptsFirstResponder];
179
+ }
180
+
181
+ - (id)accessibilityHitTest:(NSPoint)point
182
+ {
183
+ [self _unhideIfNeeded];
184
+ return [super accessibilityHitTest:point];
185
+ }
174
186
  #endif // macOS]
175
187
 
176
188
  - (void)prepareForRecycle
@@ -346,7 +346,12 @@ static void RCTPerformMountInstructions(
346
346
  RCTUIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // [macOS]
347
347
  #if !TARGET_OS_OSX // [macOS]
348
348
  UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, componentView);
349
- #endif // [macOS]
349
+ #else // [macOS
350
+ if (componentView != nil) {
351
+ [[componentView window] makeFirstResponder:componentView];
352
+ NSAccessibilityPostNotification(componentView, NSAccessibilityFocusedUIElementChangedNotification);
353
+ }
354
+ #endif // macOS]
350
355
  }
351
356
  }
352
357
 
@@ -286,7 +286,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
286
286
  #define RCT_CASE(_value, _type) \
287
287
  case _value: { \
288
288
  __block BOOL setDefaultValue = NO; \
289
- __block _type defaultValue; \
289
+ __block _type defaultValue{}; /*[macOS]*/ \
290
290
  _type (*convert)(id, SEL, id) = (__typeof(convert))objc_msgSend; \
291
291
  _type (*get)(id, SEL) = (__typeof(get))objc_msgSend; \
292
292
  void (*set)(id, SEL, _type) = (__typeof(set))objc_msgSend; \
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.81.7
1
+ VERSION_NAME=0.81.9
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -14,7 +14,7 @@ public object ReactNativeVersion {
14
14
  public val VERSION: Map<String, Any?> = mapOf(
15
15
  "major" to 0,
16
16
  "minor" to 81,
17
- "patch" to 7,
17
+ "patch" to 9,
18
18
  "prerelease" to null
19
19
  )
20
20
  }
@@ -99,14 +99,25 @@ Pod::Spec.new do |s|
99
99
  sss.header_dir = "react/renderer/components/safeareaview"
100
100
  end
101
101
 
102
- ss.subspec "scrollview" do |sss|
103
- sss.source_files = podspec_sources(["react/renderer/components/scrollview/*.{m,mm,cpp,h}",
104
- "react/renderer/components/scrollview/platform/cxx/**/*.{m,mm,cpp,h}"],
105
- ["react/renderer/components/scrollview/*.h",
106
- "react/renderer/components/scrollview/platform/cxx/**/*.h"])
107
- sss.exclude_files = "react/renderer/components/scrollview/tests"
108
- sss.header_dir = "react/renderer/components/scrollview"
109
- end
102
+ # [macOS The "scrollview" subspec below duplicates source_files already declared in
103
+ # React-Fabric.podspec's "scrollview" subspec (which uses a recursive
104
+ # `react/renderer/components/scrollview/**/*` glob). The overlap causes
105
+ # ScrollViewShadowNode.cpp and friends to be compiled into both the
106
+ # React-Fabric and React-FabricComponents Pods targets, breaking consumers
107
+ # that link both libraries via `-all_load` (duplicate symbols). Comment it
108
+ # out here so scrollview is only built into React-Fabric -- where
109
+ # React-Fabric's mounting/internal/CullingContext.cpp already needs
110
+ # ScrollViewShadowNode anyway.
111
+ #
112
+ # ss.subspec "scrollview" do |sss|
113
+ # sss.source_files = podspec_sources(["react/renderer/components/scrollview/*.{m,mm,cpp,h}",
114
+ # "react/renderer/components/scrollview/platform/cxx/**/*.{m,mm,cpp,h}"],
115
+ # ["react/renderer/components/scrollview/*.h",
116
+ # "react/renderer/components/scrollview/platform/cxx/**/*.h"])
117
+ # sss.exclude_files = "react/renderer/components/scrollview/tests"
118
+ # sss.header_dir = "react/renderer/components/scrollview"
119
+ # end
120
+ # macOS]
110
121
 
111
122
  ss.subspec "text" do |sss|
112
123
  sss.source_files = podspec_sources(["react/renderer/components/text/*.{m,mm,cpp,h}",
@@ -14,14 +14,14 @@
14
14
 
15
15
  #define REACT_NATIVE_VERSION_MAJOR 0
16
16
  #define REACT_NATIVE_VERSION_MINOR 81
17
- #define REACT_NATIVE_VERSION_PATCH 7
17
+ #define REACT_NATIVE_VERSION_PATCH 9
18
18
 
19
19
  namespace facebook::react {
20
20
 
21
21
  constexpr struct {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 81;
24
- int32_t Patch = 7;
24
+ int32_t Patch = 9;
25
25
  std::string_view Prerelease = "";
26
26
  } ReactNativeVersion;
27
27
 
@@ -43,7 +43,7 @@ yoga-proguard-annotations = "1.19.0"
43
43
  boost="1_83_0"
44
44
  doubleconversion="1.1.6"
45
45
  fastFloat="8.0.0"
46
- fmt="11.0.2"
46
+ fmt="12.1.0" # [macOS]
47
47
  folly="2024.11.18.00"
48
48
  glog="0.3.5"
49
49
  gflags="2.2.0"
package/local-cli/cli.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.81.7",
3
+ "version": "0.81.9",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -187,7 +187,7 @@
187
187
  },
188
188
  "dependencies": {
189
189
  "@jest/create-cache-key-function": "^29.7.0",
190
- "@react-native-macos/virtualized-lists": "0.81.7",
190
+ "@react-native-macos/virtualized-lists": "0.81.9",
191
191
  "@react-native/assets-registry": "0.81.6",
192
192
  "@react-native/codegen": "0.81.6",
193
193
  "@react-native/community-cli-plugin": "0.81.6",
@@ -253,4 +253,4 @@
253
253
  }
254
254
  ]
255
255
  }
256
- }
256
+ }
@@ -71,8 +71,12 @@ try {
71
71
  // [macOS
72
72
  let apple;
73
73
  try {
74
+ const iosPath = require.resolve('@react-native-community/cli-platform-ios', {
75
+ paths: [process.cwd()],
76
+ });
74
77
  apple = findCommunityPlatformPackage(
75
78
  '@react-native-community/cli-platform-apple',
79
+ iosPath,
76
80
  );
77
81
  } catch {
78
82
  if (verbose) {
File without changes
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ if (require.main === module) {
12
+ require('../../../../scripts/babel-register').registerForMonorepo();
13
+
14
+ let command;
15
+
16
+ if (process.argv.includes('--update')) {
17
+ command = 'update';
18
+ } else if (process.argv.includes('--verify-unchanged')) {
19
+ command = 'verify-unchanged';
20
+ } else if (process.argv.includes('--print')) {
21
+ command = 'print';
22
+ } else if (process.argv.includes('--help')) {
23
+ command = 'help';
24
+ } else {
25
+ console.log('Defaulting to `--update`. See all options using `--help`.');
26
+ command = 'update';
27
+ }
28
+
29
+ switch (command) {
30
+ case 'update':
31
+ require('./update').default(false);
32
+ break;
33
+ case 'verify-unchanged':
34
+ require('./update').default(true);
35
+ break;
36
+ case 'print':
37
+ require('./print').default(process.argv.includes('--json'));
38
+ break;
39
+ case 'help':
40
+ console.log(
41
+ 'Usage: node featureflags.js [--update|--verify-unchanged|--print|--help]',
42
+ );
43
+ break;
44
+ default:
45
+ throw new Error('Unexpected script execution.');
46
+ }
47
+ }
File without changes
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ * @format
9
+ */
10
+
11
+ const yargs = require('yargs');
12
+
13
+ /*::
14
+ import type {BuildFlavor, Destination, Platform} from './types';
15
+ */
16
+
17
+ const platforms /*: $ReadOnlyArray<Platform> */ = [
18
+ 'ios',
19
+ 'ios-simulator',
20
+ 'mac-catalyst',
21
+ 'macos', // [macOS]
22
+ 'visionos', // [macOS]
23
+ 'visionos-simulator', // [macOS]
24
+ ];
25
+
26
+ // CI can't use commas in cache keys, so 'macOS,variant=Mac Catalyst' was creating troubles
27
+ // This map that converts from platforms to valid Xcodebuild destinations.
28
+ const platformToDestination /*: $ReadOnly<{|[Platform]: Destination|}> */ = {
29
+ ios: 'iOS',
30
+ 'ios-simulator': 'iOS Simulator',
31
+ 'mac-catalyst': 'macOS,variant=Mac Catalyst',
32
+ macos: 'macOS', // [macOS]
33
+ visionos: 'visionOS', // [macOS]
34
+ 'visionos-simulator': 'visionOS Simulator', // [macOS]
35
+ };
36
+
37
+ const cli = yargs
38
+ .usage(
39
+ 'This script prepares iOS prebuilds for React Native. It downloads the dependencies, prepare them, builds them and creates the XCFrameworks.' +
40
+ 'Calling the script with no options will build all the dependencies for all the slices and configurations.',
41
+ )
42
+ .option('setup', {
43
+ alias: 's',
44
+ type: 'boolean',
45
+ describe: 'Download and setup dependencies',
46
+ })
47
+ .option('build', {
48
+ alias: 'b',
49
+ type: 'boolean',
50
+ describe: 'Build dependencies/platforms',
51
+ })
52
+ .option('compose', {
53
+ alias: 'c',
54
+ type: 'boolean',
55
+ describe: 'Compose xcframework from built dependencies',
56
+ })
57
+ .option('platforms', {
58
+ alias: 'p',
59
+ type: 'array',
60
+ default: platforms,
61
+ describe: 'Specify one or more platforms to build for',
62
+ })
63
+ .option('flavor', {
64
+ alias: 'f',
65
+ type: 'string',
66
+ describe: 'Specify the flavor to build, Debug (default) or Release.',
67
+ default: 'Debug',
68
+ })
69
+ .option('identity', {
70
+ alias: 'i',
71
+ type: 'string',
72
+ describe:
73
+ 'Specify the code signing identity to use for signing the frameworks.',
74
+ })
75
+ .help();
76
+
77
+ /**
78
+ * Returns the tasks that need to be run based on the command line arguments
79
+ */
80
+ async function getCLIConfiguration() /*: Promise<?{|
81
+ tasks: {|
82
+ setup: boolean,
83
+ build: boolean,
84
+ compose: boolean,
85
+ |},
86
+ flavor: BuildFlavor,
87
+ destinations: $ReadOnlyArray<Destination>,
88
+ identity: ?string,
89
+ |}> */ {
90
+ // Run input parsing
91
+ const argv = await cli.argv;
92
+
93
+ // Verify that the platforms argument is valid
94
+ const platformArray = Array.isArray(argv.platforms)
95
+ ? argv.platforms
96
+ : [argv.platforms];
97
+ const invalidPlatforms = platformArray.filter(rs => !platforms.includes(rs));
98
+
99
+ if (invalidPlatforms.length > 0) {
100
+ console.error(
101
+ `Invalid platform specified: ${invalidPlatforms.join(', ')}\nValid platforms are: ${platforms.join(', ')}`,
102
+ );
103
+ return undefined;
104
+ }
105
+
106
+ // Prepare platforms and dependencies
107
+ const resolvedPlatforms = platforms
108
+ .filter(p => argv.platforms.includes(p))
109
+ .map(p => platformToDestination[p]);
110
+
111
+ // Validate flavor
112
+ const flavor = argv.flavor;
113
+ if (flavor !== 'Debug' && flavor !== 'Release') {
114
+ console.error(
115
+ `Invalid flavor specified: ${flavor}\nValid flavors are: Debug, Release`,
116
+ );
117
+ return undefined;
118
+ }
119
+
120
+ // Are we running all commands?
121
+ const runAllCommands =
122
+ argv.setup == null && argv.build == null && argv.compose == null;
123
+
124
+ return {
125
+ tasks: {
126
+ setup: runAllCommands || argv.setup != null,
127
+ build: runAllCommands || argv.build != null,
128
+ compose: runAllCommands || argv.compose != null,
129
+ },
130
+ flavor: flavor,
131
+ destinations: resolvedPlatforms,
132
+ identity: argv.identity,
133
+ };
134
+ }
135
+
136
+ module.exports = {getCLIConfiguration};
@@ -25,7 +25,7 @@ Pod::Spec.new do |spec|
25
25
  spec.dependency "DoubleConversion"
26
26
  spec.dependency "glog"
27
27
  spec.dependency "fast_float", "8.0.0"
28
- spec.dependency "fmt", "11.0.2"
28
+ spec.dependency "fmt", "12.1.0" # [macOS]
29
29
  spec.compiler_flags = '-Wno-documentation -faligned-new'
30
30
  spec.source_files = 'folly/String.cpp',
31
31
  'folly/Conv.cpp',
@@ -8,14 +8,14 @@ fmt_git_url = fmt_config[:git]
8
8
 
9
9
  Pod::Spec.new do |spec|
10
10
  spec.name = "fmt"
11
- spec.version = "11.0.2"
11
+ spec.version = "12.1.0" # [macOS]
12
12
  spec.license = { :type => "MIT" }
13
13
  spec.homepage = "https://github.com/fmtlib/fmt"
14
14
  spec.summary = "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams."
15
15
  spec.authors = "The fmt contributors"
16
16
  spec.source = {
17
17
  :git => fmt_git_url,
18
- :tag => "11.0.2"
18
+ :tag => "12.1.0" # [macOS]
19
19
  }
20
20
  spec.pod_target_xcconfig = {
21
21
  "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),