react-native-macos 0.66.17 → 0.66.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.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +2 -0
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +15 -3
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +9 -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
- package/template/package.json +1 -1
|
@@ -36,6 +36,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
36
36
|
- (BOOL)textInputShouldHandleDeleteBackward:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the deleteBackward event handled normally. Return `NO` to disallow it and handle it yourself. TODO(OSS Candidate ISS#2710739)
|
|
37
37
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
38
38
|
- (BOOL)textInputShouldHandleDeleteForward:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the deleteForward event handled normally. Return `NO` to disallow it and handle it yourself.
|
|
39
|
+
|
|
40
|
+
- (void)textInputDidCancel; // Handle `Escape` key press.
|
|
39
41
|
#endif // ]TODO(macOS GH#774)
|
|
40
42
|
|
|
41
43
|
@optional
|
|
@@ -187,17 +187,17 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
187
187
|
|
|
188
188
|
- (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector
|
|
189
189
|
{
|
|
190
|
+
id<RCTBackedTextInputDelegate> textInputDelegate = [_backedTextInputView textInputDelegate];
|
|
190
191
|
BOOL commandHandled = NO;
|
|
191
192
|
// enter/return
|
|
192
193
|
if (commandSelector == @selector(insertNewline:) || commandSelector == @selector(insertNewlineIgnoringFieldEditor:)) {
|
|
193
194
|
[self textFieldDidEndEditingOnExit];
|
|
194
|
-
if ([
|
|
195
|
+
if ([textInputDelegate textInputShouldReturn]) {
|
|
195
196
|
[[_backedTextInputView window] makeFirstResponder:nil];
|
|
196
197
|
}
|
|
197
198
|
commandHandled = YES;
|
|
198
199
|
//backspace
|
|
199
200
|
} else if (commandSelector == @selector(deleteBackward:)) {
|
|
200
|
-
id<RCTBackedTextInputDelegate> textInputDelegate = [_backedTextInputView textInputDelegate];
|
|
201
201
|
if (textInputDelegate != nil && ![textInputDelegate textInputShouldHandleDeleteBackward:_backedTextInputView]) {
|
|
202
202
|
commandHandled = YES;
|
|
203
203
|
} else {
|
|
@@ -214,7 +214,13 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
214
214
|
//paste
|
|
215
215
|
} else if (commandSelector == @selector(paste:)) {
|
|
216
216
|
_backedTextInputView.textWasPasted = YES;
|
|
217
|
-
|
|
217
|
+
//escape
|
|
218
|
+
} else if (commandSelector == @selector(cancelOperation:)) {
|
|
219
|
+
[textInputDelegate textInputDidCancel];
|
|
220
|
+
[[_backedTextInputView window] makeFirstResponder:nil];
|
|
221
|
+
commandHandled = YES;
|
|
222
|
+
}
|
|
223
|
+
|
|
218
224
|
return commandHandled;
|
|
219
225
|
}
|
|
220
226
|
|
|
@@ -411,6 +417,12 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
411
417
|
//deleteForward
|
|
412
418
|
} else if (commandSelector == @selector(deleteForward:)) {
|
|
413
419
|
commandHandled = textInputDelegate != nil && ![textInputDelegate textInputShouldHandleDeleteForward:_backedTextInputView];
|
|
420
|
+
//escape
|
|
421
|
+
} else if (commandSelector == @selector(cancelOperation:)) {
|
|
422
|
+
[textInputDelegate textInputDidCancel];
|
|
423
|
+
[_backedTextInputView.window makeFirstResponder:nil];
|
|
424
|
+
commandHandled = YES;
|
|
425
|
+
|
|
414
426
|
}
|
|
415
427
|
|
|
416
428
|
return commandHandled;
|
|
@@ -569,6 +569,15 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
569
569
|
- (BOOL)textInputShouldHandleDeleteForward:(__unused id)sender {
|
|
570
570
|
return YES;
|
|
571
571
|
}
|
|
572
|
+
|
|
573
|
+
- (void)textInputDidCancel {
|
|
574
|
+
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeKeyPress
|
|
575
|
+
reactTag:self.reactTag
|
|
576
|
+
text:nil
|
|
577
|
+
key:@"Escape"
|
|
578
|
+
eventCount:_nativeEventCount];
|
|
579
|
+
[self textInputDidEndEditing];
|
|
580
|
+
}
|
|
572
581
|
#endif // ]TODO(macOS GH#774)
|
|
573
582
|
|
|
574
583
|
- (void)updateLocalData
|
package/React/Base/RCTVersion.m
CHANGED
package/package.json
CHANGED