Closed nunocaseiro closed 3 months ago
Hey @nunocaseiro, thanks for reaching out. Can you maybe share a specific SwiftUI code example?
Hey @erikdrobne, this scenario is simple to recreate. I also used your example project to test if the behavior is the same.
So I have a view A and a view B. In both views I added the .navigationBarBackButtonHidden(true)
and I always see the back button during the push animation.
Can you help me?
Thank you
@nunocaseiro I would suggest using .navigationBarHidden(true)
which will also hide it during the transition.
You can take a look here:
https://github.com/user-attachments/assets/947f5810-0ec3-418b-8241-30b125786673
@erikdrobne Yeah, but I have a custom navigation bar with a custom back button and I don't want to hide it :D
Do you have another suggestion?
@nunocaseiro
Can you add this piece of code to the RouteHostingController
and check whether it works for you?
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Hide the back button
self.navigationItem.setHidesBackButton(true, animated: true)
}
public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Show the back button again when this view is about to disappear
self.navigationItem.setHidesBackButton(false, animated: true)
}
Yes, it works! Keep up your excellent work
It's really useful, thank you
@nunocaseiro If you have time, you can add a route parameter to hide the back button during navigation. Then, submit a PR to close this issue.
Hello,
Thanks for sharing this great lib. How can I hide the back navigation button and the title during the navigation?
I have a navbar modifier in swifui which has
.navigationBarBackButtonHidden(true)
and it doesn't work during the transitionBest regards