Skip to content

Commit

Permalink
Ensure MSFNotification doesn't internally handle safe areas (#2099)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-cap authored Oct 21, 2024
1 parent 38954a2 commit f1ebf87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import UIKit
self.isFlexibleWidthToast = isFlexibleWidthToast && style.isToast
notification = FluentNotification(style: style,
shouldSelfPresent: false)
super.init(AnyView(notification))
super.init(AnyView(notification), safeAreaRegions: [])
let defaultDismissAction = { [weak self] in
guard let strongSelf = self else {
return
Expand Down
9 changes: 8 additions & 1 deletion Sources/FluentUI_iOS/Core/ControlHostingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ open class ControlHostingView: UIView {
/// the control view in an `AnyView.`
///
/// - Parameter controlView: An `AnyView`-wrapped component to host.
public init(_ controlView: AnyView) {
/// - Parameter safeAreaRegions: Passthrough to the respective property on UIHostingController.
/// Indicates which safe area regions the underlying hosting controller should add to its view.
public init(_ controlView: AnyView, safeAreaRegions: SafeAreaRegions = .all) {
hostingController = FluentThemedHostingController.init(rootView: controlView)
hostingController.sizingOptions = [.intrinsicContentSize]

if #available(iOS 16.4, *) {
hostingController.safeAreaRegions = safeAreaRegions
}

super.init(frame: .zero)

self.configureHostedView()
Expand Down

0 comments on commit f1ebf87

Please sign in to comment.