-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: reduce amount of layout calls and debounce layouts when needed #10164
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit b887399. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
Perhaps, we could create a view controller base class and add all |
@edusperoni I am a bit worried about that kind of "patch". I fill like we are patching just because we actually dont know the real cause of the inner issue. |
I believe this issue became more apparent on iOS 16, where the Maybe we should review the layout process, but this PR fixes both the issues with side drawer and incorrectly displayed items and large titles/changing safe area sizes. |
Did you find any reference to that ios 16 anywhere ? Like is any one doing native facing this? |
My bad, it was 15. I haven't found anything about native apps when I researched it so I figured it was specific to our layout engine |
@edusperoni i understand we need the fix. But wouldn't it be best to revert your original fix and investigate the issue with large titles a bit more? Can you confirm the issue with side drawer was happening or not before your original PR? |
The side drawer issue didn't happen before due to the The way to reproduce the large title issue is to just have a page with large titles and a list view inside. The large title should bug out (and if you wrap the list view in a grid and put view parallel to the list the views won't change position if the title change sizes) |
@farfromrefug Regarding the drawer issue, Eduardo has created this sample: https://github.com/edusperoni/sidedrawer-rotate-issue Remove
Note: Perform rotations while drawer is open. To fix this in the current layout engine, we ended up with the following cases after removing
I left those notes in case they help more on research. |
@edusperoni @CatchABus sorry for not replying sooner. I will look at the repo with the drawer issue. |
@edusperoni @CatchABus actually always thought the drawer issue was with my drawer plugin. But it was with rad drawer? EDIT: @edusperoni i tested without I maintain we should remove all those hacks and fix issues one by one the right way |
@NathanWalker I see you are about to merge this. I think we should not merge hacks like this (especially when the issue seems to be in a plugin?). The more we add the harder it will become. |
I plan on correctly fixing this
PR Checklist
What is the current behavior?
We do a layout call on a lot of places where the views might not be fully updated yet
What is the new behavior?
We now schedule a layout call on
viewSafeAreaInsetsDidChange
so it only triggers ifviewDidLayoutSubviews
.We also prevent a layout call if
owner.nativeViewProtected.layer.needsLayout()
is true, meaning thatviewDidLayoutSubviews
will be called again and if we run a layout call we will do a layout with the wrong parameters.cc @CatchABus @farfromrefug