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

Exposed scrollEnabled on TextInput #19330

Closed

Conversation

baldursson
Copy link
Contributor

On iOS, it is not possible to select a range of text using a Text component (see #13938). Because of how the Text component is implemented on iOS, this will not work without a complete re-write. On Android however, this is not an issue.

As the TextInput component has evolved, it can more or less be used as a drop-in replacement on iOS by setting multiline={true} and editable={false}. Except for one detail: the text input field has scrolling activated and it's not possible to turn off. (See #1391 and #15962).

This pull request addresses that issue, simply by exposing the scrollEnabled property:

<TextInput
    multiline
    editable={false}
    scrollEnabled={false}
  />

Test Plan

  1. Create a multiline TextInput component, with the attributes presented above.
  2. Run on iOS
  3. The TextInput field should not be able to scroll

Related PRs

facebook/react-native-website#367

Release Notes

[IOS] [FEATURE] [TextInput] - Made it possible to turn off scrolling on a multiline TextInput component

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@pull-bot
Copy link

pull-bot commented May 17, 2018

Warnings
⚠️

❔ Base Branch - The base branch for this PR is something other than master. Are you sure you want to merge these changes into a stable release? If you are interested in backporting updates to an older release, the suggested approach is to land those changes on master first and then cherry-pick the commits into the branch for that release. The Releases Guide has more information.

Generated by 🚫 dangerJS

@react-native-bot react-native-bot added ✅Test Plan Component: TextInput Related to the TextInput component. labels May 17, 2018
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 17, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@baldursson baldursson changed the base branch from 0.55-stable to master May 18, 2018 06:20
@baldursson baldursson changed the base branch from master to 0.55-stable May 18, 2018 06:22
@L-Yeiser
Copy link

Thank you for putting the work in on this! This is exactly what we needed.

@facebook-github-bot
Copy link
Contributor

@baldursson I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@brenwell
Copy link

brenwell commented Jul 9, 2018

This is exactly what i need too, Thanks. Can't wait for it to be merged

@baldursson baldursson changed the base branch from 0.55-stable to master August 8, 2018 16:48
@baldursson
Copy link
Contributor Author

@shergin Are you able to review this? It's really a no-brainer

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Aug 9, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was closed by @baldursson in 6104123.

Once this commit is added to a release, you will see the corresponding version tag below the description at 6104123. If the commit has a single master tag, it is not yet part of a release.

@facebook facebook locked as resolved and limited conversation to collaborators Aug 9, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 9, 2018
kelset pushed a commit that referenced this pull request Aug 13, 2018
Summary:
On iOS, it is not possible to select a range of text using a `Text` component (see #13938). Because of how the `Text` component is implemented on iOS, this will not work without a complete re-write. On Android however, this is not an issue.

As the `TextInput` component has evolved, it can more or less be used as a drop-in replacement on iOS by setting `multiline={true}` and `editable={false}`. Except for one detail: the text input field has scrolling activated and it's not possible to turn off. (See #1391 and #15962).

This pull request addresses that issue, simply by exposing the `scrollEnabled` property:

```
<TextInput
    multiline
    editable={false}
    scrollEnabled={false}
  />
```

1. Create a multiline `TextInput` component, with the attributes presented above.
2. Run on iOS
3. The `TextInput` field should not be able to scroll

facebook/react-native-website#367

[IOS] [FEATURE] [TextInput] - Made it possible to turn off scrolling on a multiline TextInput component
Pull Request resolved: #19330

Differential Revision: D9235061

Pulled By: hramos

fbshipit-source-id: 99d278004fc236b47dde7e61d74c71e8a3b9d170
@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Component: TextInput Related to the TextInput component. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants