Closed djrobby closed 4 years ago
Hi @djrobby! The issue you are experiencing is due to the .scale
transition type . Sometimes when you "scale things" in SwiftUI you get these kind of warnings. Don't ask me why, I honestly don't know. If you change your example and try to use, for instance, .slide
as transition type the warning will disappear.
struct ContentView: View {
var body: some View {
NavigationStackView(transitionType: .custom(.slide)) { //<-- changed here
ZStack {
Color.orange.edgesIgnoringSafeArea(.all)
HStack {
PushView(destination:ChildView()) {
Text("Settings")
}
}
}
}
}
}
It seems that the warning occurs when you try to set the scale factor to 0 (i.e. the default scale factor for the .scale
transition type). To solve this issue you can use a workaround: instead of using .scale
as transition type, try to use .scale(0.001)
:
struct ContentView: View {
var body: some View {
NavigationStackView(transitionType: .custom(.scale(scale: 0.001))) { //<-- changed here
ZStack {
Color.orange.edgesIgnoringSafeArea(.all)
HStack {
PushView(destination:ChildView()) {
Text("Settings")
}
}
}
}
}
}
This way SwiftUI won't scale the view until 0 and the warning will disappear.
You're 100% correct. That did it! Thank you @matteopuc
First off, your utility is AMAZING! Thank you so much for this! I'm running into the following warning/error:
After doing some digging, it seems to be originating from specifying the
transitionType
attribute for theNavigationStackView
while having aList
view inside the destination. If I leave this attribute out, there are no errors. Also, I'm not sure if this is related to an already closed issue #22. It would be greatly appreciated if you can help. Thank you in advance. Please see reproducible code see below: