Code below:
NavigationView{
ZStack{
Color("SmokyBlack").ignoresSafeArea()
VStack{
//ModularContent(titleName: titleName, subtitleText: subtitleText, imageName: imageName)
NavigationLink(destination: SecondOnboardingView()){
OnboardingButton(buttonText: btnName, updateOnboarding: false)
}
}
}// parent vstack
.preferredColorScheme(/*@START_MENU_TOKEN@*/.dark/*@END_MENU_TOKEN@*/)
.navigationBarHidden(true)
} //nav view ends
My Issue: https://imgur.com/a/ALBdEBs
The button is clearly being pressed but nothing is happening
edit: code for the button. I have tried changing this button to plain text but it still doesn't work.
struct OnboardingButton: View {
var buttonText: String
var updateOnboarding: Bool
@AppStorage("onboardingCheck") var onboardingCheck: Bool?
var body: some View {
Button(action: {onboardingCheck=updateOnboarding},
label: {
ZStack{
RoundedRectangle(cornerRadius: 5)
.foregroundColor(.white)
.frame(width: 300, height: 60, alignment: .center)
Text(buttonText)
.foregroundColor(.black)
.font(.system(size: 20))
.fontWeight(.semibold)
}
})
}
}
NavigationLinkis basically a button, so here you likely are triggering the button insideOnboardingButton. Fix by changing fromButtontoTextinOnboardingButtonfor example. - George