SwiftUI message shown under navigation bar is clipped at top
Opened this issue · 1 comments
When displaying a SwiftUI-based message view below the navigation bar, the top of the message view is clipped by 5pts.
Here's a sample project that illustrates the issue: SwiftMessagesHostedTopMargin.zip
I traced around and it looks like the 5pt offset is coming from TopBottomAnimation.swift around lines 93~101 (bounceOffset
). For UIKit-based message views the adjustMargins()
function mitigates this, but I guess the layoutMargins
aren't making it through the UIHostingController
for some reason. (I tried adding very large layoutMarginAdditions
to the MessageHostingView
and nothing happened.)
Once I found where the 5 was coming from, I felt satisfied with simply adding 5pts of padding to the top of my SwiftUI message view since I only ever present it below a navigation bar. But I assume that may not work for everyone 😄
Hmm, yeah. Thanks for bringing that up. The way SwiftMessages deals with safe area in UIKit is totally not applicable in SwiftUI. I need to think on it, but at least the workaround is pretty simple.