Fix onLayout support in <TextInput>

Summary:
The `onLayout` prop is overridden by `<TouchableWithoutFeedback>` and thus does not work on `<TextInput>` components. fb0007d853/Libraries/Components/Touchable/TouchableWithoutFeedback.js (L176)

This makes it so the following works.

```javascript
<TextInput onLayout={...} />
```

I only tested on iOS but I assume a similar fix might be needed for Android. fb0007d853/Libraries/Components/TextInput/TextInput.js (L575)

**Test Plan**

https://rnplay.org/apps/euIZtg (confirm bug)
With fix, set `onLayout` on `<TextInput>` and see it is fired correctly.

```javascript
<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />
```
Closes https://github.com/facebook/react-native/pull/8042

Differential Revision: D3417192

fbshipit-source-id: 536ec81d3479e6bda474ac766b27afb39242c01a
This commit is contained in:
Paul Shen 2016-06-10 03:14:47 -07:00 committed by Facebook Github Bot 6
parent 13dfb6267a
commit 92926f9858
1 changed files with 1 additions and 0 deletions

View File

@ -501,6 +501,7 @@ var TextInput = React.createClass({
return (
<TouchableWithoutFeedback
onLayout={props.onLayout}
onPress={this._onPress}
rejectResponderTermination={true}
accessible={props.accessible}