Skip to content

Commit

Permalink
Support renderOnly componentView
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed May 31, 2024
1 parent bb8dc53 commit fabb40c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Sources/UIComponent/Core/ComponentView/ComponentEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public class ComponentEngine {
/// The current `RenderNode`. This is `nil` before the layout is done.
var renderNode: (any RenderNode)?

/// Only render the renderNode, skipping layout.
var renderOnly: Bool = false

/// Internal state to track if a reload is needed.
var needsReload = true

/// Internal state to track if a render is needed.
var needsRender = false

/// Internal state to determine if the next layout should be skipped.
var skipNextLayout = false

/// The number of times the view has been reloaded.
var reloadCount = 0
Expand Down Expand Up @@ -180,8 +180,7 @@ public class ComponentEngine {
}
}

if skipNextLayout {
skipNextLayout = false
if renderOnly {
adjustContentOffset(contentOffsetAdjustFn: contentOffsetAdjustFn)
render(updateViews: true)
} else if asyncLayout {
Expand Down Expand Up @@ -376,6 +375,6 @@ public class ComponentEngine {
public func reloadWithExisting(component: any Component, renderNode: any RenderNode) {
self.component = component
self.renderNode = renderNode
self.skipNextLayout = true
self.renderOnly = true
}
}

0 comments on commit fabb40c

Please sign in to comment.