react-native-macos 0.75.18 → 0.75.20

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.
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 75,
19
- patch: 18,
19
+ patch: 20,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -134,7 +134,9 @@
134
134
  CGSize textViewSize = [_backedTextInputView intrinsicContentSize];
135
135
  NSClipView *clipView = (NSClipView *)_scrollView.contentView;
136
136
  if (textViewSize.height > clipView.bounds.size.height) {
137
- return YES;
137
+ // Sometimes dimensions returned are in floating point numbers.
138
+ // If the floats are close enough, then don't show the scrollbar even if there is a fraction of overflow with the text.
139
+ return fabs(textViewSize.height - clipView.bounds.size.height) >= 1;
138
140
  };
139
141
 
140
142
  return NO;
@@ -16,6 +16,7 @@
16
16
  #import "RCTBridge.h"
17
17
  #import "RCTConstants.h"
18
18
  #import "RCTDevSettings.h" // [macOS]
19
+ #import "RCTFocusChangeEvent.h" // [macOS]
19
20
  // [macOS] remove #import "RCTKeyCommands.h"
20
21
  #import "RCTLog.h"
21
22
  #import "RCTPerformanceLogger.h"
@@ -432,6 +433,63 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
432
433
  #endif // macOS]
433
434
 
434
435
 
436
+ #pragma mark - Key window blur/focus
437
+
438
+ #if TARGET_OS_OSX // [macOS
439
+ - (void)viewDidMoveToWindow {
440
+ [super viewDidMoveToWindow];
441
+
442
+ NSWindow *window = [self window];
443
+ if (window == nil) {
444
+ return;
445
+ }
446
+
447
+ [[NSNotificationCenter defaultCenter] addObserver:self
448
+ selector:@selector(containingWindowDidBecomeKey)
449
+ name:NSWindowDidBecomeKeyNotification
450
+ object:window];
451
+
452
+ [[NSNotificationCenter defaultCenter] addObserver:self
453
+ selector:@selector(containingWindowDidResignKey)
454
+ name:NSWindowDidResignKeyNotification
455
+ object:window];
456
+ }
457
+
458
+ + (NSNumber *)reactTagClosestToView:(RCTPlatformView *)view {
459
+ // The first responder may not necessarily have a React tag. For example, if we're focused on
460
+ // a multiline <TextInput>, the RN component whose blur/focus events we need to touch is an
461
+ // RCTMultilineTextInputView, but the first responder will be the underlying RCTUITextView.
462
+ for (RCTPlatformView *testView = view; testView != nil; testView = [testView superview]) {
463
+ NSNumber *reactTag = [testView reactTag];
464
+ if (reactTag != nil) {
465
+ return reactTag;
466
+ }
467
+ }
468
+ return nil;
469
+ }
470
+
471
+ - (void)containingWindowDidBecomeKey {
472
+ NSResponder *firstResponder = [[self window] firstResponder];
473
+ if ([firstResponder isKindOfClass:[RCTPlatformView class]]) {
474
+ NSNumber *reactTag = [RCTRootView reactTagClosestToView:(RCTPlatformView *)firstResponder];
475
+ if (reactTag != nil) {
476
+ [[[self bridge] eventDispatcher] sendEvent:[RCTFocusChangeEvent focusEventWithReactTag:reactTag]];
477
+ }
478
+ }
479
+ }
480
+
481
+ - (void)containingWindowDidResignKey {
482
+ NSResponder *firstResponder = [[self window] firstResponder];
483
+ if ([firstResponder isKindOfClass:[RCTPlatformView class]]) {
484
+ NSNumber *reactTag = [RCTRootView reactTagClosestToView:(RCTPlatformView *)firstResponder];
485
+ if (reactTag != nil) {
486
+ [[[self bridge] eventDispatcher] sendEvent:[RCTFocusChangeEvent blurEventWithReactTag:reactTag]];
487
+ }
488
+ }
489
+ }
490
+ #endif // macOS]
491
+
492
+
435
493
  #if TARGET_OS_OSX // [macOS
436
494
  - (NSMenu *)menuForEvent:(NSEvent *)event
437
495
  {
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(75),
26
- RCTVersionPatch: @(18),
26
+ RCTVersionPatch: @(20),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.75.18
1
+ VERSION_NAME=0.75.20
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 75,
20
- "patch", 18,
20
+ "patch", 20,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 75;
20
- int32_t Patch = 18;
20
+ int32_t Patch = 20;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.75.18",
3
+ "version": "0.75.20",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {