compose-ratingbar icon indicating copy to clipboard operation
compose-ratingbar copied to clipboard

Cutom painter recomposition issue

Open vvdrak opened this issue 1 year ago • 1 comments

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.

vvdrak avatar Oct 12 '23 12:10 vvdrak

@vvdrak thanks. will fix this

a914-gowtham avatar Oct 12 '23 15:10 a914-gowtham