[react_native] JS files from D2172754: support setting the cursor position in TextInput

This commit is contained in:
Felix Oghină 2015-06-22 13:06:11 -01:00
parent 9228873fb4
commit 22ea66923f
1 changed files with 21 additions and 0 deletions

View File

@ -44,6 +44,8 @@ var AndroidTextInputAttributes = {
autoCapitalize: true,
autoCorrect: true,
autoFocus: true,
textAlign: true,
textAlignVertical: true,
keyboardType: true,
multiline: true,
password: true,
@ -124,6 +126,19 @@ var TextInput = React.createClass({
* If true, focuses the input on componentDidMount. Default value is false.
*/
autoFocus: PropTypes.bool,
/**
* Set the position of the cursor from where editing will begin.
*/
textAlign: PropTypes.oneOf([
'start',
'center',
'end',
]),
textAlignVertical: PropTypes.oneOf([
'top',
'center',
'bottom',
]),
/**
* If false, text is not editable. Default value is true.
*/
@ -466,6 +481,10 @@ var TextInput = React.createClass({
_renderAndroid: function() {
var autoCapitalize = RCTUIManager.UIText.AutocapitalizationType[this.props.autoCapitalize];
var textAlign =
RCTUIManager.AndroidTextInput.Constants.TextAlign[this.props.textAlign];
var textAlignVertical =
RCTUIManager.AndroidTextInput.Constants.TextAlignVertical[this.props.textAlignVertical];
var children = this.props.children;
var childCount = 0;
ReactChildren.forEach(children, () => ++childCount);
@ -482,6 +501,8 @@ var TextInput = React.createClass({
style={[this.props.style]}
autoCapitalize={autoCapitalize}
autoCorrect={this.props.autoCorrect}
textAlign={textAlign}
textAlignVertical={textAlignVertical}
keyboardType={this.props.keyboardType}
multiline={this.props.multiline}
onFocus={this._onFocus}