Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ios] Fix onLayout support in <TextInput> #8042

Closed
wants to merge 1 commit into from

Conversation

paulshen
Copy link
Contributor

The onLayout prop is overridden by <TouchableWithoutFeedback> and thus does not work on <TextInput> components.

This makes it so the following works.

<TextInput onLayout={...} />

I only tested on iOS but I assume a similar fix might be needed for Android.

Test Plan

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

<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />

The `onLayout` prop is overridden by `<TouchableWithoutFeedback>` and thus does not work on `<TextInput>` components. https://github.com/facebook/react-native/blob/fb0007d85323909ab652bf97166744fa7e17daab/Libraries/Components/Touchable/TouchableWithoutFeedback.js#L176

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

ghost commented Jun 10, 2016

By analyzing the blame information on this pull request, we identified @Bhullnatik and @dmmiller to be potential reviewers.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jun 10, 2016
@nicklockwood
Copy link
Contributor

@facebook-github-bot shipit

@ghost ghost added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Jun 10, 2016
@ghost
Copy link

ghost commented Jun 10, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review.

@ghost ghost closed this in 92926f9 Jun 10, 2016
@antoinerousseau
Copy link
Contributor

I confirm, a similar fix is needed on Android

ghost pushed a commit that referenced this pull request Jul 31, 2016
…8042)

Summary:
See #8042: exactly the same bug and fix on Android

**Test plan**

```jsx
<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />
```
Closes #9113

Differential Revision: D3647808

Pulled By: mkonicek

fbshipit-source-id: 252a610e26a72a73411c3407faedea0477bee54e
bartolkaruza pushed a commit to immidi/react-native that referenced this pull request Aug 3, 2016
…acebook#8042)

Summary:
See facebook#8042: exactly the same bug and fix on Android

**Test plan**

```jsx
<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />
```
Closes facebook#9113

Differential Revision: D3647808

Pulled By: mkonicek

fbshipit-source-id: 252a610e26a72a73411c3407faedea0477bee54e
samerce pushed a commit to iodine/react-native that referenced this pull request Aug 23, 2016
Summary:
The `onLayout` prop is overridden by `<TouchableWithoutFeedback>` and thus does not work on `<TextInput>` components. https://github.com/facebook/react-native/blob/fb0007d85323909ab652bf97166744fa7e17daab/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. https://github.com/facebook/react-native/blob/fb0007d85323909ab652bf97166744fa7e17daab/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 facebook#8042

Differential Revision: D3417192

fbshipit-source-id: 536ec81d3479e6bda474ac766b27afb39242c01a
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
Summary:
The `onLayout` prop is overridden by `<TouchableWithoutFeedback>` and thus does not work on `<TextInput>` components. https://github.com/facebook/react-native/blob/fb0007d85323909ab652bf97166744fa7e17daab/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. https://github.com/facebook/react-native/blob/fb0007d85323909ab652bf97166744fa7e17daab/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 facebook#8042

Differential Revision: D3417192

fbshipit-source-id: 536ec81d3479e6bda474ac766b27afb39242c01a
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
…acebook#8042)

Summary:
See facebook#8042: exactly the same bug and fix on Android

**Test plan**

```jsx
<TextInput onLayout={function(e) { console.log(e.nativeEvent); }} />
```
Closes facebook#9113

Differential Revision: D3647808

Pulled By: mkonicek

fbshipit-source-id: 252a610e26a72a73411c3407faedea0477bee54e
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants