-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
RegisterScreen:transition was used multiple times #410
Comments
I think problem occurs when multiple click to navigate or same screen popud. If u remove SlideAnimation etc.. error can be gone. But I applied this solution for my project. I hope solver your problem.
|
Thanks for your tip. I will try to apply it, while there is no solution from the library. From what I've seen, this error has been known for some time, but so far it still persists. |
Face the same error. I used the 1.0.0 tho. Edit: i tried 1.1.0 alpha04 and still the transition error |
I face the same crash,but i am upgrading to kotlin |
Hi, i just found out something:
|
thanks mate this worked for me |
Does this also happen when using |
The error does not occur when I use 'override val key = uniqueScreenKey', but there is duplication of navigation. I will test 'dropUnlessResumed' for click |
Same is happening to me, if I remove SlideTransition I lose "back" functionality using if (navigator.canPop) navigator.pop(), and if I have SlideTransition, when I do navigator.pop() it shows the same screen from where I'm navigating after animating like if it was going to a different one. But in this project: https://github.com/YanneckReiss/compose-multiplatform-navigation-voyager-showcase it is working somehow |
Last time i tried, it doesnt work. So i use debounced click instead from this. |
I faced this problem too when a navigation button was clicked twice quickly, causing the app to crash during the transition. My solution was to check if the destination screen is the same as the current one and avoid calling navigator.push. Here's the extension on the Navigator I made:
usage: Hope this helps! |
@elsheikhayman Thank you for your comment! I tried it, but unfortunately it didn't work for me. I debugged the stack items and the last item and apparently it is fine and no screen is present twice, also the last screen in the stack is always the one I'm in. The navigation is ScreenA -> ScreenB -> ScreenC, and for some reason I can't do pop or popUntil to navigate back, but I can do popAll or popUntilRoot. When I click on a something that uses pop or popUntil in ScreenC, the stack gets printed like: stack -> ScreenA,ScreenB, lastItem -> ScreenB, just after that it automatically prints: stack -> ScreenA,ScreenB,ScreenC, last item -> ScreenC, like if it was navigating again to the same screen where it is. |
I got it working after long debugging, I realized I was holding the screen state and actions in the screen model with a sealed interface, creating a mutableStateFlow, and subscribing to it via observeAsState in the Screen to respond appropriately, if I remove this the navigation works perfectly, I don't get the "Transition was used multiple times" (with and without SlideTransition) and even the pop function works. It is the only solution I got working, but I don't like handling states in the UI, is this going to be fixed anytime soon or am I doing something wrong? Thanks Edit: Edit 2: |
You can browse based on state and every time you browse, you clear the state immediately.
|
No it Doesn't work with |
There is an issue I run into when I quickly double click a button that navigates to another screen in my Compose.
it looks like androidx.lifecycle:lifecycle added dropUnlessResumed in version 2.8.0-alpha02.
https://developer.android.com/jetpack/androidx/releases/lifecycle?hl=pt-br
I tested with version 2.8.0-rc01, but I got the error: CompositionLocal LocalLifecycleOwner not present.
voyager = "1.1.0-alpha04"
composeBom = "2024.05.00"
kotlin = "1.9.23"
The text was updated successfully, but these errors were encountered: