Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure MSFNotification doesn't internally handle safe areas #2099

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading