Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tap event getting wrong value #25

Open
oncul opened this issue Mar 16, 2017 · 12 comments
Open

Tap event getting wrong value #25

oncul opened this issue Mar 16, 2017 · 12 comments

Comments

@oncul
Copy link

oncul commented Mar 16, 2017

Hello i need to add a event checkstate changed. I am trying add a tap event. But its getting first state of switch. I i tap checked switch getting checked prop True.

@bradmartin
Copy link
Collaborator

bradmartin commented Mar 16, 2017 via email

@oncul
Copy link
Author

oncul commented Mar 16, 2017

<CheckBox:CheckBox row="1" col="2" tap="checkTap" colspan="2" text="Show" checked="{{ filter.show }}" />

exports.checkTap = function(args){
	console.log(args.object.checked); // returns first state of checkbox
}

I am trying on Android. I need to get event check state changed.

@bradmartin
Copy link
Collaborator

I've not tested anything but try calling the toggle method on the check box to switch its value. Then get the value.

@triniwiz
Copy link
Member

If you want the change event use the following

<CheckBox:CheckBox row="1" col="2" checkedChange="checkTap" colspan="2" text="Show" checked="{{ filter.show }}" />
exports.checkTap = function(args){
	console.log(args.value); // returns first state of checkbox
}

@oncul
Copy link
Author

oncul commented Mar 16, 2017

@triniwiz thank you. İ didnt see that property :)

@oncul oncul closed this as completed Mar 16, 2017
@oncul oncul reopened this Mar 17, 2017
@oncul
Copy link
Author

oncul commented Mar 17, 2017

@triniwiz its not worked.

@oncul
Copy link
Author

oncul commented Mar 17, 2017

#27

i added a pull request for this event handler

@triniwiz
Copy link
Member

@cagatayoncul works fine for me in Angular

@himanshu331
Copy link

hi triniwiz ,
is it possible to change the color property of checkbox . like:
our checkbox border color is grey when i click on it then checkbox color will be fill with different color.
plz reply .

@triniwiz
Copy link
Member

@himanshu331 android or iOS

@himanshu331
Copy link

In nativescript ..

@GoodLadCarlos
Copy link

GoodLadCarlos commented Oct 1, 2018

Try to put the code inside the setTimeout function:

//xml
<CheckBox:CheckBox id="item1" text="testName" tap="_checkTapped"/>

//script
function _checkTapped() {
console.log("tapped");
setTimeout(() => {
let checkBox = topmost().getViewById('item1');
console.log('checked prop value = ' + checkBox.checked);
}, 100);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants