From 523660e452781c1bee4ca5329661be4689f3a897 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Fri, 19 Jun 2020 11:57:07 +0200 Subject: [PATCH] Align multi-line TextInput onSubmitEditing behavior Aligns behavior to be consistent with Android and the documentation. `onSubmitEditing` should not be called when `blurOnSubmit=false`. --- Libraries/Text/TextInput/RCTBaseTextInputView.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index f3d83f79d3a9ed..3276955ad932bd 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -365,11 +365,13 @@ - (BOOL)textInputShouldReturn // `onSubmitEditing` is called when "Submit" button // (the blue key on onscreen keyboard) did pressed // (no connection to any specific "submitting" process). - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit - reactTag:self.reactTag - text:self.backedTextInputView.attributedText.string - key:nil - eventCount:_nativeEventCount]; + if (_blurOnSubmit) { + [_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit + reactTag:self.reactTag + text:self.backedTextInputView.attributedText.string + key:nil + eventCount:_nativeEventCount]; + } return _blurOnSubmit; }