Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[NT-1256] iOS 12 pledge screen scroll view insets bug #1198

Merged
merged 2 commits into from
May 19, 2020

Conversation

ifbarrera
Copy link
Contributor

@ifbarrera ifbarrera commented May 18, 2020

📲 What

Fixes a bug in iOS 12 where presenting a VC from the pledge screen caused the scroll view insets to be reset to zero, which caused the pledge button container to overlap some content near the bottom of the screen.

🤔 Why/How

This was a strange one. For some reason on iOS 12.4, presenting a VC on top of a scroll view with its contentInsetAdjustmentBehavior set to automatic (the default), caused the content insets to abruptly be reset back to zero when the presented VC is dismissed. Strangely, examining the contentInsets after the dismissal showed that the adjustedContentInsets were still correctly set, but visually the scroll view appeared to have an adjustedContentInset of .zero. Setting the contentInsetAdjustmentBehavior on the rootScrollView to .zero seemed to fix the issue, but it caused a strange side effect where the scroll view no longer bounced properly.

As a workaround, this PR pins the rootScrollView's bottom to the top of the pledgeCTAContainerView so we don't rely on the contentInsets being correct.

👀 See

Trello, screenshots, external resources?

After 🦋 Before 🐛
xMB3tAfJzs Fo4wht5WaJ

✅ Acceptance criteria

  • on an iOS 12 device, navigate to the pledge screen and check that the view scrolls up fully without obscuring content. Then, tap the "New Payment Method" button and close the view. Check that the view scrolls up fully without obscuring content.
  • on an iOS 13 device, navigate to the pledge screen and check that the view scrolls up fully without obscuring content. Then, tap the "New Payment Method" button and close the view. Check that the view scrolls up fully without obscuring content.

Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@@ -214,8 +203,7 @@ final class PledgeViewController: UIViewController,
}

private func setupConstraints() {
_ = (self.rootScrollView, self.view)
|> ksr_constrainViewToEdgesInParent()
self.rootScrollView.translatesAutoresizingMaskIntoConstraints = false
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already set in the lazy var property.

@ifbarrera ifbarrera merged commit cc71e2d into master May 19, 2020
@ifbarrera ifbarrera deleted the NT-1256-pledge-view-insets branch May 19, 2020 19:22
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants