Skip to content

Commit 1fc3214

Browse files
committed
feat (wrap ns components): Wrap DatePicker and Button elements. Add them to the test app.
1 parent 9c986eb commit 1fc3214

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

platform/nativescript/element-registry.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ registerElementLegacy('VTemplate', null, {
182182

183183
registerElement('Label', () => require('tns-core-modules/ui/label').Label)
184184

185-
registerElementLegacy(
185+
registerElement(
186186
'DatePicker',
187187
() => require('tns-core-modules/ui/date-picker').DatePicker,
188188
{
@@ -205,9 +205,9 @@ registerElementLegacy(
205205
'Border',
206206
() => require('tns-core-modules/ui/border').Border
207207
)
208-
registerElementLegacy(
208+
registerElement(
209209
'Button',
210-
() => require('tns-core-modules/ui/button').Button
210+
() => require('tns-core-modules/ui/button').Button,
211211
)
212212
registerElementLegacy(
213213
'ContentView',

samples/app/127.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ new Vue({
1111
<Frame>
1212
<Page>
1313
<ActionBar title="Issue #127" />
14-
14+
1515
<StackLayout>
1616
<Label v-if="foo" text="Enable" @tap="foo = false"/>
17-
<Label v-if="!foo" text="Disable" @tap="foo = true"/>
17+
<Label v-else text="Disable" @tap="foo = true"/>
1818
</StackLayout>
1919
</Page>
2020
</Frame>

samples/app/app-with-all-components.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Vue.config.silent = false
66
new Vue({
77
data() {
88
return {
9+
timesPressed: 0,
910
labelCondition: false,
1011
selectedDate: new Date()
1112
}
@@ -16,10 +17,6 @@ new Vue({
1617
<ActionBar title="App with all components" />
1718
1819
<StackLayout class="m-t-20">
19-
<Label
20-
ref="label"
21-
text="Some Text" />
22-
2320
<Label
2421
v-if="labelCondition"
2522
text="Label with labelCondition enabled. Tap me to disable"
@@ -33,16 +30,30 @@ new Vue({
3330
textWrap />
3431
3532
<DatePicker
33+
ref="date"
3634
v-model="selectedDate"
3735
@dateChange="onDateChanged" />
36+
37+
<Button
38+
:text="buttonText"
39+
@tap="onButtonPress" />
3840
</StackLayout>
3941
</Page>
4042
</Frame>
4143
`,
44+
computed: {
45+
buttonText () {
46+
return (this.timesPressed > 0) ? `Pressed ${this.timesPressed} times` : 'Press me'
47+
}
48+
},
4249
methods: {
43-
onDateChanged() {
50+
onDateChanged () {
4451
console.log(`Date changed to ${this.selectedDate}`)
45-
}
52+
},
53+
onButtonPress () {
54+
console.log('Button pressed')
55+
this.timesPressed++
56+
},
4657
},
4758
created() {
4859
console.log(Vue.compile(this.$options.template).render.toString())

0 commit comments

Comments
 (0)