Skip to content

Commit 3650c1f

Browse files
authored
Merge pull request #9 from sitefinitysteve/master
Fix iOS tap event
2 parents 994cbd0 + 37b47e2 commit 3650c1f

File tree

8 files changed

+111
-10
lines changed

8 files changed

+111
-10
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ public getCheckProp() {
7373

7474
## Demo Setup
7575
* npm install tns-platform-declarations
76-
* preparedemo
76+
* npm preparedemo
7777
* npm run demo.ios

app/App_Resources/iOS/Info.plist

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${EXECUTABLE_NAME}</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>${PRODUCT_NAME}</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1.0</string>
23+
<key>LSRequiresIPhoneOS</key>
24+
<true/>
25+
<key>UILaunchStoryboardName</key>
26+
<string>LaunchScreen</string>
27+
<key>UIRequiresFullScreen</key>
28+
<true/>
29+
<key>UIRequiredDeviceCapabilities</key>
30+
<array>
31+
<string>armv7</string>
32+
</array>
33+
<key>UISupportedInterfaceOrientations</key>
34+
<array>
35+
<string>UIInterfaceOrientationPortrait</string>
36+
<string>UIInterfaceOrientationLandscapeLeft</string>
37+
<string>UIInterfaceOrientationLandscapeRight</string>
38+
</array>
39+
<key>UISupportedInterfaceOrientations~ipad</key>
40+
<array>
41+
<string>UIInterfaceOrientationPortrait</string>
42+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
43+
<string>UIInterfaceOrientationLandscapeLeft</string>
44+
<string>UIInterfaceOrientationLandscapeRight</string>
45+
</array>
46+
</dict>
47+
</plist>

checkbox.ios.ts

+6
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ class BEMCheckBoxDelegateImpl extends NSObject implements BEMCheckBoxDelegate {
260260
public didTapCheckBox(checkBox: BEMCheckBox): void {
261261
let owner = this._owner.get();
262262
if (owner) {
263+
var eventData = {
264+
eventName: "tap",
265+
object: owner
266+
};
267+
268+
owner.notify(eventData);
263269
owner._onPropertyChangedFromNative(CheckBox.checkedProperty, checkBox.on);
264270
}
265271
}

demo/app/main-page.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export function onToggleTest(args){
3333

3434
export function onTapTest(args){
3535
console.log("tap event test");
36-
model.updateMessage();
36+
let box = <CheckBox>args.object;
37+
model.updateMessage(box.checked);
3738
}
3839

3940
export function onDumpModel(args: any){

demo/app/main-view-model.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ export class HelloWorldModel extends Observable {
4040
this.notifyPropertyChange("state", value);
4141
}
4242

43-
public updateMessage(){
43+
public updateMessage(state){
4444
this._eventCount++;
45-
this.eventLabel = "Triggered " + this._eventCount + " times";
45+
this.eventLabel = "Triggered " + this._eventCount + " times, current state:" + state;
4646
}
4747

4848
}

demo/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"nativescript": {
33
"id": "org.nativescript.demo",
44
"tns-android": {
5-
"version": "2.2.0"
5+
"version": "2.3.0"
66
},
77
"tns-ios": {
8-
"version": "2.2.1"
8+
"version": "2.3.0"
99
}
1010
},
1111
"dependencies": {
1212
"nativescript-checkbox": "file:..",
13-
"tns-core-modules": "^2.2.1"
13+
"tns-core-modules": "^2.3.0"
1414
},
1515
"devDependencies": {
1616
"babel-traverse": "6.7.6",

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "nativescript-checkbox",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "NativeScript plugin for checkbox widget.",
55
"main": "checkbox.js",
66
"typings": "index.d.ts",
77
"nativescript": {
88
"platforms": {
9-
"android": "2.1.1",
10-
"ios": "2.1.1"
9+
"android": "2.3",
10+
"ios": "2.3"
1111
}
1212
},
1313
"scripts": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${EXECUTABLE_NAME}</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>${PRODUCT_NAME}</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1.0</string>
23+
<key>LSRequiresIPhoneOS</key>
24+
<true/>
25+
<key>UILaunchStoryboardName</key>
26+
<string>LaunchScreen</string>
27+
<key>UIRequiresFullScreen</key>
28+
<true/>
29+
<key>UIRequiredDeviceCapabilities</key>
30+
<array>
31+
<string>armv7</string>
32+
</array>
33+
<key>UISupportedInterfaceOrientations</key>
34+
<array>
35+
<string>UIInterfaceOrientationPortrait</string>
36+
<string>UIInterfaceOrientationLandscapeLeft</string>
37+
<string>UIInterfaceOrientationLandscapeRight</string>
38+
</array>
39+
<key>UISupportedInterfaceOrientations~ipad</key>
40+
<array>
41+
<string>UIInterfaceOrientationPortrait</string>
42+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
43+
<string>UIInterfaceOrientationLandscapeLeft</string>
44+
<string>UIInterfaceOrientationLandscapeRight</string>
45+
</array>
46+
</dict>
47+
</plist>

0 commit comments

Comments
 (0)