rundfunk47 / stinsen

Coordinators in SwiftUI. Simple, powerful and elegant.
MIT License
905 stars 93 forks source link

Hidden navigation bar shows up after showing modal in detail screen #57

Open YuantongL opened 2 years ago

YuantongL commented 2 years ago

Hello, I found an interesting behavior in my project, I've spending a lot of time figuring out the root cause but I'm still unable to, posting here to determine if this is a bug or not.

Here is a video of the issue that demonstrate the issue:

https://user-images.githubusercontent.com/10422762/156937516-f28e19f4-8afc-46c5-a8bb-68dad1617cae.mov

This is an example project that will repro the issue in the video: stinsen-example.zip

rundfunk47 commented 2 years ago

Hi! Sorry for the late answer. I have a branch navbarless. Can you try that and see if it solves your issue?

YuantongL commented 2 years ago

That does not solve my issue. I'm actually thinking this is a SwiftUI bug since I've been testing with an example without using Stinsen at all, I use TabView and NavigationView and NavigationLink to replicate the same situation, couldn't get it to work nither.

It seems to me that SwiftUI does not work well when you put TabView inside of a NavigationView.

YuantongL commented 2 years ago

I might found a solution but not entirely understand the rationale under it, I was looking at this answer https://stackoverflow.com/a/57518324/7904148, then I added .navigationTitle("") to the root views under each tab, .navigationBarHidden(true) was kept for sure, then the problem seems solved magically. 🤭

bgannin commented 2 years ago

I'm not surprised that it worked - the navigationTitle modifier would force it to render a navigation bar and then apply the navigationBarHidden modifier as you originally expected. Not correct, definitely file a Feedback issue for the SwiftUI team. They are responsive, especially when you are able to provide an example like this one without any dependencies and an explanation of known workaround.