Update the readme chapter of FAQ about NavigationLink as well, update the demo
This commit is contained in:
parent
72c604d4ce
commit
babb23ba11
|
@ -141,6 +141,7 @@ struct ContentView: View {
|
|||
Text((url as NSString).lastPathComponent)
|
||||
}
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
.onDelete { indexSet in
|
||||
indexSet.forEach { index in
|
||||
|
|
15
README.md
15
README.md
|
@ -218,9 +218,15 @@ Button(action: {
|
|||
}) {
|
||||
WebImage(url: url)
|
||||
}
|
||||
// NavigationLink create Button implicitly
|
||||
NavigationView {
|
||||
NavigationLink(destination: Text("Detail view here")) {
|
||||
WebImage(url: url)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Instead, you must override the `.buttonStyle` to use the plain style. Or you can use the `.onTapGesture` modifier for touch handling. See [How to disable the overlay color for images inside Button and NavigationLink](https://www.hackingwithswift.com/quick-start/swiftui/how-to-disable-the-overlay-color-for-images-inside-button-and-navigationlink)
|
||||
Instead, you must override the `.buttonStyle` to use the plain style, or the `.renderingMode` to use original mode. You can also use the `.onTapGesture` modifier for touch handling. See [How to disable the overlay color for images inside Button and NavigationLink](https://www.hackingwithswift.com/quick-start/swiftui/how-to-disable-the-overlay-color-for-images-inside-button-and-navigationlink)
|
||||
|
||||
```swift
|
||||
// Correct
|
||||
|
@ -230,6 +236,13 @@ Button(action: {
|
|||
AnimatedImage(url: url)
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
// Or
|
||||
NavigationView {
|
||||
NavigationLink(destination: Text("Detail view here")) {
|
||||
WebImage(url: url)
|
||||
.renderingMode(.original)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
|
Loading…
Reference in New Issue