@akylas/nativescript-checkbox
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -59,31 +59,34 @@ import { booleanConverter, Button, Color, CssProperty, Property, Style } from '@nativescript/core'; | ||
createNativeView() { | ||
return BEMCheckBox.alloc().initWithFrame(CGRectMake(0, 0, 80, 80)); | ||
const view = super.createNativeView(); | ||
this._iosCheckbox = BEMCheckBox.alloc().initWithFrame(CGRectMake(0, 0, 80, 80)); | ||
view.addSubview(this._iosCheckbox); | ||
return view; | ||
} | ||
set fillColor(color) { | ||
this._fillColor = color; | ||
this.nativeViewProtected.onFillColor = new Color(color).ios; | ||
this._iosCheckbox.onFillColor = new Color(color).ios; | ||
} | ||
set onFillColor(color) { | ||
this._onFillColor = color; | ||
this.nativeViewProtected.onFillColor = new Color(color).ios; | ||
this._iosCheckbox.onFillColor = new Color(color).ios; | ||
} | ||
set tintColor(color) { | ||
this._tintColor = color; | ||
this.nativeViewProtected.tintColor = new Color(color).ios; | ||
this._iosCheckbox.tintColor = new Color(color).ios; | ||
} | ||
set onTintColor(color) { | ||
this._onTintColor = color; | ||
this.nativeViewProtected.onTintColor = new Color(color).ios; | ||
this._iosCheckbox.onTintColor = new Color(color).ios; | ||
} | ||
set checkBoxBackgroundColor(color) { | ||
this._checkBoxBackgroundColor = color; | ||
this.nativeViewProtected.offFillColor = new Color(color).ios; | ||
this._iosCheckbox.offFillColor = new Color(color).ios; | ||
} | ||
set onCheckColor(color) { | ||
this._onCheckColor = color; | ||
this.nativeViewProtected.onCheckColor = new Color(color).ios; | ||
this._iosCheckbox.onCheckColor = new Color(color).ios; | ||
} | ||
[boxTypeProperty.setNative](value) { | ||
if (this.nativeViewProtected) { | ||
this.nativeViewProtected.boxType = value; | ||
this._iosCheckbox.boxType = value; | ||
} | ||
@@ -95,22 +98,22 @@ } | ||
[checkedProperty.setNative](value) { | ||
this.nativeViewProtected.setOnAnimated(value, true); | ||
this._iosCheckbox.setOnAnimated(value, true); | ||
} | ||
set checkedAnimated(value) { | ||
this.nativeViewProtected.setOnAnimated(value, true); | ||
this._iosCheckbox.setOnAnimated(value, true); | ||
} | ||
set lineWidth(value) { | ||
this.nativeViewProtected.lineWidth = value; | ||
this._iosCheckbox.lineWidth = value; | ||
this._lineWidth = value; | ||
} | ||
set hideBox(value) { | ||
this.nativeViewProtected.hideBox = value; | ||
this._iosCheckbox.hideBox = value; | ||
this._hideBox = value; | ||
} | ||
set animationDuration(value) { | ||
this.nativeViewProtected.animationDuration = value; | ||
this._iosCheckbox.animationDuration = value; | ||
this._animationDuration = value; | ||
} | ||
set onAnimationType(value) { | ||
if (this.nativeViewProtected) | ||
this.nativeViewProtected.onAnimationType = this._getAnimationType(value); | ||
if (this._iosCheckbox) | ||
this._iosCheckbox.onAnimationType = this._getAnimationType(value); | ||
else | ||
@@ -120,10 +123,10 @@ this._onAnimationType = value; | ||
set offAnimationType(value) { | ||
this.nativeViewProtected.offAnimationType = this._getAnimationType(value); | ||
this._iosCheckbox.offAnimationType = this._getAnimationType(value); | ||
this._offAnimationType = value; | ||
} | ||
get nativeiOSCheckBox() { | ||
return this.nativeViewProtected; | ||
return this._iosCheckbox; | ||
} | ||
reload(value) { | ||
this.nativeViewProtected.reload(); | ||
this._iosCheckbox.reload(); | ||
} | ||
@@ -148,23 +151,22 @@ initNativeView() { | ||
} | ||
this.nativeViewProtected.delegate = this._delegate; | ||
this.nativeViewProtected.frame = CGRectMake(0, 0, fontSize, fontSize); | ||
this.nativeViewProtected.center = CGPointMake(this.nativeViewProtected.center.x, fontSize / 2 + 3); | ||
this._iosCheckbox.delegate = this._delegate; | ||
this._iosCheckbox.frame = CGRectMake(0, 0, fontSize, fontSize); | ||
this._iosCheckbox.center = CGPointMake(this._iosCheckbox.center.x, fontSize / 2 + 3); | ||
this.style.paddingLeft = fontSize + (fontSize > 20 ? 10 : 5); | ||
this.style.textAlignment = 'left'; | ||
if (this._onCheckColor) { | ||
this.nativeViewProtected.onCheckColor = new Color(this._onCheckColor).ios; | ||
this._iosCheckbox.onCheckColor = new Color(this._onCheckColor).ios; | ||
} | ||
if (this._onFillColor) { | ||
this.nativeViewProtected.onFillColor = new Color(this._onFillColor).ios; | ||
this._iosCheckbox.onFillColor = new Color(this._onFillColor).ios; | ||
} | ||
if (this._onTintColor) { | ||
this.nativeViewProtected.onTintColor = new Color(this._onTintColor).ios; | ||
this._iosCheckbox.onTintColor = new Color(this._onTintColor).ios; | ||
} | ||
if (this._fillColor) { | ||
this.nativeViewProtected.onFillColor = new Color(this._fillColor).ios; | ||
this._iosCheckbox.onFillColor = new Color(this._fillColor).ios; | ||
} | ||
if (this._tintColor) { | ||
this.nativeViewProtected.tintColor = new Color(this._tintColor).ios; | ||
this._iosCheckbox.tintColor = new Color(this._tintColor).ios; | ||
} | ||
this.nativeView.addSubview(this.nativeViewProtected); | ||
if (typeof this._lineWidth !== 'undefined') { | ||
@@ -188,3 +190,4 @@ this.lineWidth = this._lineWidth; | ||
disposeNativeView() { | ||
this.nativeViewProtected.delegate = null; | ||
this._iosCheckbox.delegate = null; | ||
this._iosCheckbox = null; | ||
this.removeEventListener('tap'); | ||
@@ -214,3 +217,3 @@ } | ||
_onCheckedPropertyChanged(checkbox, oldValue, newValue) { | ||
if (!this.nativeView) { | ||
if (!this._iosCheckbox) { | ||
return; | ||
@@ -217,0 +220,0 @@ } |
{ | ||
"name": "@akylas/nativescript-checkbox", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "NativeScript plugin for checkbox.", | ||
@@ -5,0 +5,0 @@ "main": "checkbox", |
1305
281518