File tree Expand file tree Collapse file tree 6 files changed +15
-19
lines changed Expand file tree Collapse file tree 6 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -64,16 +64,14 @@ public getCheckProp() {
64
64
- ** text** - text to use with the checkbox
65
65
- ** fillColor** - Color of the checkbox element
66
66
67
- ## Events
68
- - ** checkedChanged** - When the state of the checkbox changes
69
-
70
67
## API
71
68
72
69
- ** toggle()** - Change the checked state of the view to the inverse of its current state.
73
70
74
- ## Styling
71
+ ## Css Styling
75
72
76
73
- ** color** - set the text label color
74
+ - ** font-size** - checkbox is sized to text from here
77
75
- ** border-width** - set the line width of the checkbox element: iOS only
78
76
79
77
## Demo Setup
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export class CheckBox extends Button implements CheckBoxInterface {
22
22
private _checked : boolean ;
23
23
private _fillColor : string = "#0075ff" ;
24
24
private _tintColor : string = "#0075ff" ;
25
- private _lineWidth : number ;
25
+ private _lineWidth : number = 1 ;
26
26
private _hideBox : boolean ;
27
27
private _boxType : number ;
28
28
private _tint : string ;
@@ -223,17 +223,13 @@ export class CheckBox extends Button implements CheckBoxInterface {
223
223
}
224
224
225
225
public _onCheckedPropertyChanged ( data : PropertyChangeData ) {
226
- console . log ( "_onCheckedPropertyChanged to " + data . newValue ) ;
227
- debugger ;
228
226
if ( this . _iosCheckbox ) {
229
227
this . _iosCheckbox . setOnAnimated ( data . newValue , true ) ;
230
228
}
231
229
}
232
230
}
233
231
234
232
function onCheckedPropertyChanged ( data : PropertyChangeData ) {
235
- console . log ( "onCheckedPropertyChanged to " + data . newValue ) ;
236
- debugger ;
237
233
var checkbox = < CheckBox > data . object ;
238
234
checkbox . _onCheckedPropertyChanged ( data ) ;
239
235
}
@@ -264,7 +260,6 @@ class BEMCheckBoxDelegateImpl extends NSObject implements BEMCheckBoxDelegate {
264
260
public didTapCheckBox ( checkBox : BEMCheckBox ) : void {
265
261
let owner = this . _owner . get ( ) ;
266
262
if ( owner ) {
267
- console . log ( "delegate check " + checkBox . on ) ;
268
263
owner . _onPropertyChangedFromNative ( CheckBox . checkedProperty , checkBox . on ) ;
269
264
}
270
265
}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ Label {
34
34
color : # FFF ;
35
35
border-radius : 4 ;
36
36
font-size : 10 ;
37
- margin : 0 20 ;
37
+ padding : 5 9 ;
38
38
39
39
}
40
40
@@ -50,7 +50,7 @@ CheckBox{
50
50
color : white;
51
51
border-color : yellow;
52
52
border-width : 1 ;
53
- font-size : 15 ;
53
+ font-size : 20 ;
54
54
}
55
55
56
56
.demosection {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { android } from "application";
6
6
import { HelloWorldModel } from './main-view-model' ;
7
7
import { DataItem } from './main-view-model' ;
8
8
import { CheckBox } from 'nativescript-checkbox' ;
9
+ import { Label } from 'ui/label' ;
9
10
10
11
let model : HelloWorldModel ;
11
12
let page : Page ;
@@ -35,7 +36,7 @@ export function onTapTest(args){
35
36
model . updateMessage ( ) ;
36
37
}
37
38
38
- export function onCheckedTest ( args : any ) {
39
- debugger ;
40
- model . state = "Checkbox is " + ( args . checked ? "checked" : "not checked" ) ;
39
+ export function onDumpModel ( args : any ) {
40
+ var label = < Label > page . getViewById ( "modelDumpLabel" ) ;
41
+ label . text = JSON . stringify ( model . data . getItem ( 0 ) ) ;
41
42
}
Original file line number Diff line number Diff line change 8
8
<Label text =" Functions" class =" title" />
9
9
<StackLayout class =" listitem" >
10
10
<GridLayout columns =" *, auto" class =" demosection" >
11
- <CheckBox : CheckBox id =" toggleTest" col =" 0" text =" toggle()" checked =" false" />
11
+ <CheckBox : CheckBox id =" toggleTest" col =" 0" text =" toggle()" checked =" false" style = " margin-right: 10 " />
12
12
<Button col =" 1" text =" GO" tap =" onToggleTest" class =" button" />
13
13
</GridLayout >
14
14
</StackLayout >
30
30
<Label text =" {{ eventLabel }}" textWrap =" true" class =" message" />
31
31
</StackLayout >
32
32
33
+ <Label text =" Debug" class =" title" />
34
+ <StackLayout class =" listitem" >
35
+ <Button text =" View Model" tap =" onDumpModel" class =" button" style =" horizontal-align: left;" />
36
+ <Label id =" modelDumpLabel" textWrap =" true" class =" message" />
37
+ </StackLayout >
33
38
</StackLayout >
34
39
</ScrollView >
35
40
Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ import observableArrayModule = require("data/observable-array");
7
7
8
8
export class HelloWorldModel extends Observable {
9
9
public data : observableArrayModule . ObservableArray < DataItem > ;
10
- public check1 : DataItem ;
11
- public check2 : DataItem ;
12
- public check3 : DataItem ;
13
10
private _eventLabel : string ;
14
11
private _state : string ;
15
12
private _eventCount : number ;
You can’t perform that action at this time.
0 commit comments