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

[Bug] Incorrect width when present a full screen ViewController in the Sheet #200

Open
VitoNYang opened this issue May 12, 2023 · 2 comments

Comments

@VitoNYang
Copy link

Presenting a ViewController with modalPresentationStyle = .fullScreen in a sheet view, when dismiss the ViewController will cause the width of the sheet view to be incorrect.

@VitoNYang
Copy link
Author

VitoNYang commented May 12, 2023

image

Seems like the view.layoutIfNeeded() cause the width to incorrect

@VitoNYang
Copy link
Author

VitoNYang commented May 12, 2023

According to the clue from PR #199,

this issue is trigger by SheetViewController's viewDidDisappear method,

image

So, I think we can fix this by checking if whether presenttedviewcontroller is nil

    public override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        // Add a guard statement to prevent unexpected dismiss
        guard presentedViewController == nil else { return }
        if let presenter = self.transition.presenter, self.options.shrinkPresentingViewController {
            self.transition.restorePresentor(presenter, completion: { _ in
                self.didDismiss?(self)
            })
        } else if !self.options.useInlineMode {
            self.didDismiss?(self)
        }
    }

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

No branches or pull requests

1 participant