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
PR feedback + std::any_of
  • Loading branch information
Saadnajmi committed Oct 13, 2025
commit 0000b9c456126a78a902afbec55f0453964da925
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
static const CGFloat kSingleLineKeyboardBottomOffset = 15.0;
#endif // [macOS]

#if TARGET_OS_OSX // [macOS
static const NSString *kEscapeKeyCode = @"\x1B";
#endif // macOS]


using namespace facebook::react;

@interface RCTTextInputComponentView () <RCTBackedTextInputDelegate, RCTTextInputViewProtocol>
Expand Down Expand Up @@ -144,9 +149,7 @@ - (void)didMoveToWindow
[_backedTextInputView becomeFirstResponder];
#else // [macOS
NSWindow *window = [_backedTextInputView window];
if (window) {
[window makeFirstResponder:_backedTextInputView.responder];
}
[window makeFirstResponder:_backedTextInputView.responder];
#endif // macOS]
[self scrollCursorIntoView];
}
Expand Down Expand Up @@ -615,20 +618,23 @@ - (void)submitOnKeyDownIfNeeded:(nonnull NSEvent *)event
&& ![keyEvent[@"functionKey"] boolValue]; // Default clearTextOnSubmit key
} else {
NSString *keyValue = keyEvent[@"key"];
NSUInteger keyValueLength = [keyValue lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
std::string key = std::string([keyValue UTF8String], keyValueLength);
for (auto const &submitKeyEvent : props.traits.submitKeyEvents) {
if (
submitKeyEvent.key == key &&
submitKeyEvent.altKey == [keyEvent[@"altKey"] boolValue] &&
submitKeyEvent.shiftKey == [keyEvent[@"shiftKey"] boolValue] &&
submitKeyEvent.ctrlKey == [keyEvent[@"ctrlKey"] boolValue] &&
submitKeyEvent.metaKey == [keyEvent[@"metaKey"] boolValue] &&
submitKeyEvent.functionKey == [keyEvent[@"functionKey"] boolValue]
) {
shouldSubmit = YES;
break;
}
const char *keyCString = [keyValue UTF8String];
if (keyCString != nullptr) {
std::string_view key(keyCString);
const bool altKey = [keyEvent[@"altKey"] boolValue];
const bool shiftKey = [keyEvent[@"shiftKey"] boolValue];
const bool ctrlKey = [keyEvent[@"ctrlKey"] boolValue];
const bool metaKey = [keyEvent[@"metaKey"] boolValue];
const bool functionKey = [keyEvent[@"functionKey"] boolValue];

shouldSubmit = std::any_of(
props.traits.submitKeyEvents.begin(),
props.traits.submitKeyEvents.end(),
[&](auto const &submitKeyEvent) {
return submitKeyEvent.key == key && submitKeyEvent.altKey == altKey &&
submitKeyEvent.shiftKey == shiftKey && submitKeyEvent.ctrlKey == ctrlKey &&
submitKeyEvent.metaKey == metaKey && submitKeyEvent.functionKey == functionKey;
});
}
}

Expand All @@ -648,10 +654,9 @@ - (void)submitOnKeyDownIfNeeded:(nonnull NSEvent *)event
- (void)textInputDidCancel
{
if (_eventEmitter) {

auto const &textInputEventEmitter = *std::static_pointer_cast<TextInputEventEmitter const>(_eventEmitter);
textInputEventEmitter.onKeyPress({
.text = RCTStringFromNSString(@"\x1B"), // Escape key
.text = RCTStringFromNSString(kEscapeKeyCode),
.eventCount = static_cast<int>(_mostRecentEventCount),
});
}
Expand Down