Fix iOS 14 not preselecting created profile

When starting from empty profiles.
This commit is contained in:
Davide De Rosa 2022-04-21 14:48:20 +02:00
parent 759b740d62
commit ed16617288
1 changed files with 11 additions and 0 deletions

View File

@ -98,6 +98,17 @@ extension OrganizerView {
}
}.onAppear {
preselectIfActiveProfile(header.id)
// XXX: iOS 14 bug, if selectedProfileId is set before its NavigationLink
// has appeared, the NavigationLink will not auto-activate once appeared
// enforce activation by clearing and resetting selectedProfileId to its
// current value
withAnimation {
if let tmp = selectedProfileId, tmp == header.id {
selectedProfileId = nil
selectedProfileId = tmp
}
}
}
}
}