| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,7 +46,6 @@ import androidx.compose.runtime.LaunchedEffect | |||
| 46 | 46 | import androidx.compose.runtime.getValue | |
| 47 | 47 | import androidx.compose.runtime.mutableStateOf | |
| 48 | 48 | import androidx.compose.runtime.remember | |
| 49 | - import androidx.compose.runtime.rememberCoroutineScope | ||
| 50 | 49 | import androidx.compose.runtime.saveable.rememberSaveable | |
| 51 | 50 | import androidx.compose.ui.Alignment | |
| 52 | 51 | import androidx.compose.ui.Modifier | |
@@ -75,7 +74,6 @@ import com.example.jetsnack.ui.home.cart.Cart | |||
| 75 | 74 | import com.example.jetsnack.ui.home.search.Search | |
| 76 | 75 | import com.example.jetsnack.ui.theme.JetsnackTheme | |
| 77 | 76 | import dev.chrisbanes.accompanist.insets.navigationBarsPadding | |
| 78 | - import kotlinx.coroutines.launch | ||
| 79 | 77 | ||
| 80 | 78 | @Composable | |
| 81 | 79 | fun Home(onSnackSelected: (Long) -> Unit) { | |
@@ -189,13 +187,10 @@ private fun JetsnackBottomNavLayout( | |||
| 189 | 187 | Animatable(if (i == selectedIndex) 1f else 0f) | |
| 190 | 188 | } | |
| 191 | 189 | } | |
| 192 | - val scope = rememberCoroutineScope() | ||
| 193 | 190 | selectionFractions.forEachIndexed { index, selectionFraction -> | |
| 194 | 191 | val target = if (index == selectedIndex) 1f else 0f | |
| 195 | - if (selectionFraction.targetValue != target) { | ||
| 196 | - scope.launch { | ||
| 197 | - selectionFraction.animateTo(target, animSpec) | ||
| 198 | - } | ||
| 192 | + LaunchedEffect(target, animSpec) { | ||
| 193 | + selectionFraction.animateTo(target, animSpec) | ||
| 199 | 194 | } | |
| 200 | 195 | } | |
| 201 | 196 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments