Comments (15)
You can browse based on state and every time you browse, you clear the state immediately.
LaunchedEffect(state.navigateToScreen) {
state.navigateToScreen?.let {
navigationToConfirmRegister()
action(SignupAction.ClearNavigate)
}
}
from voyager.
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.
override val key: ScreenKey = super.key + "${Random.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE)}"
from voyager.
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.
override val key: ScreenKey = super.key + "${Random.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE)}"
thanks mate this worked for me
from voyager.
I will test 'dropUnlessResumed' for click
Last time i tried, it doesnt work. So i use debounced click instead from this.
from voyager.
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.
from voyager.
Face the same error. I used the 1.0.0 tho.
Edit: i tried 1.1.0 alpha04 and still the transition error
from voyager.
I face the same crash,but i am upgrading to kotlin 2.0.0-RC2
and use release apk (r8), when I had open a object
screen, and then open another object
screen, app will be crash with it, i'm not sure what's the reason for that at the moment.
ps: seem use data object
can solve my problem.
from voyager.
Hi, i just found out something:
dropUnlessResumed
not working for this, not because of lifecycle owner, but when you click that quickly, the state is still resumed (check screenshot below)- We can pass our own LifecycleOwner, but make sure you use LocalLifecyleOwner from
androidx.compose.ui.platform
, not the one fromandroidx.lifecycle.compose
.
from voyager.
Does this also happen when using override val key = uniqueScreenKey
?
https://voyager.adriel.cafe/state-restoration#identifying-screens
from voyager.
The error does not occur when I use 'override val key = uniqueScreenKey', but there is duplication of navigation. I will test 'dropUnlessResumed' for click
from voyager.
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
from voyager.
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:
private inline fun <reified T : Screen> Navigator.navigate(screen: T) { if (lastItem !is T) { push(screen) } }
usage:
navigator.navigate(OnBoardingStep2Screen())
Hope this helps!
from voyager.
@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.
from voyager.
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:
If I use the state as described in https://voyager.adriel.cafe/screenmodel/coroutines-integration/, and I don't navigate based on the subscribed state it also works, but I think this is not how it should work.
Edit 2:
If you put a log on every screen to debug the navigation Stack you will see that it gets printed multiple times, if you navigate based on a subscribed state, it's not going to work fine since you will be doing it multiple times or at least that's my theory at the moment. No subscribed navigation, no problem.
from voyager.
Does this also happen when using
override val key = uniqueScreenKey
? https://voyager.adriel.cafe/state-restoration#identifying-screens
No it Doesn't work with uniqueScreenKey
.
from voyager.
Related Issues (20)
- Nested Screen in Bottom Navigation
- Voyager 1.1.0-beta01 issues HOT 5
- navigator will close automatically HOT 3
- CompositionLocal LocalLifecycleOwner not present HOT 2
- Compose multiplatform build failed HOT 2
- Popping navigator in background doesn't work
- navigator.pop() followed by navigator.push(screen) does not dispose the ScreenModel from the popped screen HOT 6
- Crash on Android because ScreenTransition do not inherit from Serializable HOT 4
- Double Navigation Bar Issue. HOT 1
- Can't pass the Dynamic Data using Tab Navigator
- iOS swipe to close does not work HOT 1
- Koin ScreenModel inject crash starting from 1.1.0-alpha04 HOT 1
- Screen transition broken in 1.1.0-beta02
- Can't pop root in Compose for Desktop
- [Desktop] Density is not updated on changing the window to a screen with different density
- [KMP ViewModels][Voyager][Koin] Crush if you try to navigate back
- Override the back press in each Screen in Compose Multiplatform HOT 3
- Snackbar overlapped by BottomSheet when using BottomSheetNavigator
- HorizontalPager HOT 1
- [WASM] [Font] tofu are displayed instead of the actual font HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from voyager.