-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
ArrayList<Enum> nav args crashing #592
Comments
Hi @stanleyguevara ! I have no idea how this was like this for so long, thank you so much for taking the time to report 🙇 I will fix it and release a new version, today still. In the meantime, as you found, Array work fine until that is done! |
@stanleyguevara please try 1.10.2. Thank you again so much for reporting this! 👍 |
Hey @raamcosta just to let you know there is still a problem in 1.10.2 when passing an ArrayList and the list is empty. java.lang.StringIndexOutOfBoundsException: String index out of range: -2 Not sure why. My current solution is to make it nullable, and pass null when empty. |
Hi @ehammo I cannot reproduce this on my machine. Can you tell me more about the nav arguments of this destination? Is it the only nav arg? Thank you! |
This is how the code looks like: data class MyCustomNavArg( data class AnotherDataClass( @destination(navArgsDelegate = MyCustomNavArg::class) @destination Route looks like this: |
I still can't reproduce it. Here is the exact code I'm using. @Parcelize
data class MyCustomNavArg(
val optionalString: String? = null,
val listOfEnum: ArrayList<Stuff> = ArrayList(),
) : Parcelable
@Parcelize
data class AnotherDataClass(
val optionalString: String? = null,
val listOfEnum: List<Stuff> = listOf(),
) : Parcelable
@Destination(navArgsDelegate = MyCustomNavArg::class)
@Composable
fun MyCustom(navArgs: MyCustomNavArg) {
Text(navArgs.toString())
}
@Destination
@Composable
fun Another(
navigator: DestinationsNavigator,
) {
val data = remember { AnotherDataClass(optionalString = "String") }
LaunchedEffect(data) {
delay(500)
navigator.navigate(
MyCustomDestination(
optionalString = data.optionalString,
listOfEnum = ArrayList(data.listOfEnum)
)
)
}
} The route is
|
Hello, first of all thanks for this lib, it really makes underlying jetpack library way less of a PITA :)
I think I've found a bug, it might be on base library though.
Either way docs would need an update, as those say:
So it seems like
ArrayList<Enum>
should work too, meanwhile:The crash is:
This happens on 1.10.1 as well as 1.9.63 as far as I've checked. I can share full repo if needed, but it should be pretty easy to replicate, just copy&paste the above, it's pretty much all there is to it.
The text was updated successfully, but these errors were encountered: