Skip to content

Commit 5b5fb8e

Browse files
committed
Fix offline banner issues
1 parent eef3b6e commit 5b5fb8e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

WooCommerce/Classes/Bookings/BookingsTabView.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,15 @@ private extension BookingsTabViewHostingController {
3636
struct BookingsTabView: View {
3737
@State private var visibility: NavigationSplitViewVisibility = .all
3838
@StateObject private var connectivityMonitor = ConnectivityMonitor()
39-
40-
private let siteID: Int64
39+
@StateObject private var containerViewModel: BookingListContainerViewModel
4140

4241
init(siteID: Int64) {
43-
self.siteID = siteID
42+
_containerViewModel = StateObject(wrappedValue: BookingListContainerViewModel(siteID: siteID))
4443
}
4544

4645
var body: some View {
4746
NavigationSplitView(columnVisibility: $visibility) {
48-
BookingListContainerView(viewModel: BookingListContainerViewModel(siteID: siteID))
47+
BookingListContainerView(viewModel: containerViewModel)
4948
} detail: {
5049
Text("Booking Detail Screen")
5150
}
@@ -54,7 +53,6 @@ struct BookingsTabView: View {
5453
if connectivityMonitor.isOffline {
5554
OfflineBannerViewRepresentable()
5655
.frame(height: OfflineBannerView.height)
57-
.transition(.move(edge: .bottom).combined(with: .opacity))
5856
}
5957
}
6058
}

WooCommerce/Classes/ViewRelated/ReusableViews/OfflineBannerView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ final class OfflineBannerView: UIView {
3636
messageLabel.text = NSLocalizedString("Offline - using cached data", comment: "Message for offline banner")
3737
messageLabel.applyCalloutStyle()
3838
messageLabel.textColor = .white
39+
messageLabel.adjustsFontForContentSizeCategory = false
40+
messageLabel.adjustsFontSizeToFitWidth = true
3941
messageLabel.translatesAutoresizingMaskIntoConstraints = false
4042

4143
stackView.addArrangedSubview(imageView)
4244
stackView.addArrangedSubview(messageLabel)
4345

4446
addSubview(stackView)
4547
NSLayoutConstraint.activate([
46-
stackView.safeLeadingAnchor.constraint(greaterThanOrEqualTo: safeLeadingAnchor, constant: 0),
47-
stackView.safeBottomAnchor.constraint(greaterThanOrEqualTo: safeBottomAnchor, constant: 0),
48+
stackView.safeLeadingAnchor.constraint(greaterThanOrEqualTo: safeLeadingAnchor, constant: 8),
49+
stackView.safeBottomAnchor.constraint(greaterThanOrEqualTo: safeBottomAnchor, constant: 8),
4850
stackView.centerXAnchor.constraint(equalTo: centerXAnchor),
4951
stackView.centerYAnchor.constraint(equalTo: centerYAnchor)
5052
])

0 commit comments

Comments
 (0)