07/19/2022, 10:21 AM
Jetpack Compose: How to detect when TabRow inside HorizontalPager is visible and call a ViewModel function? I am building a simple app which has a TabLayout with two tabs. One tab is a list of items which you can click and make a note about the item. The other tab is a list of notes you made in the first tab. I have created a TabLayout using TabRows and HorizontalPager here is the code for that section: @OptIn(ExperimentalPagerApi::class) @Composable fun HorizontalPagerTabLayout( modifier: Modifier ) { val tabData = listOf("Records" to Icons.Default.Phone, "Notes" to Icons.Default.Star)...