mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 23:05:00 +08:00
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:
committed by
Facebook Github Bot
parent
2ea65ec872
commit
3c1b69c1a9
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user