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

SwiftUI message shown under navigation bar is clipped at top #538

Open
klanchman opened this issue Nov 30, 2023 · 1 comment
Open

SwiftUI message shown under navigation bar is clipped at top #538

klanchman opened this issue Nov 30, 2023 · 1 comment
Labels

Comments

@klanchman
Copy link

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

Simulator Screenshot - iPhone 15 Pro - 2023-11-30 at 00 08 40

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 😄

@wtmoose
Copy link
Member

wtmoose commented Nov 30, 2023

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.

@wtmoose wtmoose added the bug label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants