Android shouldn't dispatch onLayout if frame didn't change#7250
Conversation
There was a problem hiding this comment.
nit: space after if, split on multiple lines
There was a problem hiding this comment.
you mean split the conditions on multiple lines?
|
We should probably have a dedicated API to detect screen rotation other than: Does this one fire if keyboard is shown for example? |
|
Thanks for the great description in #7202. |
|
I pinged some people internally to get more opinions. |
|
In my own code I use onLayout in a top-level component to receive the frame. Once the container component has the frame it passes the frame down the tree hierarchy, which I use as a ersatz "percentage unit". Something like this: In the case of keyboard event, this works exactly the same as orientation... It might be nice to have something baked-in to capture the "percentage width" concept. |
d272a41 to
61da183
Compare
|
@hayeah updated the pull request. |
|
@mkonicek fixed nit and rebased. thanks! |
|
It's been a while since the last commit was reviewed and the labels show this pull request needs review. Based on the blame information for the files in this pull request we identified @korDen as a potential reviewer. Could you take a look please or cc someone with more context? |
|
Note that this PR is not only related to orientation but fixes a general difference how onLayout events are handled between iOS and Android. See my comment in the in issue #7202 for more info. |
|
Any updates on this? |
|
@mkonicek any update on this PR? My team is using Android's Adam Comella |
|
Hey, sorry for letting this sit for a while. The code looks pretty straightforward to me, I think @mkonicek just wanted to double-check if this is the correct behavior. Could you fix that merge conflict? |
|
Sorry, I got confused by #7250 mentioning device orientation. I should have read the description more carefully. Let's ship it, I'll fix the merge conflict if there's one. @facebook-github-bot shipit |
|
@mkonicek has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
I feel bad I haven't replied on this since May! :( We have an oncall rotation for handling pull requests now, @lacker is oncall and pinged me. Thank you so much Kevin! Hopefully this new oncall rotation will improve things :) |
|
looks like it's fixed in #11222 sorry about introducing the bug 😢 |
Fixes #7202 Android Redundant onLayout event