iPages
iPages copied to clipboard
Setting disableBounce to true breaks switching tab via binding
If you set disableBounce
to true
it's no longer possible to change the selected tab via the binding.
Edit: only the first and last tab aren't accessible via the binding. The navigation to tabs between them is still working.
Interactive example to reproduce:
struct ContentView: View {
@State var selection = 0
@State var bounceDisabled = false
var body: some View {
VStack {
Button("Tab 0", action: { selection = 0 })
Button("Tab 1", action: { selection = 1 })
Button("Toggle bounce", action: { bounceDisabled.toggle() } )
Text("Selected tab: \(selection)")
Text(bounceDisabled ? "Bounce disabled" : "Bounce enabled")
iPages(selection: $selection) {
Text("Tab 0")
Text("Tab 1")
}
.disableBounce(bounceDisabled)
}
}
}