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

Issue in updating the state variable's value within the partial sheet's content #181

Open
khan33 opened this issue Nov 10, 2023 · 0 comments

Comments

@khan33
Copy link

khan33 commented Nov 10, 2023

I'm having trouble updating the state variable's value within the partial sheet's content. The code below works well with SwiftUI's sheet view.

struct DemoView: View {

@State var buttonTxt: String = "Start"
@State var issheet: Bool = false
var body: some View {
    
    VStack {
        Button {
            issheet.toggle()
        } label: {
            Text("Button")
                .foregroundColor(Color.white)
                .padding()
                .background(Color.red)
        }
    }
    .partialSheet(isPresented: $issheet, content: {
        Button {
            buttonTxt = "Stop"
        } label: {
            Text(buttonTxt)
                .foregroundColor(Color.white)
                .frame(width: 180, height: 55)
                .padding()
                .background(Color.red)

        }
    })
    .padding()
}

}

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