Skip to content

Commit

Permalink
Merge pull request #9 from sitefinitysteve/master
Browse files Browse the repository at this point in the history
Fix iOS tap event
  • Loading branch information
bradmartin authored Sep 15, 2016
2 parents 994cbd0 + 37b47e2 commit 3650c1f
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ public getCheckProp() {

## Demo Setup
* npm install tns-platform-declarations
* preparedemo
* npm preparedemo
* npm run demo.ios
47 changes: 47 additions & 0 deletions app/App_Resources/iOS/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
6 changes: 6 additions & 0 deletions checkbox.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ class BEMCheckBoxDelegateImpl extends NSObject implements BEMCheckBoxDelegate {
public didTapCheckBox(checkBox: BEMCheckBox): void {
let owner = this._owner.get();
if (owner) {
var eventData = {
eventName: "tap",
object: owner
};

owner.notify(eventData);
owner._onPropertyChangedFromNative(CheckBox.checkedProperty, checkBox.on);
}
}
Expand Down
3 changes: 2 additions & 1 deletion demo/app/main-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export function onToggleTest(args){

export function onTapTest(args){
console.log("tap event test");
model.updateMessage();
let box = <CheckBox>args.object;
model.updateMessage(box.checked);
}

export function onDumpModel(args: any){
Expand Down
4 changes: 2 additions & 2 deletions demo/app/main-view-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export class HelloWorldModel extends Observable {
this.notifyPropertyChange("state", value);
}

public updateMessage(){
public updateMessage(state){
this._eventCount++;
this.eventLabel = "Triggered " + this._eventCount + " times";
this.eventLabel = "Triggered " + this._eventCount + " times, current state:" + state;
}

}
Expand Down
6 changes: 3 additions & 3 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"nativescript": {
"id": "org.nativescript.demo",
"tns-android": {
"version": "2.2.0"
"version": "2.3.0"
},
"tns-ios": {
"version": "2.2.1"
"version": "2.3.0"
}
},
"dependencies": {
"nativescript-checkbox": "file:..",
"tns-core-modules": "^2.2.1"
"tns-core-modules": "^2.3.0"
},
"devDependencies": {
"babel-traverse": "6.7.6",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "nativescript-checkbox",
"version": "1.1.4",
"version": "1.1.5",
"description": "NativeScript plugin for checkbox widget.",
"main": "checkbox.js",
"typings": "index.d.ts",
"nativescript": {
"platforms": {
"android": "2.1.1",
"ios": "2.1.1"
"android": "2.3",
"ios": "2.3"
}
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

0 comments on commit 3650c1f

Please sign in to comment.