Skip to content

Commit

Permalink
cherrypick - Fix TextInput to submit value to onChange & onSubmitEdit…
Browse files Browse the repository at this point in the history
…ing (#1811) (#1812)

Co-authored-by: Shawn Dempsey <shawndempsey@fb.com>
  • Loading branch information
shwanton and Shawn Dempsey authored May 4, 2023
1 parent 406a2da commit f1ee4e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ - (BOOL)shouldShowVerticalScrollbar

- (void)textInputDidChange
{
[super textInputDidChange];

[_scrollView setHasVerticalScroller:[self shouldShowVerticalScrollbar]];
}

Expand Down
4 changes: 2 additions & 2 deletions Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doComman
// enter/return
if (commandSelector == @selector(insertNewline:) || commandSelector == @selector(insertNewlineIgnoringFieldEditor:)) {
[self textFieldDidEndEditingOnExit];
if ([textInputDelegate textInputShouldReturn]) {
if ([textInputDelegate textInputShouldSubmitOnReturn]) {
[[_backedTextInputView window] makeFirstResponder:nil];
}
commandHandled = YES;
Expand Down Expand Up @@ -434,7 +434,7 @@ - (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector
id<RCTBackedTextInputDelegate> textInputDelegate = [_backedTextInputView textInputDelegate];
// enter/return
if ((commandSelector == @selector(insertNewline:) || commandSelector == @selector(insertNewlineIgnoringFieldEditor:))) {
if (textInputDelegate.textInputShouldReturn) {
if ([textInputDelegate textInputShouldSubmitOnReturn]) {
[_backedTextInputView.window makeFirstResponder:nil];
commandHandled = YES;
}
Expand Down

0 comments on commit f1ee4e4

Please sign in to comment.