Skip to content

Can't use withCompositionRoot in a project with AndroidViewRenderings #698

@wardellbagby

Description

@wardellbagby

Sample repro: https://github.com/wardellbagby/WithCompositionRootCrash

When using withCompositionRoot in order to establish a Composable that should wrap
all composeViewFactories, along with renderings that implement AndroidViewRendering, the app
will crash when attempting to find a ViewFactory to render an AndroidViewRendering.

The root cause of this issue is how the logic to wrap ViewFactories is implemented. It relies
on ViewRegistry.getFactoryFor to return a valid view factory for every rendering class, but the
logic to return a ViewFactory for an AndroidViewRendering is based on a rendering instance,
not a rendering class. The logic that takes AndroidViewRendering's instances into account is done
by ViewRegistry.getFactoryForRendering, which is what ViewRegistry.buildView uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompose

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions