fix(settings): reset drag state before restoring default bottom bar
Tapping Restore Default mid-drag would replace `items` with the default list while `draggedItemIndex` still pointed into the old list. If the old index exceeded the new list's lastIndex, the next pointer event indexed `items` out of bounds. Clear drag state before save(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -147,7 +147,11 @@ fun BottomBarSettingsContent(accountViewModel: AccountViewModel) {
|
|||||||
horizontalArrangement = Arrangement.End,
|
horizontalArrangement = Arrangement.End,
|
||||||
) {
|
) {
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = { save(initialRows(DefaultBottomBarItems)) },
|
onClick = {
|
||||||
|
draggedItemIndex = -1
|
||||||
|
dragOffset = 0f
|
||||||
|
save(initialRows(DefaultBottomBarItems))
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
Text(stringRes(R.string.bottom_bar_settings_restore_default))
|
Text(stringRes(R.string.bottom_bar_settings_restore_default))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user