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

kick off updateScrollViewHeight after layout pass completes #183

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NicoHinderling
Copy link
Collaborator

We either do this or call layoutIfNeeded at the top of the updateScrollViewHeight method in order to ensure that the expansion logic doesn't have a race condition with the layout pass

@@ -78,7 +78,11 @@ public final class ExpandingViewController: UIHostingController<EmergeModifierVi

public override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
Copy link
Member

Choose a reason for hiding this comment

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

Isn't viewDidLayoutSubviews only called after the layout pass has completed? viewWillLayoutSubviews is called before it's completed, but we aren't using that here

Copy link
Collaborator Author

@NicoHinderling NicoHinderling Aug 26, 2024

Choose a reason for hiding this comment

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

I agree, I find it confusing too... I guess there's an additional layout pass that happens after the one that completed that kicked off the viewDidLayoutSubviews call... but it's pretty conclusive whether it works or not based on this from testing.

Either way, the cause of the issue is some sort of race condition and I think the layoutIfNeeded approach might be more straightforward (and achieve the same thing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants