Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting disableBounce to true breaks switching tab via binding #21

Open
theblaggy opened this issue Feb 16, 2021 · 0 comments
Open

Setting disableBounce to true breaks switching tab via binding #21

theblaggy opened this issue Feb 16, 2021 · 0 comments

Comments

@theblaggy
Copy link

theblaggy commented Feb 16, 2021

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)
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant