[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:
parent
d27e6fa7f8
commit
d72045932e
|
@ -232,6 +232,10 @@ var TextInput = React.createClass({
|
||||||
* Callback that is called when the text input's submit button is pressed.
|
* Callback that is called when the text input's submit button is pressed.
|
||||||
*/
|
*/
|
||||||
onSubmitEditing: PropTypes.func,
|
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
|
* If true, the text input obscures the text entered so that sensitive text
|
||||||
* like passwords stay secure. Default value is false.
|
* like passwords stay secure. Default value is false.
|
||||||
|
@ -446,6 +450,7 @@ var TextInput = React.createClass({
|
||||||
onEndEditing={this.props.onEndEditing}
|
onEndEditing={this.props.onEndEditing}
|
||||||
onSubmitEditing={this.props.onSubmitEditing}
|
onSubmitEditing={this.props.onSubmitEditing}
|
||||||
onSelectionChangeShouldSetResponder={() => true}
|
onSelectionChangeShouldSetResponder={() => true}
|
||||||
|
onLayout={this.props.onLayout}
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
placeholderTextColor={this.props.placeholderTextColor}
|
placeholderTextColor={this.props.placeholderTextColor}
|
||||||
text={this.state.bufferedValue}
|
text={this.state.bufferedValue}
|
||||||
|
@ -495,6 +500,7 @@ var TextInput = React.createClass({
|
||||||
onSelectionChange={this._onSelectionChange}
|
onSelectionChange={this._onSelectionChange}
|
||||||
onTextInput={this._onTextInput}
|
onTextInput={this._onTextInput}
|
||||||
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
|
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
|
||||||
|
onLayout={this.props.onLayout}
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
placeholderTextColor={this.props.placeholderTextColor}
|
placeholderTextColor={this.props.placeholderTextColor}
|
||||||
text={this.state.bufferedValue}
|
text={this.state.bufferedValue}
|
||||||
|
@ -530,6 +536,7 @@ var TextInput = React.createClass({
|
||||||
onChange={this._onChange}
|
onChange={this._onChange}
|
||||||
onEndEditing={this.props.onEndEditing}
|
onEndEditing={this.props.onEndEditing}
|
||||||
onSubmitEditing={this.props.onSubmitEditing}
|
onSubmitEditing={this.props.onSubmitEditing}
|
||||||
|
onLayout={this.props.onLayout}
|
||||||
password={this.props.password || this.props.secureTextEntry}
|
password={this.props.password || this.props.secureTextEntry}
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
text={this.state.bufferedValue}
|
text={this.state.bufferedValue}
|
||||||
|
|
Loading…
Reference in New Issue