react-native-macos 0.74.20 → 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.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.mm +3 -1
- package/React/Base/RCTRootView.m +58 -0
- package/React/Base/RCTVersion.m +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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;
|
package/React/Base/RCTRootView.m
CHANGED
|
@@ -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
|
{
|
package/React/Base/RCTVersion.m
CHANGED