Skip to content

Commit d592fed

Browse files
committed
Add RenderChild entry point for registry-hosted content
1 parent d57d94a commit d592fed

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

  • Demo/swiftui/src/commonMain/kotlin/com/pureswift/swiftui

Demo/swiftui/src/commonMain/kotlin/com/pureswift/swiftui/Render.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,21 @@ internal val LocalInheritedDisabled = compositionLocalOf { false }
157157
/// arriving does not change the composition's structure: a branch switch here
158158
/// would tear down every remembered Animatable and snap instead of easing.
159159
@Composable
160-
fun Render(node: ViewNode) {
160+
fun Render(node: ViewNode) = RenderChild(node)
161+
162+
/// The real entry point, shared by the public `Render` and the composable
163+
/// registry's child slot. The registry MUST call this directly rather than the
164+
/// public `Render`: a nested call to a public composable from a dynamically-
165+
/// invoked factory slot has its restart group skipped by the Compose runtime,
166+
/// so the whole subtree silently fails to compose. Routing through this
167+
/// internal function composes reliably. It also folds the node's own style
168+
/// modifiers into the inherited environment so its subtree sees them.
169+
@Composable
170+
internal fun RenderChild(node: ViewNode) {
161171
val spec = node.string("animationCurve")?.let {
162172
AnimSpec(it, (node.double("animationDurationMs") ?: 350.0).toInt())
163173
} ?: LocalAnimationSpec.current
164174

165-
// Fold this node's own style modifiers into the inherited environment so
166-
// its subtree sees them.
167175
var fontSize = LocalInheritedFontSize.current
168176
var fontWeight = LocalInheritedFontWeight.current
169177
var color = LocalInheritedColor.current

0 commit comments

Comments
 (0)