-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new
removeClippedSubviews
implementation (take 2 - recursive)
Reviewed By: mmmulani Differential Revision: D4081700 fbshipit-source-id: d4079138dc070565e475831e82651c9b2d5b8d59
- Loading branch information
Showing
9 changed files
with
620 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
625c8cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I've forgot to make my summary public. So here it goes:
This is a new implementation written from scratch. Important points:
This solution traverses all subviews if they are not clipped. That could be wasteful.
We could improve it by tracking if a not clipped view was completely visible before and is still completely visible, since in that case we don't have to recursively evaluate clipping downwards.
Let's do it if we see current approach is not fast enough.
There is one issue: uiview hierarchy doesn't have to match react view hierarchy. In that case we could end up in a state where view unclipping messes up a view hierarchy.
I plan to address this by not clipping subviews that don't match reach hierarchy. If they are not removed they cannot be incorrectly added back. That happens in the next diff.
This recursive approach is inherently slower than what we were doing before, but it's not too bad.
Timings on real iPhone5 for for how long clipping on scroll in our most complex RN surface takes:
625c8cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@majak so are these commits there for #8607 ?Thank you for your great work on this, I'll test it tomorrow, and could those commits be cherry picked to 0.38-stable?
625c8cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nihgwu exactly! Please try it out and let me know how it works for you.
I'm not sure if it makes sense to pick it into
0.38-stable
. It's been broken for a while and I'd rather let it get more testing before going into release.625c8cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@majak great work! will try it out during this week.
625c8cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads up: we've uncovered this solution doesn't work well with modals, so I've reverted the change on master until we come up with a proper fix 😞
625c8cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@majak are you working on getting a new version out which works with the internals or do FB not use modals internally?
625c8cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether it can clip ImageView?