Permalink
Browse files

Scroll multiline textinputs when focused

Summary:
Currently, text inputs do not scroll when inside other components like scroll
views. This fixes it by blocking any parent native component from taking the
responder when the text input is focused and is being scrolled. This fixes the
previous implementation, where the scroll view was not able to scroll on top of
other text inputs, even though they were not focused.
This makes the component similar to it's ios counterpart.

Reviewed By: foghina

Differential Revision: D3735237

fbshipit-source-id: 0e56b2bbd3f5636540b4c3cc7cc13aa0f4d2737e
  • Loading branch information...
1 parent 049639c commit 0082517a6cc9c886ee1525ccf5d281be5084f6a9 @andreicoman11 andreicoman11 committed with Facebook Github Bot 2 Aug 19, 2016
Showing with 2 additions and 0 deletions.
  1. +1 −0 Libraries/Components/TextInput/TextInput.js
  2. +1 −0 Libraries/Components/Touchable/Touchable.js
@@ -691,6 +691,7 @@ const TextInput = React.createClass({
<TouchableWithoutFeedback
onLayout={this.props.onLayout}
onPress={this._onPress}
+ shouldBlockResponder={this.isFocused}
accessible={this.props.accessible}
accessibilityLabel={this.props.accessibilityLabel}
accessibilityComponentType={this.props.accessibilityComponentType}
@@ -396,6 +396,7 @@ var TouchableMixin = {
this._handleLongDelay.bind(this, e),
longDelayMS + delayMS
);
+ return this.props.shouldBlockResponder && this.props.shouldBlockResponder();
},
/**

0 comments on commit 0082517

Please sign in to comment.