Last active
August 30, 2022 08:31
-
-
Save Skyyo/b25d18a8ce474f48a8d4f68c8df77718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun LifecycleAwareCurrenciesScreen(viewModel: LifecycleAwareCurrenciesViewModel) { | |
val currencyPrices by viewModel.currencyPrices.collectAsStateWithLifecycle() | |
LazyColumn { | |
itemsIndexed(currencyPrices, { _, item -> item.id }) { index, currencyPrice -> | |
LifecycleAwareCurrencyPriceCard( | |
currencyPrice = currencyPrice, | |
currencyPriceUpdateFlow = viewModel.provideCurrencyUpdateFlow(), | |
onDisposed = { viewModel.onDisposed(index) }, | |
onCurrencyUpdated = { newPrice -> viewModel.onCurrencyUpdated(newPrice, index) }) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment