How can I prevent text alignment issues in SwiftUI NavigationLink?

68 views Asked by At

I'm trying to turn an entire block of code in a link to another View using NavigationLink(). The problem is that when the text in those blocks reaches the end of the line, the text is aligned in the center. It's very annoying because it messes up my whole app design.

I tried everything I could think of, but I'm a beginner in the SwiftUI world. Anybody can help?

This is my code:

NavigationLink(destination: JoinView()) {
  HStack(spacing: 30) {
    VStack(alignment: .leading) {
      Text("TOO MUCH WORK?")
        .foregroundColor(Color("text_gray"))
        .font(.system(size:grayTextSize))
      Text("Join a study group")
        .font(.system(size: Title))
        .padding(.bottom, TitleBottomPad)
        .foregroundColor(Color("text_color"))
      Text("If you want to find some people to study with join a group of students now!")
        .foregroundColor(Color("text_gray"))
        .font(.system(size: grayTextSize))
    }
    .padding(-5)
    Image("join_pic")
      .resizable()
      .frame(width: 136.33, height: 91)
      .clipShape(Circle())
//      .padding(-10)
  }
}

The text that gets messed up is the one that goes "If you want to find some people to study with join a group of students now!".

Marco

0

There are 0 answers