Skip to content

Commit

Permalink
Merge pull request DroidKaigi#1012 from rocoand/fix/prevent-targetVal…
Browse files Browse the repository at this point in the history
…ue-recomposition-in-ContributorsCountItem

Prevent TotalContributor animation from recomposition on scroll
  • Loading branch information
takahirom authored Sep 9, 2024
2 parents 75546b0 + 7411bc8 commit 82bcd5c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -31,7 +31,7 @@ internal fun ContributorsCountItem(
totalContributor: Int,
modifier: Modifier = Modifier,
) {
var targetValue by remember { mutableStateOf(0) }
var targetValue by rememberSaveable { mutableStateOf(0) }
val animatedTotalContributor by animateIntAsState(
targetValue = targetValue,
animationSpec = tween(
Expand Down

0 comments on commit 82bcd5c

Please sign in to comment.