diff --git a/Libraries/Text/RCTTextField.m b/Libraries/Text/RCTTextField.m index b10ae76c2..fa548c480 100644 --- a/Libraries/Text/RCTTextField.m +++ b/Libraries/Text/RCTTextField.m @@ -137,24 +137,4 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) eventCount:_nativeEventCount]; } -- (BOOL)textInputShouldEndEditing -{ - return YES; -} - -- (void)textInputDidEndEditing -{ - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeBlur - reactTag:self.reactTag - text:self.text - key:nil - eventCount:_nativeEventCount]; - - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeEnd - reactTag:self.reactTag - text:_backedTextInput.text - key:nil - eventCount:_nativeEventCount]; -} - @end diff --git a/Libraries/Text/RCTTextInput.h b/Libraries/Text/RCTTextInput.h index ac2e61534..5531fca4e 100644 --- a/Libraries/Text/RCTTextInput.h +++ b/Libraries/Text/RCTTextInput.h @@ -56,5 +56,7 @@ - (BOOL)textInputShouldReturn; - (void)textInputDidReturn; - (void)textInputDidChangeSelection; +- (BOOL)textInputShouldEndEditing; +- (void)textInputDidEndEditing; @end diff --git a/Libraries/Text/RCTTextInput.m b/Libraries/Text/RCTTextInput.m index c21426a00..0bc57b8b8 100644 --- a/Libraries/Text/RCTTextInput.m +++ b/Libraries/Text/RCTTextInput.m @@ -146,6 +146,26 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) }); } +- (BOOL)textInputShouldEndEditing +{ + return YES; +} + +- (void)textInputDidEndEditing +{ + [_eventDispatcher sendTextEventWithType:RCTTextEventTypeEnd + reactTag:self.reactTag + text:self.backedTextInputView.text + key:nil + eventCount:_nativeEventCount]; + + [_eventDispatcher sendTextEventWithType:RCTTextEventTypeBlur + reactTag:self.reactTag + text:self.backedTextInputView.text + key:nil + eventCount:_nativeEventCount]; +} + #pragma mark - Content Size (in Yoga terms, without any insets) - (CGSize)contentSize diff --git a/Libraries/Text/RCTTextView.m b/Libraries/Text/RCTTextView.m index 020c0acb0..310691db4 100644 --- a/Libraries/Text/RCTTextView.m +++ b/Libraries/Text/RCTTextView.m @@ -373,26 +373,6 @@ static BOOL findMismatch(NSString *first, NSString *second, NSRange *firstRange, }); } -- (BOOL)textInputShouldEndEditing -{ - return YES; -} - -- (void)textInputDidEndEditing -{ - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeEnd - reactTag:self.reactTag - text:_backedTextInput.text - key:nil - eventCount:_nativeEventCount]; - - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeBlur - reactTag:self.reactTag - text:nil - key:nil - eventCount:_nativeEventCount]; -} - #pragma mark - UIScrollViewDelegate - (void)scrollViewDidScroll:(UIScrollView *)scrollView