Skip to content

Parent-child communication for screens #66

Open
@ikarenkov

Description

@ikarenkov

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:

  1. Observe your children state, to modify your own state. Usecases:
    • Enables button in your parent only if child screen is ready for continue.
  2. 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:

  1. When we need to interact with ViewModel having only Screen instance, we can try to find ViewModel in our Store and if there is no ViewModel yet - define some default behaviour on client side.
  2. Provide the ability to store a ViewModel (or any other object) as a property of Screen.

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions