diff --git a/Libraries/Text/RCTTextInput.m b/Libraries/Text/RCTTextInput.m index 113b8b56b..4c63c2ef4 100644 --- a/Libraries/Text/RCTTextInput.m +++ b/Libraries/Text/RCTTextInput.m @@ -117,16 +117,23 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) - (BOOL)textInputShouldReturn { - return _blurOnSubmit; -} - -- (void)textInputDidReturn -{ + // We send `submit` event here, in `textInputShouldReturn` + // (not in `textInputDidReturn)`, because of semantic of the event: + // `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.text key:nil eventCount:_nativeEventCount]; + + return _blurOnSubmit; +} + +- (void)textInputDidReturn +{ + // Does nothing. } - (void)textInputDidChangeSelection