I am trying to make a transition from bottom edge to top when a view appears.
ZStack{
VStack {
.
.//other components
.
if self.modalShown {
HStack {
GeometryReader { geometry in
BottomSheetView(
isOpen: self.$modalShown,
maxHeight: geometry.size.height * 0.6
) {
ZStack(alignment: .bottom) {
FiltersView(hideControl: self.$modalShown)
.transition(.move(edge: .bottom))
}
.edgesIgnoringSafeArea(.bottom)
}
}
}
.accessibility(identifier: "modalFilterView")
}
}
The problem is that when this view appears, it performs a kind of alpha 0 to alpha 1 transition. And when the view is dismissed it does not perform any transition.
Could be related this undesired behavior with the zIndex?
The problem was that the transition modifier was in the wrong place:
ZStack{
VStack {
.
.//other components
.
if self.modalShown {
HStack {
GeometryReader { geometry in
BottomSheetView(
isOpen: self.$modalShown,
maxHeight: geometry.size.height * 0.6
) {
ZStack(alignment: .bottom) {
FiltersView(hideControl: self.$modalShown)
}
.edgesIgnoringSafeArea(.bottom)
}
}
}
.transition(.move(edge: .bottom))
.accessibility(identifier: "modalFilterView")
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.