From 0bcb0c2b2f460ed1a9d525d1a5b343f4b71f9347 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Mon, 16 Dec 2024 04:46:03 -0800 Subject: [PATCH] Fabric: Fixes Numeric TextInput not triggering onSubmitEditing (#48276) Summary: Fixes https://github.com/facebook/react-native/issues/48259 . The paper code like : https://github.com/facebook/react-native/blob/2fee13094b3d384c071978776fd8b7cff0b6530f/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm#L777-L784 ## Changelog: [IOS] [FIXED] - Fabric: Fixes Numeric TextInput not triggering onSubmitEditing Pull Request resolved: https://github.com/facebook/react-native/pull/48276 Test Plan: Repro in https://github.com/facebook/react-native/issues/48259 Reviewed By: cipolleschi Differential Revision: D67274739 Pulled By: javache fbshipit-source-id: 57396c6e1a8ef96a1b29cae4a9aa9b5f48f6080b --- .../ComponentViews/TextInput/RCTTextInputComponentView.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index 0443f1c2aa8a94..d2ace9416ecd3a 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -643,6 +643,8 @@ - (void)setDefaultInputAccessoryView - (void)handleInputAccessoryDoneButton { + // Ignore the value of whether we submitted; just make sure the submit event is called if necessary. + [self textInputShouldSubmitOnReturn]; if ([self textInputShouldReturn]) { [_backedTextInputView endEditing:YES]; }