diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index d2845e601..a69491254 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -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}