Skip to content

Commit 11df0ea

Browse files
cmcewenfacebook-github-bot
authored andcommitted
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: #16755 Differential Revision: D7846365 Pulled By: cpojer fbshipit-source-id: eb21140061ae1f475fbd83fc63a23819e931787d
1 parent 7cbdd7b commit 11df0ea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Libraries/Components/TextInput/TextInput.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,15 @@ const TextInput = createReactClass({
782782
*/
783783
inlineImagePadding: PropTypes.number,
784784

785+
/**
786+
* If `true`, allows TextInput to pass touch events to the parent component.
787+
* This allows components such as SwipeableListView to be swipeable from the TextInput on iOS,
788+
* as is the case on Android by default.
789+
* If `false`, TextInput always asks to handle the input (except when disabled).
790+
* @platform ios
791+
*/
792+
rejectResponderTermination: PropTypes.bool,
793+
785794
/**
786795
* Determines the types of data converted to clickable URLs in the text input.
787796
* Only valid if `multiline={true}` and `editable={false}`.
@@ -859,6 +868,7 @@ const TextInput = createReactClass({
859868
getDefaultProps() {
860869
return {
861870
allowFontScaling: true,
871+
rejectResponderTermination: true,
862872
underlineColorAndroid: 'transparent',
863873
};
864874
},
@@ -1079,7 +1089,7 @@ const TextInput = createReactClass({
10791089
<TouchableWithoutFeedback
10801090
onLayout={props.onLayout}
10811091
onPress={this._onPress}
1082-
rejectResponderTermination={true}
1092+
rejectResponderTermination={props.rejectResponderTermination}
10831093
accessible={props.accessible}
10841094
accessibilityLabel={props.accessibilityLabel}
10851095
accessibilityRole={props.accessibilityRole}

0 commit comments

Comments
 (0)