Created
September 6, 2020 09:49
-
-
Save damianpetla/c9662007f1a4349a3368554e4224f657 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 LazyExampleWithIndex() { | |
val items = listOf("Cat", "Dog", "Monkey")//1000 of these | |
val lastIndex = items.lastIndex | |
LazyColumnForIndexed(items = items) { index, item -> | |
if (lastIndex == index) { | |
onActive { | |
//fetch more items from API | |
} | |
} | |
Text(text = "Item $item") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment