MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / onLayout

Method onLayout

packages/core/ui/page/index.ios.ts:509–529  ·  view source on GitHub ↗
(left: number, top: number, right: number, bottom: number)

Source from the content-addressed store, hash-verified

507 }
508
509 public onLayout(left: number, top: number, right: number, bottom: number) {
510 if (this.hasActionBar) {
511 const { width: actionBarWidth, height: actionBarHeight } = this.actionBar._getActualSize;
512 View.layoutChild(this, this.actionBar, 0, 0, actionBarWidth, actionBarHeight);
513 }
514
515 const insets = this.getSafeAreaInsets();
516
517 if (!__VISIONOS__ && SDK_VERSION <= 10 && this.viewController) {
518 // iOS 10 and below don't have safe area insets API,
519 // there we need only the top inset on the Page
520 insets.top = layout.round(layout.toDevicePixels(this.viewController.view.safeAreaLayoutGuide.layoutFrame.origin.y));
521 }
522
523 const childLeft = 0 + insets.left;
524 const childTop = 0 + insets.top;
525 const childRight = right - insets.right;
526 const childBottom = bottom - insets.bottom;
527
528 View.layoutChild(this, this.layoutView, childLeft, childTop, childRight, childBottom);
529 }
530
531 public _addViewToNativeVisualTree(child: View, atIndex: number): boolean {
532 // ActionBar is handled by the UINavigationController

Callers

nothing calls this directly

Calls 2

getSafeAreaInsetsMethod · 0.80
layoutChildMethod · 0.45

Tested by

no test coverage detected