[Problem/Question]
NavigationBar issue with SwiftUI SDK when a TabView is used.
We found out there is an issue while launching a a the ChannelGroupView using the .groupChannelView method from the GroupChannelListView when it is inside a TabView.
The TabView + HostedController (embedded in the SDK) is provoking the navbar to be added twice resulting in an unwanted top margin (cf screenshot). Processing: Screenshot 2024-09-17 at
Hi @GetChivy
I just checked this issue.
Could you check the following to try to resolve the issue?
Sendbird SwiftUI is provided by hosting viewControllers of Sendbird UIKit.
During this process, the navigation settings are also set in UIKit, and Sendbird SwiftUI should use the navigationBar configured in Sendbird UIKit.
When using Sendbird SwiftUI functionality, multiple navigationBars can be exposed if the navigationBar exposed by the SwiftUI is not hidden.
To work around this issue in the current version, you can add the following options to View.
var body: some View {
TabView {
GroupChannelListView()
.tabItem {
Image(systemName: "person")
}
}
.navigationBarHidden(true) // <-- Add this logic
}
Hi @GetChivy,
Sorry for the late check!
I found the problem when using it as a modal type and reproduced the same as you.
I have done some rough testing on this and will be releasing a new version with the fix.
And I will comment back when it’s released.
Awesome Tez ! Thanks for the feedback, really appreciate.
To help debugging :
I used the modal in the QuickStartSwiftUI project to have a separated Tabbar independent from the main navigation of this project.
However, the issue is not related to the “modal”, but it’s definitely related to the “tabbar”.
Also, with a simple regular tabbar as the main navigation, this double navbar appears just like on the previous screenshot.
Thanks for the quick reply.
I said modal, but it meant presented style.
In the screenshot in question, a tabview based screen is being presented as a modal style.
Sendbird SwiftUI are using uikit’s viewController hosted, and if it is displayed in a modal style in SwiftUi, we will need to modify internal hierarchy search logic.
I’d like to test this a bit more thoroughly, so could you share the your test code to show how you got the tabview based screen to draw the modal style on the screen?
Hi @GetChivy
I have done a lot of internal testing and fixed the issues, including the one you commented on at the end.
I will be releasing a new version within the next week or so.
Thanks for the feedback!