Reputation: 99
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://i.sstatic.net/NLAkA.jpg
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)
}
})
}
}
Upvotes: 0
Views: 105
Reputation: 99
I seem to have figured out why.
Button(action: {onboardingCheck=updateOnboarding},
from OnboardingButton seems to only accept true as an answer to continue . To work around this, I simply made a different file that does not use Button() but instead the following:
struct OnboardingButtonTwo: View {
var buttonText: String
var body: some View {
ZStack{
RoundedRectangle(cornerRadius: 5)
.foregroundColor(.white)
.frame(width: 300, height: 60, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
Text(buttonText)
.foregroundColor(.black)
.font(.system(size: 20))
.fontWeight(.semibold)
}
.padding(.bottom, 10)
}
}
Upvotes: 1