Closed sitefinitysteve closed 8 years ago
Hey @sitefinitysteve,
It seems to me that you've missed to assign the delegate property of your native control to your custom BEMCheckBoxDelegateImpl instance. The ListPicker that you've used for reference does it here https://github.com/NativeScript/NativeScript/blob/dfaf481d6d2538372c13f9eab08d523cb5f6e9af/tns-core-modules/ui/list-picker/list-picker.ios.ts#L22 You may try something like
public onLoaded() {
super.onLoaded();
this._iosCheckbox.delegate = this._delegate;
}
Thanks so much guys!
Works, that was literally all it was, eugh
@KristinaKoeva So turns out the delegate is triggering, but the widgets (owners) onCheckPropertyChanged doesn't seem to fire, this look right to you?
https://github.com/sitefinitysteve/nativescript-checkbox/blob/master/checkbox.ios.ts#L256
I'm trying the expose (maybe thats it), but adding just stops the delegates console.log from triggering
Tried
public static ObjCExposedMethods = {
"didTapCheckBox": { returns: interop.types.void, params: [NSObject] }
};
public static ObjCExposedMethods = {
"didTapCheckBox": { returns: interop.types.void, params: [BEMCheckBox] }
};
You know what...it is working, I was just expecting the JS on changed events to be triggering I suppose... but the core model object does update so, I guess shes fine
Hey @sitefinitysteve Sorry for not getting back to you. I am glad everything is working now :)
So turns out if actually isn't :/ Now while the delegate code is firing, I am calling the _onPropertyChangedFromNative and the bound model value is changing... but the JS events just dont trigger at all... I mean they do when you click the text (because its based on Button), but doesn't do anything when you click on the actual iOS cocopod native view.
https://github.com/bradmartin/nativescript-checkbox/blob/master/checkbox.ios.ts#L225-L235 https://github.com/bradmartin/nativescript-checkbox/blob/master/checkbox.ios.ts#L263
Hey @sitefinitysteve,
I am having troubles running the demo application. When I run npm run preparedemo
I receive the following errors
error TS6053: File 'node_modules/tns-platform-declarations/android17.d.ts' not found.
error TS6053: File 'node_modules/tns-platform-declarations/ios.d.ts' not found.
If I skip the npm run build
part of the preparedemo
script and run the demo application I receive the followin JavaScript application
file:///app/tns_modules/color/color-common.js:29:75: JS ERROR Error: Expected 1 or 4 constructor parameters.
It would be great if you give me some instructions on how to run the demo application
Eugh, its based on the plugin seed project, I dont love all these npm commands
2.2 seems to have introduced the color problem, are you using my master? This hacky fix seems to fix it atm
https://github.com/sitefinitysteve/nativescript-checkbox/blob/master/checkbox.ios.ts#L271
Would you please send me a simple project that demonstrate your problem because I am still not able to run your master
What about if I just zip the whole thing? https://www.dropbox.com/s/rhm6l9krek7s05y/nativescript-checkbox.zip?dl=0
@sitefinitysteve It looks like this tread strayed quite a bit form your original issue. The problem you are having now doesn't look related to the ios-runtime as the issue with the delegate is gone. Can you please open another issue in the NativeScript/NativeScript and explain more in detail what you are trying to achieve, what problem is and what are the steps to reproduce it?
It would also be easier to push a working branch of you repo and share it. Generally, it is better to send project that does not contain the \platfroms
folders as it is quite big and contain some build specific content which in many cases have to be cleaned to run the project.
Thanks for the cooperation!
@vakrilov @KristinaKoeva Yep you are totally right, I suppose delegate triggering is "working"... it's just not notifying the object past that (even though the code afaik seems the same as the core stuff)
Sidenote: Now I KNOW not to include platforms as a rule :) However @KristinaKoeva was having issues, so I figured just pack it all up just in case.
I will close and move, thx!
This is the POD I'm trying to implement https://github.com/Boris-Em/BEMCheckBox
So I need to capture the didTapCheckBox event. I used the ListPicker delegate as a template... https://github.com/NativeScript/NativeScript/blob/dfaf481d6d2538372c13f9eab08d523cb5f6e9af/tns-core-modules/ui/list-picker/list-picker.ios.ts
Came up with this (WIP) https://github.com/sitefinitysteve/nativescript-checkbox/blob/master/checkbox.ios.ts#L236
My initWithOwner is called (clearly), but the 2 delegate events do nothing.
This is the code from the pod about it https://github.com/Boris-Em/BEMCheckBox/blob/18cf99acbd834ca0c36a51f3cf2640e0217cf6a4/Classes/BEMCheckBox.m#L171 ...is it not registered soon enough or something for repondsToSelector, or...?