Add TextInput controlled selection prop on Android

Summary:
Android PR for TextInput selection, based on the iOS implementation in #8958.

** Test plan **
Tested using the text selection example in UIExplorer.
Closes https://github.com/facebook/react-native/pull/8962

Differential Revision: D3819285

Pulled By: andreicoman11

fbshipit-source-id: 9a2408af2a8b694258c88ab5c46322830c71452a
This commit is contained in:
Janic Duplessis
2016-09-05 07:04:26 -07:00
committed by Facebook Github Bot
parent 2ea65ec872
commit 3c1b69c1a9
6 changed files with 159 additions and 7 deletions

View File

@@ -393,7 +393,6 @@ const TextInput = React.createClass({
/**
* The start and end of the text input's selection. Set start and end to
* the same value to position the cursor.
* @platform ios
*/
selection: PropTypes.shape({
start: PropTypes.number.isRequired,
@@ -679,6 +678,10 @@ const TextInput = React.createClass({
children = <Text>{children}</Text>;
}
if (props.selection && props.selection.end == null) {
props.selection = {start: props.selection.start, end: props.selection.start};
}
const textContainer =
<AndroidTextInput
ref={this._setNativeRef}