How to turn off NavigationLink overlay color in SwiftUI?

The navigationLink acts like Button and it gets the default button style with blue color.

Using .renderingMode(.original) only works on Image views. What if you decide to load your image using some libs or pods?!

It is better to change the default button style to plain using the modifier below:

NavigationLink(destination: Text("Hello")) {
    ZStack {
        RoundedRectangle(cornerRadius: cRadius)
            .foregroundColor(.white)
            .opacity(0)
            .background(LinearGradient(gradient: Gradient(colors: [Color(red: 109/255, green: 58/255, blue: 242/255),Color(red: 57/255, green: 23/255, blue: 189/255)]), startPoint: .leading, endPoint: .trailing), cornerRadius: 0)
            .cornerRadius(cRadius)
            .frame(height: cHeight)
            .padding()
        Image("someColoredPathPNGimage")
    }
}
.buttonStyle(PlainButtonStyle())  // Here is what you need

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)