Skip to content

Commit b003a24

Browse files
committed
Add axes and shows-indicators to ScrollView
1 parent 07b96f2 commit b003a24

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Sources/LiveViewNative/Views/Layout Containers/Scroll Views/ScrollView.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,28 @@ struct ScrollView<R: CustomRegistry>: View {
1616
}
1717

1818
public var body: some View {
19-
SwiftUI.ScrollView {
19+
SwiftUI.ScrollView(axes, showsIndicators: showsIndicators) {
2020
context.buildChildren(of: element)
2121
}
2222
}
23+
24+
private var axes: Axis.Set {
25+
switch element.attributeValue(for: "axes") {
26+
case "all":
27+
return [.horizontal, .vertical]
28+
case "horizontal":
29+
return .horizontal
30+
default:
31+
return .vertical
32+
}
33+
}
34+
35+
private var showsIndicators: Bool {
36+
if let attr = element.attributeValue(for: "shows-indicators") {
37+
return attr == "true"
38+
} else {
39+
return true
40+
}
41+
}
42+
2343
}

0 commit comments

Comments
 (0)