Skip to content

Commit 7279d9f

Browse files
Bindable property support, add Labels
1 parent 8a08aa8 commit 7279d9f

12 files changed

+327
-105
lines changed

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ screens/
44
*.log
55
*.ts
66
!index.d.ts
7-
!checkbox.d.ts
7+
!checkbox.d.ts
8+
!BEMCheckBox.d.ts

BEMCheckBox.d.ts

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
2+
declare class BEMAnimationManager extends NSObject {
3+
4+
static alloc(): BEMAnimationManager; // inherited from NSObject
5+
6+
static new(): BEMAnimationManager; // inherited from NSObject
7+
8+
animationDuration: number;
9+
10+
constructor(); // inherited from NSObject
11+
12+
constructor(o: { animationDuration: number; });
13+
14+
fillAnimationWithBouncesAmplitudeReverse(bounces: number, amplitude: number, reverse: boolean): CAKeyframeAnimation;
15+
16+
morphAnimationFromPathToPath(fromPath: UIBezierPath, toPath: UIBezierPath): CABasicAnimation;
17+
18+
opacityAnimationReverse(reverse: boolean): CABasicAnimation;
19+
20+
self(): BEMAnimationManager; // inherited from NSObjectProtocol
21+
22+
strokeAnimationReverse(reverse: boolean): CABasicAnimation;
23+
}
24+
25+
declare const enum BEMAnimationType {
26+
27+
Stroke = 0,
28+
29+
Fill = 1,
30+
31+
Bounce = 2,
32+
33+
Flat = 3,
34+
35+
OneStroke = 4,
36+
37+
Fade = 5
38+
}
39+
40+
declare const enum BEMBoxType {
41+
42+
Circle = 0,
43+
44+
Square = 1
45+
}
46+
47+
declare class BEMCheckBox extends UIView {
48+
49+
static appearance(): BEMCheckBox; // inherited from UIAppearance
50+
51+
static appearanceForTraitCollection(trait: UITraitCollection): BEMCheckBox; // inherited from UIAppearance
52+
53+
static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): BEMCheckBox; // inherited from UIAppearance
54+
55+
//static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray<typeof NSObject>): BEMCheckBox; // inherited from UIAppearance
56+
57+
static appearanceWhenContainedIn(ContainerClass: typeof NSObject): BEMCheckBox; // inherited from UIAppearance
58+
59+
//static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray<typeof NSObject>): BEMCheckBox; // inherited from UIAppearance
60+
61+
animationDuration: number;
62+
63+
boxType: BEMBoxType;
64+
65+
delegate: BEMCheckBoxDelegate;
66+
67+
hideBox: boolean;
68+
69+
lineWidth: number;
70+
71+
minimumTouchSize: CGSize;
72+
73+
offAnimationType: BEMAnimationType;
74+
75+
on: boolean;
76+
77+
onAnimationType: BEMAnimationType;
78+
79+
onCheckColor: UIColor;
80+
81+
onFillColor: UIColor;
82+
83+
onTintColor: UIColor;
84+
85+
constructor(o: { coder: NSCoder; }); // inherited from NSCoding
86+
87+
constructor(o: { frame: CGRect; }); // inherited from UIView
88+
89+
reload(): void;
90+
91+
self(): BEMCheckBox; // inherited from NSObjectProtocol
92+
93+
setOnAnimated(on: boolean, animated: boolean): void;
94+
}
95+
96+
interface BEMCheckBoxDelegate extends NSObjectProtocol {
97+
98+
animationDidStopForCheckBox?(checkBox: BEMCheckBox): void;
99+
100+
didTapCheckBox?(checkBox: BEMCheckBox): void;
101+
}
102+
declare var BEMCheckBoxDelegate: {
103+
104+
prototype: BEMCheckBoxDelegate;
105+
};
106+
107+
declare var BEMCheckBoxVersionNumber: number;
108+
109+
//declare var BEMCheckBoxVersionString: interop.Reference<number>;
110+
111+
declare class BEMPathManager extends NSObject {
112+
113+
static alloc(): BEMPathManager; // inherited from NSObject
114+
115+
static new(): BEMPathManager; // inherited from NSObject
116+
117+
boxType: BEMBoxType;
118+
119+
lineWidth: number;
120+
121+
size: number;
122+
123+
constructor(); // inherited from NSObject
124+
125+
pathForBox(): UIBezierPath;
126+
127+
pathForCheckMark(): UIBezierPath;
128+
129+
pathForFlatCheckMark(): UIBezierPath;
130+
131+
pathForLongCheckMark(): UIBezierPath;
132+
133+
self(): BEMPathManager; // inherited from NSObjectProtocol
134+
}

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# NativeScript CheckBox :white_check_mark:
77
A NativeScript plugin for the native checkbox widget.
88

9-
** Android only - there is no concept of a checkbox on iOS. I'm looking to find a cocoapod to bring this plugin to both platforms. **
10-
119
#### Platform controls used:
1210
Android |
1311
---------- |
1412
[Android CheckBox](https://developer.android.com/reference/android/widget/CheckBox.html) |
15-
13+
iOS |
14+
---------- |
15+
[BEMCheckBox](http://cocoapods.org/pods/BEMCheckBox) |
1616

1717
## Sample Usage
1818

@@ -69,4 +69,9 @@ public getCheckProp() {
6969

7070
## Styling
7171

72-
- **color** - set the checkbox color tint - Android 21+ only.
72+
- **color** - set the checkbox color tint - Android 21+ only.
73+
74+
## Demo Setup
75+
* npm install tns-platform-declarations
76+
* preparedemo
77+
* npm run demo.ios

checkbox.android.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Color } from "color";
33
import { isAndroid, device } from "platform";
44
import { Property, PropertyChangeData } from "ui/core/dependency-observable";
55
import { PropertyMetadata } from "ui/core/proxy";
6-
import style = require("ui/styling/style");
6+
//import style = require("ui/styling/style");
77

88
declare var android: any;
99

@@ -105,7 +105,7 @@ function onTextPropertyChanged(data: PropertyChangeData) {
105105
(<PropertyMetadata>CheckBox.textProperty.metadata).onSetNativeValue = onTextPropertyChanged;
106106

107107

108-
108+
/*
109109
export class CheckBoxStyler implements style.Styler {
110110
private static setColorProperty(view: any, newValue: any) {
111111
var cb = <android.widget.CheckBox>view._nativeView;
@@ -129,4 +129,4 @@ export class CheckBoxStyler implements style.Styler {
129129
}
130130
}
131131
132-
CheckBoxStyler.registerHandlers();
132+
CheckBoxStyler.registerHandlers();*/

0 commit comments

Comments
 (0)