Skip to content

Commit 4cdcb70

Browse files
committed
Add a bug fix for the flip view list rendering issue
1 parent 71182ec commit 4cdcb70

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

RELEASE_NOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ SwiftUIKit makes its best effort to honor semver, but breaking changes can occur
44

55

66

7+
## 5.2
8+
9+
This version updates the icon, logo and build scripts.
10+
11+
It also adds a workaround for the `FlipView` rendering bug when it's placed in a `List`.
12+
13+
14+
715
## 5.1.9
816

917
### 💡 Adjustment

Sources/SwiftUIKit/Flip/FlipView.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ import SwiftUI
1414
/// For now, this view only supports horizontal flips, since
1515
/// flipping views both horizontally and vertically can mess
1616
/// it up, since the view can become upside down.
17+
///
18+
/// > Important: This view currently handles flip animations
19+
/// incorrectly when it is used within a `List`. This can be
20+
/// fixed by wrapping it in a `ZStack`. I tried to create an
21+
/// additional layer within this component, but that did not
22+
/// work. Until we come up with another solution, there is a
23+
/// `.withListRenderingBugFix()` view modifier that performs
24+
/// the `ZStack` wrap.
1725
public struct FlipView<FrontView: View, BackView: View>: View {
1826

1927
public init(
@@ -71,6 +79,15 @@ public struct FlipView<FrontView: View, BackView: View>: View {
7179
}
7280
}
7381

82+
public extension FlipView {
83+
84+
func withListRenderingBugFix() -> some View {
85+
ZStack {
86+
self
87+
}
88+
}
89+
}
90+
7491
private extension View {
7592

7693
typealias FlipAction = (FlipDirection) -> Void
@@ -175,6 +192,8 @@ func previewContent(isFlipped: Binding<Bool>) -> some View {
175192
tapDirection: .right,
176193
swipeDirections: [.left, .right, .up, .down]
177194
)
195+
.withListRenderingBugFix() // OBS!
196+
.frame(minHeight: 100)
178197
.cornerRadius(10)
179198
.shadow(radius: 0, x: 0, y: 2)
180199

0 commit comments

Comments
 (0)