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() {
6464- ** text** - text to use with the checkbox
6565- ** fillColor** - Color of the checkbox element
6666
67- ## Events
68- - ** checkedChanged** - When the state of the checkbox changes
69-
7067## API
7168
7269- ** toggle()** - Change the checked state of the view to the inverse of its current state.
7370
74- ## Styling
71+ ## Css Styling
7572
7673- ** color** - set the text label color
74+ - ** font-size** - checkbox is sized to text from here
7775- ** border-width** - set the line width of the checkbox element: iOS only
7876
7977## Demo Setup
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export class CheckBox extends Button implements CheckBoxInterface {
2222 private _checked : boolean ;
2323 private _fillColor : string = "#0075ff" ;
2424 private _tintColor : string = "#0075ff" ;
25- private _lineWidth : number ;
25+ private _lineWidth : number = 1 ;
2626 private _hideBox : boolean ;
2727 private _boxType : number ;
2828 private _tint : string ;
@@ -223,17 +223,13 @@ export class CheckBox extends Button implements CheckBoxInterface {
223223 }
224224
225225 public _onCheckedPropertyChanged ( data : PropertyChangeData ) {
226- console . log ( "_onCheckedPropertyChanged to " + data . newValue ) ;
227- debugger ;
228226 if ( this . _iosCheckbox ) {
229227 this . _iosCheckbox . setOnAnimated ( data . newValue , true ) ;
230228 }
231229 }
232230}
233231
234232function onCheckedPropertyChanged ( data : PropertyChangeData ) {
235- console . log ( "onCheckedPropertyChanged to " + data . newValue ) ;
236- debugger ;
237233 var checkbox = < CheckBox > data . object ;
238234 checkbox . _onCheckedPropertyChanged ( data ) ;
239235}
@@ -264,7 +260,6 @@ class BEMCheckBoxDelegateImpl extends NSObject implements BEMCheckBoxDelegate {
264260 public didTapCheckBox ( checkBox : BEMCheckBox ) : void {
265261 let owner = this . _owner . get ( ) ;
266262 if ( owner ) {
267- console . log ( "delegate check " + checkBox . on ) ;
268263 owner . _onPropertyChangedFromNative ( CheckBox . checkedProperty , checkBox . on ) ;
269264 }
270265 }
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ Label {
3434 color : # FFF ;
3535 border-radius : 4 ;
3636 font-size : 10 ;
37- margin : 0 20 ;
37+ padding : 5 9 ;
3838
3939}
4040
@@ -50,7 +50,7 @@ CheckBox{
5050 color : white;
5151 border-color : yellow;
5252 border-width : 1 ;
53- font-size : 15 ;
53+ font-size : 20 ;
5454}
5555
5656.demosection {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { android } from "application";
66import { HelloWorldModel } from './main-view-model' ;
77import { DataItem } from './main-view-model' ;
88import { CheckBox } from 'nativescript-checkbox' ;
9+ import { Label } from 'ui/label' ;
910
1011let model : HelloWorldModel ;
1112let page : Page ;
@@ -35,7 +36,7 @@ export function onTapTest(args){
3536 model . updateMessage ( ) ;
3637}
3738
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 ) ) ;
4142}
Original file line number Diff line number Diff line change 88 <Label text =" Functions" class =" title" />
99 <StackLayout class =" listitem" >
1010 <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 " />
1212 <Button col =" 1" text =" GO" tap =" onToggleTest" class =" button" />
1313 </GridLayout >
1414 </StackLayout >
3030 <Label text =" {{ eventLabel }}" textWrap =" true" class =" message" />
3131 </StackLayout >
3232
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 >
3338 </StackLayout >
3439</ScrollView >
3540
Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ import observableArrayModule = require("data/observable-array");
77
88export class HelloWorldModel extends Observable {
99 public data : observableArrayModule . ObservableArray < DataItem > ;
10- public check1 : DataItem ;
11- public check2 : DataItem ;
12- public check3 : DataItem ;
1310 private _eventLabel : string ;
1411 private _state : string ;
1512 private _eventCount : number ;
You can’t perform that action at this time.
0 commit comments