Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Setting disableBounce to true breaks switching tab via binding #21

Description

@theblaggy

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)
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions