Closed whitescent closed 2 months ago
Just created a new project to test it, but still encountering this issue
Is this sample on GitHub? Can I get the link?
Is this sample on GitHub? Can I get the link?
ok i will create
this is a new project to test v2 https://github.com/whitescent/compose-destination-issue @raamcosta
https://github.com/whitescent/Mastify This is a project I am planning to migrate to v2
Can you try adding , start = true)
to one of your graphs? Login for example?
Looking at the sample from a glance, this seems missing, but obviously there should be a helpful error message rather than just not generating anything 😜
so if this is indeed the issue, I’ll need to improve it 👍
Can you try adding
, start = true)
to one of your graphs? Login for example?
yes, still missing
Ok let me run it locally
Found it 🐞
For now, please add this:
@NavHostGraph
annotation class MainGraph
And use MainGraph instead of RootGraph. Also on Activity, NavGraphs.main.
Later when I release a new version, you can go back to using RootGraph 😄
Thank you for reporting 🙏
So I can start by writing code like this:
@NavHostGraph
annotation class MainNavGraph
@NavGraph<MainNavGraph>
annotation class LoginNavGraph
@NavGraph<MainNavGraph>
annotation class AppNavGraph
@Destination<AppNavGraph>
@Composable
right?
Later when I release a new version, you can go back to using RootGraph 😄
Thank you for all your hard work 😄👍
Don't forget that each nav graph needs a start. So probably missing start = true
on some of those :)
@raamcosta i just test the SharedElement Transition in last v2 version(2.1.0-beta02), But AnimatedVisibilityScope
it is not automatically provided.
code:
SharedTransitionLayout {
DestinationsNavHost(
navGraph = NavGraphs.main,
dependenciesContainerBuilder = {
dependency(this@SharedTransitionLayout)
}
)
}
@OptIn(ExperimentalSharedTransitionApi::class)
@Destination<HomeNavGraph>(start = true)
@Composable
fun SharedTransitionScope.Home(
navigator: DestinationsNavigator,
animatedVisibilityScope: AnimatedVisibilityScope
) {
Column {
Text(
text = "home Screen",
modifier = Modifier.sharedElement(
state = rememberSharedContentState(key = "text"),
animatedVisibilityScope = animatedVisibilityScope
)
)
Button(
onClick = { /*TODO*/ }
) {
}
}
}
@OptIn(ExperimentalSharedTransitionApi::class)
@Destination<LoginNavGraph>(start = true)
@Composable
fun SharedTransitionScope.Login(
navigator: DestinationsNavigator,
animatedVisibilityScope: AnimatedVisibilityScope
) {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Column {
Text(
text = "Login Screen",
modifier = Modifier.sharedElement(
state = rememberSharedContentState(key = "text"),
animatedVisibilityScope = animatedVisibilityScope
)
)
Button(
onClick = {}
) {
}
}
}
}
could you please check this issue? 🤓
ahh, I missed the import. The example I had was already importing it for some other reason 😛
Will fix this, thank you!
Try 2.1.0-beta03 coming up within 30min or so.
My project is Single Module, and this is my NavGraphs looks like in V1
There are also some destinations that don't belong to any NavGraph of these(LoginNavGraph, AppNavGraph) two
but my NavGraphs in V2 is:
If I'm not mistaken, I have changed all the code in v1 from
to
but the generated NavGraphs still seem to have this error 🤔.