Skip to content

Cutom painter recomposition issue #38

@vvdrak

Description

@vvdrak

This code has an excessive recomposition for the RatingBar when you type the text

@Composable
private fun Foo() {
    Column(modifier = Modifier.padding(20.dp)) {
        var rating by remember { mutableFloatStateOf(0f) }
        var feedback by remember { mutableStateOf("") }

        RatingBar(
            value = rating,
            painterEmpty = painterResource(id = R.drawable.ic_star_off),
            painterFilled = painterResource(id = R.drawable.ic_star_on),
            onValueChange = { rating = it },
            onRatingChanged = {}
        )
        TextField(value = feedback, onValueChange = { feedback = it })
    }
}

Painter is unstable param. Check SO for resolve this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions