react-native-macos 0.73.33 → 0.73.35
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/RCTBaseTextInputView.mm +20 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +18 -2
- 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
|
@@ -36,6 +36,9 @@ static const CGFloat kSingleLineKeyboardBottomOffset = 15.0;
|
|
|
36
36
|
BOOL _hasInputAccessoryView;
|
|
37
37
|
// [macOS] remove explicit _predictedText ivar declaration
|
|
38
38
|
BOOL _didMoveToWindow;
|
|
39
|
+
#if TARGET_OS_OSX // [macOS avoids duplicating effects of textInputDid(Begin|End)Editing calls
|
|
40
|
+
BOOL _isCurrentlyEditing;
|
|
41
|
+
#endif // macOS]
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
#if !TARGET_OS_OSX // [macOS]
|
|
@@ -71,6 +74,9 @@ static const CGFloat kSingleLineKeyboardBottomOffset = 15.0;
|
|
|
71
74
|
if (self = [super initWithEventDispatcher:bridge.eventDispatcher]) { // [macOS]
|
|
72
75
|
_bridge = bridge;
|
|
73
76
|
_eventDispatcher = bridge.eventDispatcher;
|
|
77
|
+
#if TARGET_OS_OSX // [macOS
|
|
78
|
+
_isCurrentlyEditing = NO;
|
|
79
|
+
#endif // macOS]
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
return self;
|
|
@@ -446,6 +452,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
|
|
|
446
452
|
|
|
447
453
|
- (void)textInputDidBeginEditing
|
|
448
454
|
{
|
|
455
|
+
#if TARGET_OS_OSX // [macOS consolidate duplicate callbacks
|
|
456
|
+
if (_isCurrentlyEditing) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
_isCurrentlyEditing = YES;
|
|
460
|
+
#endif // macOS]
|
|
461
|
+
|
|
449
462
|
if (_clearTextOnFocus) {
|
|
450
463
|
self.backedTextInputView.attributedText = [NSAttributedString new];
|
|
451
464
|
}
|
|
@@ -474,6 +487,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
|
|
|
474
487
|
|
|
475
488
|
- (void)textInputDidEndEditing
|
|
476
489
|
{
|
|
490
|
+
#if TARGET_OS_OSX // [macOS consolidate duplicate callbacks
|
|
491
|
+
if (!_isCurrentlyEditing) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
_isCurrentlyEditing = NO;
|
|
495
|
+
#endif // macOS]
|
|
496
|
+
|
|
477
497
|
self.ghostText = nil; // [macOS]
|
|
478
498
|
|
|
479
499
|
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeEnd
|
|
@@ -93,6 +93,9 @@
|
|
|
93
93
|
#endif
|
|
94
94
|
RCTBackedTextFieldDelegateAdapter *_textInputDelegateAdapter;
|
|
95
95
|
NSDictionary<NSAttributedStringKey, id> *_defaultTextAttributes;
|
|
96
|
+
#if TARGET_OS_OSX // [macOS
|
|
97
|
+
BOOL _isUpdatingPlaceholderText;
|
|
98
|
+
#endif // macOS]
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
#if TARGET_OS_OSX // [macOS
|
|
@@ -116,6 +119,9 @@
|
|
|
116
119
|
|
|
117
120
|
_textInputDelegateAdapter = [[RCTBackedTextFieldDelegateAdapter alloc] initWithTextField:self];
|
|
118
121
|
_scrollEnabled = YES;
|
|
122
|
+
#if TARGET_OS_OSX // [macOS
|
|
123
|
+
_isUpdatingPlaceholderText = NO;
|
|
124
|
+
#endif // macOS]
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
return self;
|
|
@@ -361,8 +367,11 @@
|
|
|
361
367
|
self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder ?: @""
|
|
362
368
|
attributes:[self _placeholderTextAttributes]];
|
|
363
369
|
#else // [macOS
|
|
370
|
+
// Set _isUpdatingPlaceholderText to manually suppress RCTUITextFieldDelegate's textFieldEndEditing
|
|
371
|
+
_isUpdatingPlaceholderText = YES;
|
|
364
372
|
self.placeholderAttributedString = [[NSAttributedString alloc] initWithString:self.placeholder ?: @""
|
|
365
373
|
attributes:[self _placeholderTextAttributes]];
|
|
374
|
+
_isUpdatingPlaceholderText = NO;
|
|
366
375
|
#endif // macOS]
|
|
367
376
|
}
|
|
368
377
|
|
|
@@ -485,10 +494,17 @@
|
|
|
485
494
|
[delegate textFieldDidChange:self];
|
|
486
495
|
}
|
|
487
496
|
}
|
|
488
|
-
|
|
497
|
+
|
|
489
498
|
- (void)textDidEndEditing:(NSNotification *)notification
|
|
490
499
|
{
|
|
491
|
-
[super textDidEndEditing:notification];
|
|
500
|
+
[super textDidEndEditing:notification];
|
|
501
|
+
|
|
502
|
+
// On macOS, setting placeholderAttributedString causes AppKit to call textDidEndEditing.
|
|
503
|
+
// We don't want this to propagate or else we get unexpected onBlur/onEndEditing events.
|
|
504
|
+
if (_isUpdatingPlaceholderText) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
|
|
492
508
|
id<RCTUITextFieldDelegate> delegate = self.delegate;
|
|
493
509
|
if ([delegate respondsToSelector:@selector(textFieldEndEditing:)]) {
|
|
494
510
|
[delegate textFieldEndEditing:self];
|
package/React/Base/RCTVersion.m
CHANGED