Check if first item size == 0

Change-Id: I41acffad84d9db1cf407f77b04530643933f98bf
pull/722/head
TJ Dahunsi 2 years ago
parent bdf3ee3cb0
commit 2dba522663

@ -116,8 +116,11 @@ internal inline fun <LazyState : ScrollableState, LazyStateItem> LazyState.inter
if (firstItemIndex < 0) return Float.NaN
val firstItemSize = itemSize(firstItem)
if (firstItemSize == 0) return Float.NaN
val itemOffset = offset(firstItem).toFloat()
val offsetPercentage = abs(itemOffset) / itemSize(firstItem)
val offsetPercentage = abs(itemOffset) / firstItemSize
val nextItem = nextItemOnMainAxis(firstItem) ?: return firstItemIndex + offsetPercentage

Loading…
Cancel
Save