Closed luiisca closed 1 week ago
realized they are implementing recomposition in the floating Composable view, because apparentely jsut like LifecycleOwner
is not really implemented by default.
well that was wrong. recomposition works by default, the reason why it didn't was because the service wasn't calling:
fun onStart() {
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START)
}
. Now I don't know why they added this then:
fun onCreate() {
savedStateRegistryController.performRestore(null)
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
runRecomposeScope?.cancel()
runRecomposeScope = CoroutineScope(coroutineContext!!)
recomposer = Recomposer(coroutineContext!!)
this._view?.compositionContext = recomposer
runRecomposeScope!!.launch {
recomposer!!.runRecomposeAndApplyChanges()
}
}
But it's okay. no need to have perfect understanding
Discovered this library that could simplify implementation a lot. I prefer having more control over it, so I'll just clone it in my project instead of installing it