Skip to content

Commit

Permalink
fix(ios): footer layout changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lodev09 committed Mar 25, 2024
1 parent f1f92f2 commit ec40931
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
18 changes: 11 additions & 7 deletions ios/TrueSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
}
}

func viewControllerDidAppear() {
func viewControllerWillAppear() {
setupContent()
}

Expand Down Expand Up @@ -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)
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions ios/TrueSheetViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ec40931

Please sign in to comment.