Comments (6)
@stanleyguevara please try 1.10.2. Thank you again so much for reporting this! 👍
from compose-destinations.
Hi @stanleyguevara !
I have no idea how this was like this for so long, thank you so much for taking the time to report 🙇
Indeed there's an issue specifically with ArrayList.
I will fix it and release a new version, today still. In the meantime, as you found, Array work fine until that is done!
from compose-destinations.
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.
When the list is empty I get this crash:
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.String.substring(String.java:2064)
at java.lang.String.subSequence(String.java:2107)
at com.ramcosta.composedestinations.navargs.primitives.arraylist.DestinationsEnumArrayListNavType.parseValue(DestinationsEnumArrayListNavType.kt:31
Not sure why. My current solution is to make it nullable, and pass null when empty.
from compose-destinations.
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?
It would also be nice if you could go into DestinationsNavController.navigate
method and place a breakpoint in there and tell me how the route parameter looks like.
Thank you!
from compose-destinations.
This is how the code looks like:
data class MyCustomNavArg(
val optionalString: String? = null,
val listOfEnum: ArrayList = ArrayList(),
) : Parcelable
data class AnotherDataClass(
val optionalString: String? = null,
val listOfEnum: List = listOf(),
) : Parcelable
@destination(navArgsDelegate = MyCustomNavArg::class)
@composable
fun MyCustomDestination(...
@destination
@composable
fun AnotherDestination(
navigator: DestinationsNavigator,
) {
data: AnotherDataClass = AnotherDataClass(optionalString = "String")
navigator.navigate(
MyCustomDestination(
optionalString = data.optionalString,
listOfEnum = ArrayList(data.list)
)
)
}
Route looks like this:
"my_custom_destination?optionalString=String&listOfEnum="
from compose-destinations.
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 my_custom?optionalString=String&listOfEnum=[]
. I am navigating to the "AnotherDestination" which then automatically navigates to "MyCustomDestination" after 500ms.
Stuff
is a enum class.
from compose-destinations.
Related Issues (20)
- ModuleDestinations$Includes is defined multiple times in Multi-Module project HOT 4
- [ksp] java.lang.NullPointerException when using custom NavArgument type HOT 13
- No NavGraphs in V2 HOT 14
- Support for Shared Element Transition. HOT 2
- Tab navigation support. HOT 1
- Can not make dependenciesContainerBuilder example work HOT 2
- Serializer for class 'DirectionImpl' is not found in v2 HOT 10
- [2.1.0-beta03] Navgraphs.* cannot be imported in the generated NavGraphs HOT 3
- navargs.* cannot be imported in ArgsToSavedStateHandle.kt HOT 2
- HorizontalPager pageContent can't save state HOT 2
- NavGraphArhs are visible only in "start" destination HOT 6
- Removing from composition and re-adding when navigating HOT 3
- java.lang.IllegalStateException: Duplicate route found X_destination'. Routes must be unique!. In Muli-module project. HOT 2
- Missing classes detected while running R8 on AGP 8.4.0 HOT 2
- Video tutorials for using the library. HOT 1
- [KSP][2.1.0] _ModuleRegistry missing visibility modifiers HOT 4
- [DEEPLINK][2.1.0] Request to bring back withDeepLink() HOT 9
- Can compose-destinations used in compose for desktop project ? HOT 1
- Accompanist Navigation Material functionality now available in androidx.compose.material.navigation.*
- "Reproducible build" possible with Compose Destinations? HOT 3
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 compose-destinations.