[TextInput] Add `onLayout` to TextInput, forwarding it to the native views

Summary:
`TextInput` does not automatically forward all props using the spread operator so we need to explicitly forward the `onLayout` prop.

Closes https://github.com/facebook/react-native/pull/1296
Github Author: James Ide <ide@jameside.com>

Test Plan:
 Mount a TextInput component with an `onLayout` prop and see that the callback handler is invoked with the TextInput's frame.
This commit is contained in:
James Ide 2015-05-15 11:41:15 -07:00
Родитель d27e6fa7f8
Коммит d72045932e
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -232,6 +232,10 @@ var TextInput = React.createClass({
* Callback that is called when the text input's submit button is pressed.
*/
onSubmitEditing: PropTypes.func,
/**
* Invoked on mount and layout changes with {x, y, width, height}.
*/
onLayout: PropTypes.func,
/**
* If true, the text input obscures the text entered so that sensitive text
* like passwords stay secure. Default value is false.
@ -446,6 +450,7 @@ var TextInput = React.createClass({
onEndEditing={this.props.onEndEditing}
onSubmitEditing={this.props.onSubmitEditing}
onSelectionChangeShouldSetResponder={() => true}
onLayout={this.props.onLayout}
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
text={this.state.bufferedValue}
@ -495,6 +500,7 @@ var TextInput = React.createClass({
onSelectionChange={this._onSelectionChange}
onTextInput={this._onTextInput}
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
onLayout={this.props.onLayout}
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
text={this.state.bufferedValue}
@ -530,6 +536,7 @@ var TextInput = React.createClass({
onChange={this._onChange}
onEndEditing={this.props.onEndEditing}
onSubmitEditing={this.props.onSubmitEditing}
onLayout={this.props.onLayout}
password={this.props.password || this.props.secureTextEntry}
placeholder={this.props.placeholder}
text={this.state.bufferedValue}