Open RavenLiao opened 6 months ago
Hi! I happened to have the same issue (just on one bottom sheet and just in release builds, not in debug ones). Do I have to both remove the SlideTransition
and remove the BottomSheetNavigator
altogether?
I don't know if it helps, but in my case I have the BottomSheetNavigator
as parent and the root navigator as a child, the crash happens just when I call show(screen: Screen)
on the former.
EDIT: I realized I am using a third Navigator inside the bottom sheet content, and that is the cause of the issue, this explains why it crashes only with that bottom sheet and not the other plain ones.
Hi! I happened to have the same issue (just on one bottom sheet and just in release builds, not in debug ones). Do I have to both remove the
SlideTransition
and remove theBottomSheetNavigator
altogether?I don't know if it helps, but in my case I have the
BottomSheetNavigator
as parent and the root navigator as a child, the crash happens just when I callshow(screen: Screen)
on the former.EDIT: I realized I am using a third Navigator inside the bottom sheet content, and that is the cause of the issue, this explains why it crashes only with that bottom sheet and not the other plain ones.
Now I use the following code to use BottomSheetNavigator and Transition simultaneously . I hope it will help you.
Navigator(MainScreen) { navigator ->
GlobalNavigatorWrapper(navigator) {
MyBottomSheetNavigator {
ParcelableNavigatorWrapper {
MyCustomTransition(navigator) { screen ->
screen.Content()
}
}
}
}
}
@OptIn(ExperimentalVoyagerApi::class)
@Composable
fun ParcelableNavigatorWrapper(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalNavigatorSaver provides parcelableNavigatorSaver(),
content = content
)
}
val LocalGlobalNavigator: ProvidableCompositionLocal<Navigator> =
staticCompositionLocalOf { error("LocalGlobalNavigator not initialized") }
@Composable
fun GlobalNavigatorWrapper(navigator: Navigator, content: @Composable () -> Unit) {
CompositionLocalProvider(LocalGlobalNavigator provides navigator, content)
}
I am removing the nested navigator inside the bottom sheet, I do not actually need it and can achieve a similar behaviour with Crossfade
to have a transition.
version
v1.0.0
example code
crash log
after clik "jump with BottomSheetNavigator" button will crash:
avoid crash