Gerardo Ernesto Rodriguez Navar
01/20/2022, 2:38 PMGerardo Ernesto Rodriguez Navar
01/20/2022, 2:38 PMGerardo Ernesto Rodriguez Navar
01/20/2022, 2:39 PMAndroidView(
factory = { context ->
val recyclerView = RecyclerView(context)
val linearLayoutManager =
LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
with(recyclerView) {
layoutManager = linearLayoutManager
adapter = dateSelectorAdapter
}
recyclerView
},
update = {}
)
Gerardo Ernesto Rodriguez Navar
01/20/2022, 2:41 PMmutableState
changes in my viewModel
ideally I would want to update the adapter
to update the recyclerView
Zach Klippenstein (he/him) [MOD]
01/20/2022, 2:59 PMadapter = dateSelectorAdapter
to the update
lambdaGerardo Ernesto Rodriguez Navar
01/20/2022, 3:06 PMCasey Brooks
01/20/2022, 3:19 PMfactory
only produces the view and will only be called once, while "the update block can be run multiple times due to recomposition, and it is the right place to set View properties depending on state"