CXwudi
06/25/2024, 8:47 PMScreenAComponent
that receive a callback to navigate to screen B like the following:
interface ScreenAComponent {
val state: Value<ScreenAState>
fun sendIntent(intent: ScreenAIntent)
}
class DefaultScreenAComponent(
private val componentContext: ComponentContext,
private val storeFactory: StoreFactory,
val onScreenBNavigate: (String) -> Unit
) : ScreenAComponent, ComponentContext by componentContext
The DefaultScreenAComponent
is created by the root component which basically just does the stack navigation, and the onScreenBNavigate
callback passed into ScreenAComponent
is basically just stackNavigation.push()
function call.
Now, I don't know which is the right place to call onScreenBNavigate
, should I do it by subscribing the labels? Or should I call it in Reducer? Or in Executor? Or create a dedicated state for representing that the callback should be called?Arkadii Ivanov
06/26/2024, 9:28 AMCXwudi
06/26/2024, 5:32 PM