SwiftfulThinking / SwiftfulRouting

Programmatic navigation for SwiftUI applications.
https://www.swiftful-thinking.com/
MIT License
461 stars 31 forks source link

When i push to new screen, tabbar disappears. #78

Open Cavidan998 opened 4 hours ago

Cavidan998 commented 4 hours ago

Tabbar is only shown in first screen, i dont hide tabbar, but when push tabbar stay on old screen, does not cross to new screen. Anyone face that problem?

SwiftfulThinking commented 4 hours ago

In SwiftUI, you determine this behavior by putting the NavigationStack inside or outside of the TabView. This is the same behavior for using native NavigationStack or RouterView...

// Each tab has a NavigationStack and does not hide tabbar
TabView {
     RouterView { router in
          Text("Screen1")
     }
}
// The entire tabbar has one NavigationStack that does hide tabbar
RouterView { router in
     TabView {
          Text("Screen1")
     }
}
Cavidan998 commented 4 hours ago

Thanks for quick response , i will check this

Cavidan998 commented 3 hours ago

I think after IOS 18, this problem appeared. I tested your code, it does not work. But this case worked before IOS 18, did you test your code in any project

Cavidan998 commented 2 hours ago

Problem is on showScreen(.push) it does not work correctly

SwiftfulThinking commented 1 hour ago

Can you provide sample code example that does not work?

Cavidan998 commented 35 minutes ago

there are a lot of codes. I found problem, problem is when i put

RouterView { router in TabsView(viewModel: TabsViewModel()) }

problem occur.

But when i use

TabsView(viewModel: TabsViewModel())

it works.

I dont understand, why?

Cavidan998 commented 12 minutes ago

After 16 hours of testing all cases. i found how to solve.

RouterView(addNavigationView: false) { router in }

this solved problem.