Skip to content

Commit 521b167

Browse files
tido64facebook-github-bot
authored andcommitted
Align multi-line TextInput onSubmitEditing behavior (#29177)
Summary: Aligns behavior to be consistent with Android and the [documentation](https://reactnative.dev/docs/textinput#bluronsubmit). `onSubmitEditing` should not be called when `blurOnSubmit=false`. ## Changelog [iOS] [Fixed] - Align multi-line TextInput onSubmitEditing behavior Pull Request resolved: #29177 Test Plan: ![textinput-blur-align](https://user-images.githubusercontent.com/4123478/85121116-85b4b200-b224-11ea-86c5-065e9e6d22ba.gif) Reviewed By: shergin Differential Revision: D22488870 Pulled By: hramos fbshipit-source-id: 2dec3a55da6384389a8358896ef1fbfd806d0304
1 parent 6e6443a commit 521b167

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Libraries/Text/TextInput/RCTBaseTextInputView.m

+7-5
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,13 @@ - (BOOL)textInputShouldReturn
365365
// `onSubmitEditing` is called when "Submit" button
366366
// (the blue key on onscreen keyboard) did pressed
367367
// (no connection to any specific "submitting" process).
368-
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit
369-
reactTag:self.reactTag
370-
text:[self.backedTextInputView.attributedText.string copy]
371-
key:nil
372-
eventCount:_nativeEventCount];
368+
if (_blurOnSubmit) {
369+
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit
370+
reactTag:self.reactTag
371+
text:[self.backedTextInputView.attributedText.string copy]
372+
key:nil
373+
eventCount:_nativeEventCount];
374+
}
373375

374376
return _blurOnSubmit;
375377
}

0 commit comments

Comments
 (0)