Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6daef14
[fabric] Add wrapper class for TextView with scroll callback support
Dec 7, 2023
0994e37
slight modifications
Saadnajmi Oct 10, 2025
c7ecd3c
[fabric] Add responder property to backing text input view protocol
Dec 7, 2023
11ab6cd
[fabric] Use wrapped text view for multiline TextInput
Dec 7, 2023
dadf2de
[fabric] Support showing/hiding the focus ring for TextInput
Dec 9, 2023
a03e759
[fabric] Implement escape/cancel key press callback for TextInput
Dec 9, 2023
e5f5425
[fabric] Submit scroll view metrics when scrolling multiline TextInput
Dec 9, 2023
5df9acd
remove odd ifdef
Saadnajmi Oct 10, 2025
20c8212
[fabric] Fix random TextInput cursor position changes while typing
Jan 15, 2024
113fe8a
[fabric] Add submitKeyEvents property to TextInput
Jan 18, 2024
dcfe453
[fabric] Implement TextInput key down event checking for submit
Jan 18, 2024
7311f83
[fabric] Add support for clearing the TextInput on submit
Jan 18, 2024
bd7408b
[fabric] Add support for the secure text entry to TextInput
Jan 19, 2024
3275685
[fabric] Copy accessibility attributes when switching TextInput backi…
Jan 19, 2024
5f3faf6
[fabric] TextInput should get focus with `autoFocus` prop
shwanton Mar 13, 2024
c1df4ad
[fabric] Fix warning & formatting
shwanton May 1, 2024
484018e
Merge branch 'main' into more-2
Saadnajmi Oct 13, 2025
84f6f50
build fixes
Saadnajmi Oct 13, 2025
0000b9c
PR feedback + std::any_of
Saadnajmi Oct 13, 2025
4defd81
more fixes
Saadnajmi Oct 13, 2025
c7ed2d2
siimplify scrollview metrics
Saadnajmi Oct 13, 2025
412b5d3
simplify metrics
Saadnajmi Oct 13, 2025
44fee32
typo
Saadnajmi Oct 13, 2025
67580db
Update RCTTextInputComponentView.mm
Saadnajmi Oct 14, 2025
de1086d
Update RCTTextInputComponentView.mm
Saadnajmi Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[fabric] Implement escape/cancel key press callback for TextInput
Summary:
Pressing the escape key down in a TextInput on macOS will be captured on the native side as a cancel event.

This diff adds support for sending the "Escape" key as a key pressed event and wires the delegate method of the backing text input to call the key press event handler with the correct payload.

Test Plan:
- Run Zeratul with Fabric enabled
- Add a key press handler on the textfield logging the received data (e.g. on MDSTextInput)
- Focus the textfield
- Press the escape key
- The key press handler should be called and print that the "Escape" key was pressed.

 https://pxl.cl/3XHR2

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D52005857

Tasks: T167538822
  • Loading branch information
Nick Lefever authored and Saadnajmi committed Oct 10, 2025
commit a03e7596e3e686949eadc2d5cd36ec63985ca5d7
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,24 @@ - (void)grammarCheckingDidChange:(BOOL)enabled

- (void)submitOnKeyDownIfNeeded:(nonnull NSEvent *)event {}

- (void)textInputDidCancel {}
- (void)textInputDidCancel
{
if (_eventEmitter) {
KeyPressMetrics keyPressMetrics;
keyPressMetrics.text = RCTStringFromNSString(@"\x1B"); // Escape key
keyPressMetrics.eventCount = _mostRecentEventCount;

auto const &textInputEventEmitter = *std::static_pointer_cast<TextInputEventEmitter const>(_eventEmitter);
auto const &props = *std::static_pointer_cast<TextInputProps const>(_props);
if (props.onKeyPressSync) {
textInputEventEmitter.onKeyPressSync(keyPressMetrics);
} else {
textInputEventEmitter.onKeyPress(keyPressMetrics);
}
}

[self textInputDidEndEditing];
}

- (NSDragOperation)textInputDraggingEntered:(nonnull id<NSDraggingInfo>)draggingInfo {
if ([draggingInfo.draggingPasteboard availableTypeFromArray:self.registeredDraggedTypes]) {
Expand Down