react-native-macos 0.81.8 → 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.
@@ -17,6 +17,6 @@ export const version: $ReadOnly<{
17
17
  }> = {
18
18
  major: 0,
19
19
  minor: 81,
20
- patch: 8,
20
+ patch: 9,
21
21
  prerelease: null,
22
22
  };
@@ -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
 
@@ -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
 
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(81),
26
- RCTVersionPatch: @(8),
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
@@ -964,7 +964,10 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
964
964
  [_backedTextInputView becomeFirstResponder];
965
965
  #else // [macOS
966
966
  NSWindow *window = [_backedTextInputView window];
967
- [window makeFirstResponder:_backedTextInputView];
967
+ NSResponder *responder = [_backedTextInputView respondsToSelector:@selector(responder)]
968
+ ? _backedTextInputView.responder
969
+ : (NSResponder *)_backedTextInputView;
970
+ [window makeFirstResponder:responder];
968
971
  #endif // macOS]
969
972
 
970
973
  const auto &props = static_cast<const TextInputProps &>(*_props);
@@ -994,8 +997,13 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
994
997
  if ([_backedTextInputView isKindOfClass:[NSTextField class]] &&
995
998
  [(NSTextField *)_backedTextInputView currentEditor] != nil) {
996
999
  [window makeFirstResponder:nil];
997
- } else if ([window firstResponder] == _backedTextInputView.responder) {
998
- [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
+ }
999
1007
  }
1000
1008
  #endif // macOS]
1001
1009
  }
@@ -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
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.81.8
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 8,
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 8
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 = 8;
24
+ int32_t Patch = 9;
25
25
  std::string_view Prerelease = "";
26
26
  } ReactNativeVersion;
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.81.8",
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.8",
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",