-
Notifications
You must be signed in to change notification settings - Fork 98
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
Setting navigationBarTitleDisplayMode doesn't work for modal routing. #71
Comments
Hi, there is a branch that might solve this issue: navbarless. Could you please test it out and see if it works? I'm not 100% done with it yet, so I haven't merged it... |
Thanks for the reply. It works on the |
Do you have any ETA on the branch to be merged in or at least stable for production? |
There are still some bugs left to fix (try for instance presenting a modal screen and then pushing a new one), I'll look into it this week and hopefully fix it. |
To work with the current state of Stinsen (and how I think it should properly be), instead of creating an explicit Change from your example to: final class TestCoordinator: NavigationCoordinatable {
(...)
@Route(.modal) var newCall = makeNewCallView
func makeNewCallView() -> NavigationViewCoordinator<NewCallCoordinator> {
NavigationViewCoordinator(NewCallCoordinator())
}
} and create: final class NewCallCoordinator: NavigationCoordinatable {
let stack = NavigationStack(initial: \NewCallCoordinator.start)
@Root
var start = makeStart
@ViewBuilder
func makeStart() -> some View {
Text("Hello There")
.navigationBarTitleDisplayMode(.inline) // This will be inlined
.navigationTitle("Inline Me")
}
} Names are just used for examples. I have used this pattern ever since I used Stinsen as I feel it's how its supposed to work by handling the |
I agree here. Modally presenting a NavigationView is not really the "Stinsen"-esque way. Usually you'd want to present a Coordinator here. This might be a bit tricky to fix since Stinsen needs to "inject" it's navigation-logic inside the view presented by the NavigationView, not the navigationview itself... I haven't had time to look for an alternative solution yet, but this is probably the top priority issue I want to attempt to fix at least. But as @LePips says, there are workarounds that are "better". |
When presenting a modal view using
router.route(to: \.newCall)
the navigation title is always displayed as.large
even though the view has.navigationBarTitleDisplayMode
set to.inline
. It doesn't happen when the same view is presented using standard SwiftUI.sheet
.iPhone
router.route(to: \.newCall)
:.sheet
:Code from the parent view and the coordinator:
The text was updated successfully, but these errors were encountered: