a

    antonioleiva

    10 months ago
    Hi! Does anyone know what's the use case for the
    parent
    argument in the 
    setContent
     extension?
    public fun ComponentActivity.setContent(
        parent: CompositionContext? = null,
        content: @Composable () -> Unit
    ) {...}
    I've never seen a sample using this argument 🤔
    Albert Chang

    Albert Chang

    10 months ago
    It can be used to set the content as a child composition. See the source for the explanation of
    CompositionContext
    . Normally you won’t need to specify this. Here’s an example usage.
    a

    antonioleiva

    10 months ago
    oh thanks! Will take a look at this
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    10 months ago
    Yep Dialog composables use this for example. Ensures that recompositions, composition locals, etc flow from the caller into the Dialog lambda.