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: content/guide/create-custom-native-elements.md
+14-19
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ contributors:
5
5
- NathanWalker
6
6
---
7
7
8
-
When working on view markup with NativeScript, a collection of elements you interact with are registered for you like [GridLayout](https://docs.nativescript.org/ui/grid-layout), [Button](https://docs.nativescript.org/ui/button), [Label](https://docs.nativescript.org/ui/label), etc. These are just commonly used elements.
8
+
When working on view markup with NativeScript, a collection of elements you interact with are registered for you like [GridLayout](https://docs.nativescript.org/ui/grid-layout), [Button](https://docs.nativescript.org/ui/button), [Label](https://docs.nativescript.org/ui/label), etc. These are just commonly used elements.
9
9
10
10
At anytime, you can create your own, extend others and fully customize views for your needs.
11
11
@@ -81,7 +81,7 @@ You can now use it like anything else:
81
81
The registration can be done in the bootsrap file, commonly `app.ts`. With React, we use camelCase on elements where applicable.
@@ -248,4 +243,4 @@ import { Checkbox } from './checkbox'
248
243
249
244
## Customize Existing Elements?
250
245
251
-
Rather than create a new element from scratch, you may want to customize existing view elements. Learn about how to [extend any element for custom beavhior here](/guide/customizing-view-elements).
246
+
Rather than create a new element from scratch, you may want to customize existing view elements. Learn about how to [extend any element for custom beavhior here](/guide/customizing-view-elements).
Copy file name to clipboardExpand all lines: content/guide/customizing-view-elements.md
+41-44
Original file line number
Diff line number
Diff line change
@@ -34,97 +34,97 @@ For instance, even this [Stack Overflow answer](https://stackoverflow.com/a/4874
34
34
In our `index.ios.ts` we can extend the existing ListPicker to add our own [iOS delegate](https://developer.apple.com/documentation/uikit/uipickerviewdelegate?language=objc) which implements the method suggested to support making the font size bigger. We can even start with an exact replica of the [ListPicker](https://github.com/NativeScript/NativeScript/blob/main/packages/core/ui/list-picker/index.ios.ts) in core and distill it down to just what we need.
This custom element now implements the `UIPickerViewDelegate`'s [pickerViewViewForRowForComponentReusingView](https://developer.apple.com/documentation/uikit/uipickerviewdelegate/pickerview(_:viewforrow:forcomponent:reusing:)?language=objc) allowing us to customize the font size with this line:
124
+
This custom element now implements the `UIPickerViewDelegate`'s [pickerViewViewForRowForComponentReusingView](<https://developer.apple.com/documentation/uikit/uipickerviewdelegate/pickerview(_:viewforrow:forcomponent:reusing:)?language=objc>) allowing us to customize the font size with this line:
125
125
126
126
```ts
127
-
label.font=UIFont.systemFontOfSize(26);
127
+
label.font=UIFont.systemFontOfSize(26)
128
128
```
129
129
130
130
#### Customize Highlight Color
@@ -138,21 +138,21 @@ export class CustomListPicker extends ListPicker {
138
138
// ...
139
139
140
140
onLoaded() {
141
-
super.onLoaded();
141
+
super.onLoaded()
142
142
// Optional: customize selection highlight bar
143
143
for (let i =0; i<this.nativeViewProtected.subviews.count; i++) {
0 commit comments