Skip to content

Commit 3869aa9

Browse files
authored
Merge pull request #18415 from wordpress-mobile/feature/18402-bottom-sheet-header-view
Add header view to `ActionSheetViewController`
2 parents 54220c6 + 2ecd804 commit 3869aa9

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

WordPress/Classes/ViewRelated/System/Action Sheet/ActionSheetViewController.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ class ActionSheetViewController: UIViewController {
4545
}
4646
}
4747

48+
let headerView: UIView?
4849
let buttons: [ActionSheetButton]
4950
let headerTitle: String
5051

51-
init(headerTitle: String, buttons: [ActionSheetButton]) {
52+
init(headerView: UIView? = nil, headerTitle: String, buttons: [ActionSheetButton]) {
53+
self.headerView = headerView
5254
self.headerTitle = headerTitle
5355
self.buttons = buttons
5456
super.init(nibName: nil, bundle: nil)
@@ -100,10 +102,13 @@ class ActionSheetViewController: UIViewController {
100102

101103
NSLayoutConstraint.activate(buttonConstraints)
102104

103-
let stackView = UIStackView(arrangedSubviews: [
104-
gripButton,
105-
headerLabelView
106-
] + buttonViews)
105+
let stackView = UIStackView(arrangedSubviews: [gripButton])
106+
107+
if let headerView = headerView {
108+
stackView.addArrangedSubview(headerView)
109+
}
110+
111+
stackView.addArrangedSubviews([headerLabelView] + buttonViews)
107112

108113
stackView.setCustomSpacing(Constants.Header.spacing, after: gripButton)
109114
stackView.setCustomSpacing(Constants.Header.spacing, after: headerLabelView)

0 commit comments

Comments
 (0)