Skip to content

Commit 70a6706

Browse files
committed
Add native Spacer backing (placeholder, no flex-grow yet)
1 parent 0574fbc commit 70a6706

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// AndroidSpacer.swift
3+
// AndroidSwiftUI
4+
//
5+
// Created by Alsey Coleman Miller on 7/16/26.
6+
//
7+
8+
import AndroidKit
9+
10+
extension Spacer: AnyAndroidView {
11+
12+
// NOTE: does not yet flex-grow to fill remaining space in its parent stack (that would require
13+
// AndroidRenderer's generic `addView` mounting to apply per-child LayoutParams, e.g. `layout_weight`,
14+
// which it doesn't do today). Rendered as a minimal-size placeholder so layouts that include a
15+
// `Spacer()` (e.g. List's internal row padding) still mount without crashing.
16+
public func createAndroidView(_ context: AndroidContent.Context) -> AndroidView.View {
17+
let view = AndroidView.View(context)
18+
let length = Int32(minLength ?? 0)
19+
view.setLayoutParams(ViewGroup.LayoutParams(length, length))
20+
return view
21+
}
22+
23+
public func updateAndroidView(_ view: AndroidView.View) {
24+
25+
}
26+
27+
public func removeAndroidView() {
28+
29+
}
30+
}

0 commit comments

Comments
 (0)