I have DelegateAdapter for RV with a bunch of viewholders with different types. One type of them is Anchor, and I have to scroll to different Anchors. I know position of Anchor in my adapter’s list, but it do not match with position in RV because not visible views in RV are not attached. How can i scroll to it?
val components = states.first().components
val anchor = components
.filterIsInstance<AnchorComponent>()
.find { anchor -> anchor.value == it.value}
anchor?.let{anch ->
val position = components.indexOf(anch)
emitSideEffect(LandingSideEffect.ScrollToAnchorPosition(position))
}
is LandingSideEffect.ScrollToAnchorPosition ->
binding.rvItems.scrollToPosition(sideEffect.position)
Kristalcraft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.