diff --git a/ios/TrueSheetView.swift b/ios/TrueSheetView.swift index cf0bf94..08a8efc 100644 --- a/ios/TrueSheetView.swift +++ b/ios/TrueSheetView.swift @@ -130,7 +130,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { } } - func viewControllerDidAppear() { + func viewControllerWillAppear() { setupContent() } @@ -193,13 +193,17 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate { } // Pin footer at the bottom - if let footerView, let footerContent = footerView.subviews.first { + if let footerView { containerView.bringSubviewToFront(footerView) - footerView.pinTo( - view: viewController.view, - from: [.bottom, .left, .right], - with: footerContent.bounds.height - ) + if let footerContent = footerView.subviews.first { + footerView.pinTo( + view: viewController.view, + from: [.bottom, .left, .right], + with: footerContent.bounds.height + ) + } else { + footerView.removeConstraints(footerView.constraints) + } } } diff --git a/ios/TrueSheetViewController.swift b/ios/TrueSheetViewController.swift index 7e8c7cb..8a6f065 100644 --- a/ios/TrueSheetViewController.swift +++ b/ios/TrueSheetViewController.swift @@ -19,7 +19,7 @@ protocol TrueSheetViewControllerDelegate: AnyObject { func viewControllerDidChangeWidth(_ width: CGFloat) func viewControllerDidDismiss() func viewControllerSheetDidChangeSize(_ value: CGFloat, at index: Int) - func viewControllerDidAppear() + func viewControllerWillAppear() } // MARK: - TrueSheetViewController @@ -47,9 +47,9 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe } } - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - delegate?.viewControllerDidAppear() + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + delegate?.viewControllerWillAppear() } override func viewDidDisappear(_ animated: Bool) {