-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Description
The recent introduction of the Wrapper interface (#920) made it easier to create things like NamedScreen, where one rendering is used to modify how a wrapped one is displayed; but made it harder to implement "alias" types: custom renderings that are most easily displayed by transforming them into existing types.
This is a problem because we encourgage apps to use BodyAndOverlaysScreen as a building block to craft their own, stricter rules.
e.g., it should be trivial to register a ScreenViewFactory that handles this:
class MyAppRootUI(
val body: Screen,
val maybeExactlyOnePopupScreen: MySpecificOverlayType?
val maybeAnAlertOnTopOfThat: AlertOverlay?
)by transforming it into this:
BodyAndOverlaysScreen(
body = myRoot.body,
overlays = listOfNotNull(
myRoot.maybeExactlyOnePopupScreen,
myRoot.maybeAnAlertOnTopOfThat
)By coupling the ScreenViewFactory.forWrapper to the new Wrapper type, we have actually made that much harder.
So, at least two outcomes needed here:
- Convenient API for this use case
- Introduce a sample demonstrating this pattern, both to document it and to make it painfully obvious when we work against it.
Metadata
Metadata
Assignees
Labels
No labels