| 251 | } |
| 252 | |
| 253 | void ViewNodeTree::performUpdates() { |
| 254 | // This does the following: |
| 255 | // - calculate the layout if needed |
| 256 | // - determine yoga node visibility |
| 257 | // - rerender every contexts which has one node that came |
| 258 | // on or off screen |
| 259 | // We keep doing that until we haven't found any more contexts to update. |
| 260 | // To avoid potential infinite recursion, we re-render a given context only once. |
| 261 | |
| 262 | if (!_hasLayoutSpecs) { |
| 263 | return; |
| 264 | } |
| 265 | |
| 266 | auto rootViewNode = getRootViewNode(); |
| 267 | if (rootViewNode == nullptr) { |
| 268 | return; |
| 269 | } |
| 270 | |
| 271 | if (_layoutDirty) { |
| 272 | _layoutDirty = false; |
| 273 | rootViewNode->performLayout(getCurrentViewTransactionScope(), _layoutSize, _layoutDirection); |
| 274 | } |
| 275 | |
| 276 | flushOnLayoutCallbacks(); |
| 277 | |
| 278 | rootViewNode->updateVisibilityAndPerformUpdates(getCurrentViewTransactionScope()); |
| 279 | |
| 280 | flushOnDrawCallbacks(); |
| 281 | } |
| 282 | |
| 283 | Size ViewNodeTree::measureLayout( |
| 284 | float width, MeasureMode widthMode, float height, MeasureMode heightMode, LayoutDirection layoutDirection) { |