Skip to content

Commit a0b768e

Browse files
committed
docs: cleanup the layout process
1 parent 02af89b commit a0b768e

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

content/guide/the-layout-process.md renamed to content/guide/advanced/the-layout-process.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
---
22
title: The Layout Process
3+
description: For all views to render with the right dimensions and positions requires a run of the layout process.
4+
contributors:
5+
- Ombuweb
6+
- NathanWalker
7+
- rigor789
38
---
49

5-
The ability for all your views to render with the right dimensions and positions requires a run of "the layout process". When rendering, a recursive process runs through every view in the **view hierarchy** in two passes — a measure pass and a layout pass.
10+
When rendering, a recursive process runs through every view in the **view hierarchy** in two passes — a measure pass and a layout pass.
611

7-
During **the measure pass** every view is measured to obtain its desired size. The following properties are considered during the measuring:
12+
During **the measure pass** every view is measured to obtain its desired size. The following properties are considered during measuring:
813

914
- `width`, `height`
1015
- `minWidth`, `minHeight`
@@ -17,14 +22,13 @@ During **the layout pass** every view is placed in a specific layout slot. The s
1722
- `horizontalAlignment`, `verticalAlignment`
1823

1924
The layout process is by nature an resource-intensive process and it's performance highly depends on the number views (and complexity).
20-
<!-- TODO: fix links -->
25+
2126
:::tip
27+
2228
It's a good practice to minimize deep nesting of views. Instead, utilize different [Layout Containers](/ui/#layout-containers) to achieve a simpler and more organized view hierarchy. This approach improves readability, maintainability and performance.
2329

2430
**For example:** don't treat `<StackLayout>` as a `<div>` &mdash; instead try to use a `<GridLayout>` with specific `rows` and `columns` to achieve the same result:
2531

26-
- Bad Practice:
27-
2832
```html
2933
<StackLayout>
3034
<StackLayout orientation="horizontal">
@@ -37,7 +41,8 @@ It's a good practice to minimize deep nesting of views. Instead, utilize differe
3741
</StackLayout>
3842
```
3943

40-
- Good Practice:
44+
Better version:
45+
4146
<!-- -->
4247

4348
```html
@@ -50,4 +55,4 @@ It's a good practice to minimize deep nesting of views. Instead, utilize differe
5055

5156
One-offs are fine with the `<StackLayout>` approach, but building an entire app with the first approach will usually result in poor performance.
5257

53-
:::
58+
:::

content/sidebar.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ export default [
235235
{
236236
text: 'iOS',
237237
link: '/guide/extending-classes-and-conforming-to-protocols-ios',
238-
}
239-
]
238+
},
239+
],
240240
},
241241
{
242242
text: 'Multithreading',
@@ -289,8 +289,8 @@ export default [
289289
link: '/guide/property-system',
290290
},
291291
{
292-
text: 'Layout',
293-
link: '/guide/the-layout-process'
292+
text: 'The Layout Process',
293+
link: '/guide/advanced/the-layout-process',
294294
},
295295
{
296296
text: 'Error Handling',

0 commit comments

Comments
 (0)