Fix reordering in non-edit mode on iOS 26

This commit is contained in:
世界
2025-12-04 20:00:10 +08:00
parent 8ecbd3ab6c
commit 8d45a42320
@@ -51,7 +51,7 @@ struct ProfilePickerSheet: View {
#if os(iOS)
@available(iOS 26, *)
private var iOSBody: some View {
listContent
iOSListContent
.toolbar {
ToolbarItem(placement: .primaryAction) {
EditButton()
@@ -67,6 +67,49 @@ struct ProfilePickerSheet: View {
.alert($alert)
}
@available(iOS 26, *)
@ViewBuilder
private var iOSListContent: some View {
if editMode.isEditing {
iOSEditingList
} else {
iOSNormalList
}
}
@available(iOS 26, *)
private var iOSEditingList: some View {
listContent
}
@available(iOS 26, *)
private var iOSNormalList: some View {
List {
ForEach(profileList, id: \.id) { profile in
ProfilePickerRow(
profile: profile,
isSelected: profile.id == selectedProfileID,
alert: $alert,
onSelect: {
selectedProfileID = profile.id
dismiss()
},
onEdit: {
profileToEdit = profile.origin
},
onUpdate: {
await updateProfile(profile)
}
)
.environmentObject(environments)
.listRowBackground(Color.clear)
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets(top: 2, leading: 16, bottom: 2, trailing: 16))
}
}
.listStyle(.plain)
}
private var legacyIOSBody: some View {
legacyListContent
.toolbar {