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

Method layout

packages/core/ui/core/view/index.ios.ts:117–142  ·  view source on GitHub ↗
(left: number, top: number, right: number, bottom: number, setFrame = true)

Source from the content-addressed store, hash-verified

115
116 @profile
117 public layout(left: number, top: number, right: number, bottom: number, setFrame = true): void {
118 const { boundsChanged, sizeChanged } = this._setCurrentLayoutBounds(left, top, right, bottom);
119
120 if (setFrame) {
121 this.layoutNativeView(left, top, right, bottom);
122 }
123
124 const needsLayout = boundsChanged || this.isLayoutRequired;
125 if (needsLayout) {
126 let position: Position;
127
128 if (this.nativeViewProtected && SDK_VERSION > 10) {
129 // on iOS 11+ it is possible to have a changed layout frame due to safe area insets
130 // get the frame and adjust the position, so that onLayout works correctly
131 position = IOSHelper.getPositionFromFrame(this.nativeViewProtected.frame);
132 } else {
133 position = { left, top, right, bottom };
134 }
135
136 this.onLayout(position.left, position.top, position.right, position.bottom);
137 this._privateFlags &= ~PFLAG_LAYOUT_REQUIRED;
138 }
139
140 this.updateBackground(sizeChanged, needsLayout);
141 this._privateFlags &= ~PFLAG_FORCE_LAYOUT;
142 }
143
144 private updateBackground(sizeChanged: boolean, needsLayout: boolean): void {
145 if (sizeChanged) {

Callers 10

layoutChildMethod · 0.45
layoutInternalMethod · 0.45
layoutSubviewsMethod · 0.45
drawBitmapMethod · 0.45
layoutChildMethod · 0.45

Calls 4

layoutNativeViewMethod · 0.95
onLayoutMethod · 0.95
updateBackgroundMethod · 0.95
getPositionFromFrameMethod · 0.80

Tested by

no test coverage detected