Skip to content

iOS Text - Modify "onChange" behaviour to allow for all changes in contentSize #6283

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

Closed
wants to merge 2 commits into from

Conversation

deanmcpherson
Copy link
Contributor

As per discussion with @nicklockwood and @brentvatne on #1229. This PR is an initial attempt to satisfy the following:

  1. Only call onChange once per set of changes (e.g. if text and contentSize both change at once - which is usually the case - we should only fire one onChange event)
  2. Only call onChange if something has actually changed (i.e. don't fire it unconditionally in updateContentSize if updateContentSize sometimes gets called when the contentSize hasn't changed).

This change is necessary to allow for auto height scaling on TextInputs that adjust when the value is modified outside of user input.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @nicklockwood, @sahrens and @brentvatne to be potential reviewers.

@facebook-github-bot facebook-github-bot 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 Mar 4, 2016
@brentvatne
Copy link
Collaborator

@kmagiera - we need to mirror this behaviour on Android too, cc @mkonicek @bestander

@brentvatne
Copy link
Collaborator

I did a quick implementation of onChangeContentSize on Android as per @nicklockwood's comment (#1229 (comment)). I need this so I'll integrate it into Exponent right away but if someone wants to bring this in to a pull request for both iOS and Android, go for it - https://github.com/exponentjs/react-native/pull/3/files
cc @deanmcpherson

@facebook-github-bot
Copy link
Contributor

@deanmcpherson updated the pull request.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@deanmcpherson updated the pull request.

@mkonicek
Copy link
Contributor

we need to mirror this behaviour on Android too

@brentvatne OK, someone should send a PR for that once this one lands.

@ghost
Copy link

ghost commented Apr 13, 2016

@nicklockwood would you mind taking a look at this pull request? It's been a while since the last commit was reviewed.

@ghost ghost 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 Jul 12, 2016
@mkonicek mkonicek assigned majak and unassigned nicklockwood Sep 9, 2016
@mkonicek mkonicek changed the title Modify "onChange" behaviour to allow for all changes in contentSize iOS Text - Modify "onChange" behaviour to allow for all changes in contentSize Sep 9, 2016
@mkonicek
Copy link
Contributor

mkonicek commented Sep 9, 2016

@majak Are you familiar with TextViews on iOS?

@ghost ghost 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 Sep 9, 2016
Copy link
Contributor

@majak majak left a comment

Choose a reason for hiding this comment

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

Looks reasonable.
@facebook-github-bot shipit

@ide
Copy link
Contributor

ide commented Sep 30, 2016

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot 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 Sep 30, 2016
@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are a Facebook employee, you can view this diff on Phabricator.

@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 Sep 30, 2016
@brentvatne
Copy link
Collaborator

cc @janicduplessis

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Sep 30, 2016
@facebook-github-bot
Copy link
Contributor

I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification.

@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 Oct 1, 2016
@hramos
Copy link
Contributor

hramos commented Nov 11, 2016

Please resolve the conflicts in RCTTextView.m

@lacker
Copy link
Contributor

lacker commented Dec 14, 2016

@deanmcpherson Are you still working on this? If not perhaps we should just close the pull request.

@deanmcpherson
Copy link
Contributor Author

Hey @lacker,

No sorry, im not working on this. Happy for it to be 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants