Skip to content
Permalink
Browse files

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
  • Loading branch information...
cmcewen authored and facebook-github-bot committed Jan 28, 2019
1 parent 7cbdd7b commit 11df0eae5ff8f530bfaf56aaf2209ff48f3ed9ac
Showing with 11 additions and 1 deletion.
  1. +11 −1 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({
<TouchableWithoutFeedback
onLayout={props.onLayout}
onPress={this._onPress}
rejectResponderTermination={true}
rejectResponderTermination={props.rejectResponderTermination}
accessible={props.accessible}
accessibilityLabel={props.accessibilityLabel}
accessibilityRole={props.accessibilityRole}

0 comments on commit 11df0ea

Please sign in to comment.
You can’t perform that action at this time.