Marko Novina
11/10/2022, 6:54 AMe: /***/shared/src/commonMain/kotlin/*/*/*/root/RootComponent.kt: (38, 10): This class does not have a constructor
Line that reports is where I use @Parcelize
annotation.
I use latest version of decompose: 1.0.0-alpha-07-native-compose.
I will share code in 🧵 ⬇️Tadeas Kriz
11/11/2022, 6:54 PMchildContext
requires a key String
which I don't have. Also the number of items in the grid is dynamic, there will be more and less during the lifetime of the grid component.xxfast
11/19/2022, 12:59 AM0.6.0
-> 1.0.0-alpha07
but i'm unable resolve the references on Android Studio Electric Eel 2022.1.1 Beta 5. The build just works fine so Im pretty sure this is an IDE issue. Any known workarounds for this? Related to https://github.com/arkivanov/Decompose/issues/190 i thinkArkadii Ivanov
11/19/2022, 9:01 AMArkadii Ivanov
11/19/2022, 9:03 AMArkadii Ivanov
11/19/2022, 10:10 PM1.0.0-beta-01
!
- Added SimpleNavigation
and exposed SimpleChildNavState
for custom navigation implementations
- Added main thread checks to MutableValue
Provide old and new child stacks in StackRouterView#children
function
- Added disableInputDuringAnimation
argument to stackAnimation
function
- Converted StackAnimation
and StackAnimator
interfaces to fun
interfaces
- Moved StackNavigation
and OverlayNavigation
factory functions next to the corresponding interfaces
Please read the release notes - https://github.com/arkivanov/Decompose/releases/tag/1.0.0-beta-01Marko Novina
11/26/2022, 12:43 PMxxfast
11/28/2022, 11:55 PMback-pressed
to back-handler
api to enable predictive back for jetbrains-compose
with the new StackNavigation
. Previously (as of 0.6.0) we had to do
val LocalBackPressedHandler: ProvidableCompositionLocal<BackPressedHandler?> = staticCompositionLocalOf { null }
// On activity
val backPressedHandler = BackPressedHandler(onBackPressedDispatcher)
setContent {
CompositionLocalProvider(LocalBackPressedHandler provides backPressedHandler) {
..
}
}
is this no longer necessary given the ChildStack
has a handleBackButton
?Marc
12/01/2022, 7:23 PMrcd27
12/01/2022, 11:00 PMdecompose
samples. Check this out, compiler complains, however build is OK and I actually can get the instance during runtime. The build.kts for this module is:
...
sourceSets {
all {
languageSettings.apply {
optIn("kotlin.RequiresOptIn")
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
optIn("org.jetbrains.compose.ExperimentalComposeLibrary")
}
}
val androidMain by getting {
dependencies {
api("androidx.appcompat:appcompat:1.5.1")
implementation("androidx.compose.material3:material3:1.1.0-alpha02")
implementation("androidx.compose.material3:material3-window-size-class:1.1.0-alpha02")
}
}
val commonMain by getting {
dependencies {
implementation(project(":shared"))
api(compose.runtime)
api(compose.foundation)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
api(compose.material3)
// Decompose
implementation("com.arkivanov.decompose:decompose:1.0.0-beta-01")
// Value<T>.subscribeAsState()
implementation("com.arkivanov.decompose:extensions-compose-jetbrains:1.0.0-beta-01")
}
}
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
}
}
}
...
Arkadii Ivanov
12/16/2022, 12:00 PM1.0.0-beta-02
is released!
- Added minAlpha
argument to fade animator
- Added a convenience overload function ComponentContext#children
with Parcelable
navigation state
- Applied parcelize-darwin plugin, updated Essenty to 0.7.0
Release notes: https://github.com/arkivanov/Decompose/releases/tag/1.0.0-beta-02rcd27
12/23/2022, 8:20 AM@Preview
annotation in decompose
samples. Do they work actually, or is there any hack around KMP to use preview feature yet? Please, share.Bogdan Cordier
12/29/2022, 8:36 AMAdam Brown
12/29/2022, 8:51 PMIncompatibleComposeRuntimeVersionException: The Compose Compiler requires the Compose Runtime to be on the class path, but none could be found. The compose compiler plugin you are using (version 1.3.2) expects a minimum runtime version of 1.0.0.
Anyone run into this before?Arkadii Ivanov
01/04/2023, 1:22 PM1.0.0-beta-03
is released!
- Added backStackCreateDepth
argument to Child Stack
- Added persistent
argument to Child Stack
- Updated Essenty to 0.8.0 (state preservation on JVM/desktop)
Release notes: https://github.com/arkivanov/Decompose/releases/tag/1.0.0-beta-03Adam Brown
01/09/2023, 11:14 PMFrancis Mariano
01/11/2023, 5:41 PMAdam Brown
01/20/2023, 2:31 AMMarko Novina
01/25/2023, 8:23 AMsigmadelta
01/25/2023, 3:27 PMmain
& io
`CoroutineContext`s are defined. On the documentation page (https://arkivanov.github.io/Decompose/component/scopes/#creating-a-coroutinescope-in-a-component) I found following sample:
fun CoroutineScope(context: CoroutineContext, lifecycle: Lifecycle): CoroutineScope {
val scope = CoroutineScope(context)
lifecycle.doOnDestroy(scope::cancel)
return scope
}
fun LifecycleOwner.coroutineScope(context: CoroutineContext): CoroutineScope =
CoroutineScope(context, lifecycle)
class SomeComponent(
componentContext: ComponentContext,
mainContext: CoroutineContext,
private val ioContext: CoroutineContext,
) : ComponentContext by componentContext {
// The scope is automatically cancelled when the component is destroyed
private val scope = coroutineScope(mainContext + SupervisorJob())
fun foo() {
scope.launch {
val result =
withContext(ioContext) {
"Result" // Result from background thread
}
println(result) // Handle the result on main thread
}
}
}
In the SomeComponent
constructor you are passing mainContext
and ioContext
. Do these need to be defined in the RootComponent
or just the parent component? And aside from that, how exactly are they instantiated?
Thanks againSlackbot
01/26/2023, 6:47 AMMarc
01/27/2023, 10:02 AMAdam Brown
01/29/2023, 1:33 AMremembers
of screen A's composable. So when I pop screen B off the stack, screen A has lost where it was scrolled to in it's list. I think the strict compose answer to this is state hoisting. Something about that feels a little weird, but I suppose it can make sense?Adam Brown
01/31/2023, 5:05 AMChildren
composable, it subtly breaks certain things. I don't have a minimal case repro yet, but let me explain:Pavel S
01/31/2023, 8:41 PMArkadii Ivanov
02/02/2023, 11:12 PMdoubov
02/08/2023, 11:28 PMbackStackCreateDepth
to 1 does fix the bug, but I'm pretty sure this shouldn't be required. 🙏benkuly
02/28/2023, 5:39 PMscope.launch(Dispatchers.Main.immediate) {
navigation.replaceCurrent(...)
}
We do that do prevent runtime exceptions due to wrong coroutine context by some caller of a public API... is there a reason, why decompose enforces the main dispatcher?Marc
03/02/2023, 4:32 PMbenkuly
03/03/2023, 7:35 AMAccess from different threads is detected, must be on the main thread only.Current thread: AWT-EventQueue-0 @coroutine#5082. First thread: AWT-EventQueue-0 @coroutine#11.
Thown here:
withContext(Dispatchers.Main.immediate) {
push(configuration, onComplete) // <--
}
Any idea what's the problem?benkuly
03/03/2023, 7:35 AMAccess from different threads is detected, must be on the main thread only.Current thread: AWT-EventQueue-0 @coroutine#5082. First thread: AWT-EventQueue-0 @coroutine#11.
Thown here:
withContext(Dispatchers.Main.immediate) {
push(configuration, onComplete) // <--
}
Any idea what's the problem?Arkadii Ivanov
03/03/2023, 8:31 AMbenkuly
03/03/2023, 8:38 AMwithContext(Dispatchers.Main.immediate)
Notice: It is common test-code. Therefore only a few view models are created...Arkadii Ivanov
03/03/2023, 8:39 AMbenkuly
03/03/2023, 8:41 AMArkadii Ivanov
03/03/2023, 8:42 AMEvegenii Khokhlov
03/03/2023, 9:20 AMkotlinx-coroutines-test
has very handy Dispatchers.setMain()
method.Arkadii Ivanov
03/03/2023, 9:21 AMbenkuly
03/03/2023, 9:26 AMDispatchers.setMain()
and don't using real main dispatchers was the trick. Thank you 🙂