From 11df0eae5ff8f530bfaf56aaf2209ff48f3ed9ac Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Mon, 28 Jan 2019 07:26:41 -0800 Subject: [PATCH] Add rejectResponderTermination prop to TextInput (#16755) Summary: This is a new attempt to get #11251 merged. I just cherry-picked the relevant commits. TextInputs are set to always ignore responder termination requests, which is not desirable when they are enclosed inside a swipeable area like a ListView Create a TextInput inside a ListView and set the `rejectResponderTermination` prop to false. Otherwise, all TextInputs should have the same behavior they do now. [IOS] [ENHANCEMENT] [TextInput] - Add `rejectResponderTermination` prop to to TextInput. This enables TextInputs inside Swipeables to function properly. Pull Request resolved: https://github.com/facebook/react-native/pull/16755 Differential Revision: D7846365 Pulled By: cpojer fbshipit-source-id: eb21140061ae1f475fbd83fc63a23819e931787d --- Libraries/Components/TextInput/TextInput.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index a6780fabd..296b6ec72 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -782,6 +782,15 @@ const TextInput = createReactClass({ */ inlineImagePadding: PropTypes.number, + /** + * If `true`, allows TextInput to pass touch events to the parent component. + * This allows components such as SwipeableListView to be swipeable from the TextInput on iOS, + * as is the case on Android by default. + * If `false`, TextInput always asks to handle the input (except when disabled). + * @platform ios + */ + rejectResponderTermination: PropTypes.bool, + /** * Determines the types of data converted to clickable URLs in the text input. * Only valid if `multiline={true}` and `editable={false}`. @@ -859,6 +868,7 @@ const TextInput = createReactClass({ getDefaultProps() { return { allowFontScaling: true, + rejectResponderTermination: true, underlineColorAndroid: 'transparent', }; }, @@ -1079,7 +1089,7 @@ const TextInput = createReactClass({