You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs_src/content/docs/20-utilities.md
+62-1
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,9 @@ For a concrete example of this pattern see svelte native's [listView element sou
36
36
37
37
### Property Element
38
38
39
-
Some NativeScript controls have properties that expect NativeScript views as values. To make this possible using markup, Svelte Native introduces the property element. This element works like the ones in the NativeScript core documentation and set some property of their parent view with the value of the first child of the property element. The tag name is the name of the parent element followed by the property name. For example `<page.actionbar>` would set the `actionbar` property of the parent `page` element.
39
+
Some NativeScript controls have properties that expect NativeScript views as values. To make this possible using markup, Svelte Native introduce two helpers, the property element and the `prop` directive.
40
+
41
+
This property element works like the ones in the NativeScript core documentation and set some property of their parent view with the value of the first child of the property element. The tag name is the name of the parent element followed by the property name. For example `<page.actionbar>` would set the `actionbar` property of the parent `page` element.
The Property Element is useful but can be a little verbose. Svelte native also introduces a custom svelte directive called `prop`. The prop directive will take the native view of the component it is on an assign it to a property of the parent element.
85
+
86
+
For example our side drawer example from Property Element
87
+
```html
88
+
<radSideDrawer>
89
+
<radSideDrawer.drawerContent>
90
+
<stackLayout />
91
+
</radSideDrawer.drawerContent>
92
+
<radSideDrawer.mainContent>
93
+
<stackLayout />
94
+
</radSideDrawer.mainContent>
95
+
</radSideDrawer>
96
+
```
97
+
98
+
can be written using the prop element as
99
+
100
+
```html
101
+
<radSideDrawer>
102
+
<stackLayoutprop:drawerContent />
103
+
<stackLayoutprop:mainContent/>
104
+
</radSideDrawer>
105
+
```
106
+
107
+
### Implicit Property Directives
108
+
109
+
Many advanced controls (including those in the nativescript-ui packages) use elements to provide configuration. These configuration properties need to be assigned to a parent property but often only have one valid parent property to which they can be assigned, so the `prop:` or Property Element becomes boilerplate
110
+
111
+
Take this example from `nativescript-ui-dataform`:
on a large form, the `prop:properties``prop:editor` and `prop:params` can get repetitive. Svelte Native lets you register a configuration element with a default property name for the `prop:` directive. When this is set, the `prop:` directive is not needed at all:
Copy file name to clipboardExpand all lines: docs_src/content/docs/40-components.md
+10-11
Original file line number
Diff line number
Diff line change
@@ -334,27 +334,25 @@ function onItemTap(event) {
334
334
335
335
Multiple templates can be used for different layouts of list items, which is similar to [NativeScript Multiple Templates Selector Function](https://docs.nativescript.org/ui/components/list-view#multiple-templates-selector-function). `itemTemplateSelector` is used to select template using `key` which is returned based on your logic.
336
336
337
-
> **Note:** Use _multiple templates_ approach instead of `{#if}` block, because the _view recycling_ concept does not work as intended since `<listView>` cannot reuse the same template view if off-screen items require different type of template.
337
+
> **Note:** Use _multiple templates_ approach instead of `{#if}` block, because the _view recycling_ concept does not work as intended since `<listView>` cannot reuse the same template view if off-screen items require different type of template. [See this article](https://medium.com/@alexander.vakrilov/faster-nativescript-listview-with-multiple-item-templates-8f903a32e48f)
0 commit comments