mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Reset tabIndex when state is reset to loading
We track the state of the current index in two places: the audio controller, which updates as audio as played, the tabView has its own binding of the current index, this is to allow scrolling. When the audio item being played changes, we need to reset the state of the tabIndex. We do this by watching for state loading which occurs when new audio is loaded.
This commit is contained in:
parent
fe1f4ee51d
commit
d9c91c3137
1 changed files with 6 additions and 0 deletions
|
|
@ -361,6 +361,12 @@
|
|||
.shadow(color: expanded ? .clear : .gray.opacity(0.33), radius: 8, x: 0, y: 4)
|
||||
.mask(Rectangle().padding(.top, -20))
|
||||
)
|
||||
.onChange(of: audioController.state, perform: { state in
|
||||
// Reset the tabIndex when we load a new audio item
|
||||
if state == .loading {
|
||||
tabIndex = 0
|
||||
}
|
||||
})
|
||||
.onTapGesture {
|
||||
withAnimation(.easeIn(duration: 0.08)) { expanded = true }
|
||||
}.sheet(isPresented: $showVoiceSheet) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue