Skip to content

Commit 1026ae4

Browse files
authored
fix insertion index (#469)
1 parent aa12bbb commit 1026ae4

File tree

1 file changed

+3
-2
lines changed
  • toolkit/featureforms/src/main/java/com/arcgismaps/toolkit/featureforms/internal/components/attachment

1 file changed

+3
-2
lines changed

toolkit/featureforms/src/main/java/com/arcgismaps/toolkit/featureforms/internal/components/attachment/AttachmentElementState.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,14 @@ internal class AttachmentElementState(
162162
scope = scope,
163163
formAttachment = formAttachment
164164
)
165-
attachments.add(state)
165+
// add the new state to the beginning of the list
166+
attachments.add(0, state)
166167
// load the new attachment
167168
state.loadWithParentScope()
168169
// scroll to the new attachment after a delay to allow the recomposition to complete
169170
scope.launch {
170171
delay(100)
171-
lazyListState.scrollToItem(attachments.count())
172+
lazyListState.scrollToItem(0)
172173
evaluateExpressions()
173174
}
174175
}

0 commit comments

Comments
 (0)