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
This commit is contained in:
parent
7cbdd7b6ac
commit
11df0eae5f
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue