-
Notifications
You must be signed in to change notification settings - Fork 87
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
popping a view makes the previous view non clickable #12
Comments
Hi @divyanshunegi, thanks for asking. I'd be really happy to help you debugging this issue, would you be able to provide me with a minimum example that causes the problem? I'm asking because I tried to reproduce this issue by myself, but I didn't manage to. Take a look at this silly example below which exploits a scroll view and the navigation stack:
it seems that everything is fine. I guess it's something related to your specific case. Let's try to get what's happening together. |
Here in this GIF you can see, I have created a custom TApBar which shows the screens as per a Binding value count, when I am in contact page and enter any Navigation view, and pop back, My tapbar shows its value in the center which is not its original state before entering the navigation. This is somewhat related to the non clicky behaviour I observed in my production app which I cannot share here due to NDA 😵 |
This is contentView
and this is the scroll view code :
|
Hi @divyanshunegi, sorry for the late reply. What you are observing in this GIF is explained in the Issues section of the README file: when a view is removed from a view hierarchy the State gets reset. The State property you use to set the bar gets reset during the navigation. In order to avoid this (which can't be fixed in the current version of SwiftUI) you have to create a view model and put the State property there instead of having it as a State property in your view. You have to change this (just an example):
To this:
Matteo |
I have a home screen with 3 Tabs one of the tab has scroll view with some clickable items, on pushing this navigation view stack, and popping back the view remains non-clickable unless the scroll is moved a little and then everything is back to clickable again.
HELP!
The text was updated successfully, but these errors were encountered: