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

PushView with Buttons #30

Closed
ghost opened this issue Sep 25, 2020 · 2 comments
Closed

PushView with Buttons #30

ghost opened this issue Sep 25, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 25, 2020

How do I PushView with buttons...??

This does nothing..
PushView(destination: SignInView()) { Button(action: { self.isActive.toggle() }) { HStack { Image("mail-icon") Text(" Login with Email/Mobile") .font(.custom("Avenir Next Bold", size: 14.0)) Spacer() } } .modifier(PrimaryButton(colorInput: .red)) }

But this works fine..??

PushView(destination: SignInView()) { HStack { Image("mail-icon") Text(" Login with Email/Mobile") .font(.custom("Avenir Next Bold", size: 14.0)) Spacer() } .modifier(PrimaryButton(colorInput: .red)) }

@matteopuc
Copy link
Owner

Hi @vmshaneeb! With the NavigationStack you can also push programmatically (since you were talking about Button I think this is what you want):

struct MyView: View {
    @EnvironmentObject private var navigationStack: NavigationStack

    var body: some View {
        Button(action: {
            //do whatever you want
            self.navigationStack.push(SignInView())
        }, label: {
            Text("PUSH")
        })
    }
}

@ghost
Copy link
Author

ghost commented Sep 25, 2020

@matteopuc Cool... (Y)

Thanks bro...

@ghost ghost closed this as completed Sep 25, 2020
This issue was closed.
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