react-native-macos 0.74.21 → 0.74.22

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: 74,
19
- patch: 21,
19
+ patch: 22,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -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"
@@ -438,6 +439,63 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
438
439
  #endif // macOS]
439
440
 
440
441
 
442
+ #pragma mark - Key window blur/focus
443
+
444
+ #if TARGET_OS_OSX // [macOS
445
+ - (void)viewDidMoveToWindow {
446
+ [super viewDidMoveToWindow];
447
+
448
+ NSWindow *window = [self window];
449
+ if (window == nil) {
450
+ return;
451
+ }
452
+
453
+ [[NSNotificationCenter defaultCenter] addObserver:self
454
+ selector:@selector(containingWindowDidBecomeKey)
455
+ name:NSWindowDidBecomeKeyNotification
456
+ object:window];
457
+
458
+ [[NSNotificationCenter defaultCenter] addObserver:self
459
+ selector:@selector(containingWindowDidResignKey)
460
+ name:NSWindowDidResignKeyNotification
461
+ object:window];
462
+ }
463
+
464
+ + (NSNumber *)reactTagClosestToView:(RCTPlatformView *)view {
465
+ // The first responder may not necessarily have a React tag. For example, if we're focused on
466
+ // a multiline <TextInput>, the RN component whose blur/focus events we need to touch is an
467
+ // RCTMultilineTextInputView, but the first responder will be the underlying RCTUITextView.
468
+ for (RCTPlatformView *testView = view; testView != nil; testView = [testView superview]) {
469
+ NSNumber *reactTag = [testView reactTag];
470
+ if (reactTag != nil) {
471
+ return reactTag;
472
+ }
473
+ }
474
+ return nil;
475
+ }
476
+
477
+ - (void)containingWindowDidBecomeKey {
478
+ NSResponder *firstResponder = [[self window] firstResponder];
479
+ if ([firstResponder isKindOfClass:[RCTPlatformView class]]) {
480
+ NSNumber *reactTag = [RCTRootView reactTagClosestToView:(RCTPlatformView *)firstResponder];
481
+ if (reactTag != nil) {
482
+ [[[self bridge] eventDispatcher] sendEvent:[RCTFocusChangeEvent focusEventWithReactTag:reactTag]];
483
+ }
484
+ }
485
+ }
486
+
487
+ - (void)containingWindowDidResignKey {
488
+ NSResponder *firstResponder = [[self window] firstResponder];
489
+ if ([firstResponder isKindOfClass:[RCTPlatformView class]]) {
490
+ NSNumber *reactTag = [RCTRootView reactTagClosestToView:(RCTPlatformView *)firstResponder];
491
+ if (reactTag != nil) {
492
+ [[[self bridge] eventDispatcher] sendEvent:[RCTFocusChangeEvent blurEventWithReactTag:reactTag]];
493
+ }
494
+ }
495
+ }
496
+ #endif // macOS]
497
+
498
+
441
499
  #if TARGET_OS_OSX // [macOS
442
500
  - (NSMenu *)menuForEvent:(NSEvent *)event
443
501
  {
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
- RCTVersionPatch: @(21),
26
+ RCTVersionPatch: @(22),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.74.21
1
+ VERSION_NAME=0.74.22
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", 74,
20
- "patch", 21,
20
+ "patch", 22,
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 = 74;
20
- int32_t Patch = 21;
20
+ int32_t Patch = 22;
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.74.21",
3
+ "version": "0.74.22",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {