MCPcopy
hub / github.com/facebook/react / layoutSubviews

Method layoutSubviews

packages/react-devtools-timeline/src/view-base/View.js:239–252  ·  view source on GitHub ↗

* Layout self and subviews. * * Implementations should call `setNeedsDisplay` if a draw is required. * * The default implementation uses `this.layouter` to lay out subviews. * * Can be overwritten by subclasses that wish to manually manage their * subviews' layout. * * NOT

()

Source from the content-addressed store, hash-verified

237 * @see displayIfNeeded
238 */
239 layoutSubviews() {
240 const {frame, _layouter, subviews, visibleArea} = this;
241 const existingLayout = viewsToLayout(subviews);
242 const newLayout = _layouter(existingLayout, frame);
243 collapseLayoutIntoViews(newLayout);
244
245 subviews.forEach((subview, subviewIndex) => {
246 if (rectIntersectsRect(visibleArea, subview.frame)) {
247 subview.setVisibleArea(intersectionOfRects(visibleArea, subview.frame));
248 } else {
249 subview.setVisibleArea(zeroRect);
250 }
251 });
252 }
253
254 /**
255 * Draw the contents of this view in the given canvas `context`.

Callers 2

desiredSizeMethod · 0.95
displayIfNeededMethod · 0.95

Calls 6

viewsToLayoutFunction · 0.90
collapseLayoutIntoViewsFunction · 0.90
rectIntersectsRectFunction · 0.90
intersectionOfRectsFunction · 0.90
setVisibleAreaMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected