@@ -11,6 +11,7 @@ import {Style, properties as styleProps} from 'ui/styling';
11
11
declare var CGRectMake : any ;
12
12
13
13
export class CheckBox extends ContentView {
14
+ private _initalizing : boolean = true ;
14
15
private _iosCheckbox : BEMCheckBox ;
15
16
private _iosLabel : UILabel ;
16
17
private _delegate : BEMCheckBoxDelegateImpl ;
@@ -149,6 +150,7 @@ export class CheckBox extends ContentView{
149
150
}
150
151
151
152
public onLoaded ( ) {
153
+ this . _iosCheckbox . delegate = this . _delegate ;
152
154
// Only here is where the view xml width/height is defined
153
155
this . _iosCheckbox . frame . size . width = this . width ;
154
156
this . _iosCheckbox . frame . size . height = this . height ;
@@ -188,6 +190,8 @@ export class CheckBox extends ContentView{
188
190
if ( typeof this . _offAnimationType !== 'undefined' ) {
189
191
this . offAnimationType = this . _offAnimationType ;
190
192
}
193
+
194
+ this . _initalizing = false ;
191
195
}
192
196
193
197
public toggle ( ) {
@@ -213,10 +217,10 @@ export class CheckBox extends ContentView{
213
217
}
214
218
215
219
function onCheckedPropertyChanged ( data : PropertyChangeData ) {
216
- console . log ( "Check Changed" ) ;
217
-
218
- if ( this . _ios ) {
219
- this . _ios . on = data . newValue ;
220
+ if ( ! this . _initalizing ) {
221
+ if ( this . _ios ) {
222
+ this . _ios . on = data . newValue ;
223
+ }
220
224
}
221
225
}
222
226
@@ -225,8 +229,10 @@ function onCheckedPropertyChanged(data: PropertyChangeData) {
225
229
226
230
227
231
function onTextPropertyChanged ( data : PropertyChangeData ) {
228
- if ( this . _iosLabel )
229
- this . _iosLabel . text = this . text ;
232
+ if ( ! this . _initalizing ) {
233
+ if ( this . _iosLabel )
234
+ this . _iosLabel . text = this . text ;
235
+ }
230
236
}
231
237
232
238
// register the setNativeValue callbacks
@@ -246,12 +252,10 @@ class BEMCheckBoxDelegateImpl extends NSObject implements BEMCheckBoxDelegate {
246
252
}
247
253
248
254
public animationDidStopForCheckBox ( checkBox : BEMCheckBox ) : void {
249
- debugger ;
250
- console . log ( "animationDidStopForCheckBox" ) ;
255
+ //TODO: Maybe trigger event
251
256
}
252
257
253
258
public didTapCheckBox ( checkBox : BEMCheckBox ) : void {
254
- debugger ;
255
- console . log ( "didTapCheckBox" ) ;
259
+ this . _owner . get ( ) . checked = checkBox . on ;
256
260
}
257
261
}
0 commit comments