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

Conditionals do not behave as expected #31

Open
twodayslate opened this issue Jan 26, 2024 · 0 comments
Open

Conditionals do not behave as expected #31

twodayslate opened this issue Jan 26, 2024 · 0 comments

Comments

@twodayslate
Copy link

Screen.Recording.2024-01-25.at.11.58.20.PM.mov
struct ContentView: View {
    @State var enableSecondGroup = false
    var body: some View {
        VStack {
            Button {
                enableSecondGroup.toggle()
            } label: {
                Text("Toggle Group 2")
            }
            SettingStack {
                SettingPage(title: "Playground") {
                    SettingGroup(header: "Group 1") {
                        SettingCustomView {
                            Text("Hello Group 1")
                        }
                    }

                    if enableSecondGroup {
                        SettingGroup(header: "Group 2") {
                            SettingCustomView {
                                Text("Hello Group 2")
                            }
                        }
                    }

                }
            }
        }
        .padding()
    }
}

Expected behavior

Group 1 should only be visible when the toggle is off; Group 1 and 2 should be visible when toggle is on

Actual behavior

Group 1 is visible when toggle is off; Group 2 is duplicated when toggle is on

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