无法按导航边缘 link swiftui

can't press edges of navigation link swiftui

我创建了一个导航 link,当我按下 link 边缘时没有任何反应,我只需要按下文本就可以转到下一个视图


  NavigationLink(destination: RegisterView()) 
{Text("SIGN UP")}
.foregroundColor(Color(#colorLiteral(red: 0.2549019608, green: 0.2941176471, blue: 0.3529411765, alpha: 1)))
.padding()
.frame(width: 155, height: 50, alignment: .center)
.background(Color(#colorLiteral(red: 1, green: 0.7647058824, blue: 0.2274509804, alpha: 1)))
.cornerRadius(10)

你把修饰语放在了错误的地方。 解决方案是 ->

  NavigationLink(destination: RegisterView()) 
{Text("SIGN UP")
.foregroundColor(Color(#colorLiteral(red: 0.2549019608, green: 0.2941176471, blue: 0.3529411765, alpha: 1)))
.padding()
.frame(width: 155, height: 50, alignment: .center)
.background(Color(#colorLiteral(red: 1, green: 0.7647058824, blue: 0.2274509804, alpha: 1)))
.cornerRadius(10)}