Open
Description
Feature description
Parent-child communication is one of the ways to implement communication between screen.
It also can provide flexibility by implementing inversion of control principle, when child doest interacts directly with a parent but provides some set of methods, that parent can interact with.
Common case scenario is when you want to be able to:
- Observe your children state, to modify your own state. Usecases:
- Enables button in your parent only if child screen is ready for continue.
- Triggering some action, f.e. reloading a page.
Challenges
Since our ViewModels are defined in @Composable fun
we unable to have direct access to it. There are 2 probably solutions:
- When we need to interact with
ViewModel
having onlyScreen
instance, we can try to findViewModel
in our Store and if there is noViewModel
yet - define some default behaviour on client side. - Provide the ability to store a
ViewModel
(or any other object) as a property ofScreen
.
Tasks
- Provide the way to have VM (or other objects) directly in your Screen
- Provide an example of usage and parent-child communication
- Write a documentation
- Review api of created solutions and simplify it if possible