I've run into this issue in two different plugins now (nativescript-dom and tns-core-modules). It seems that the 'cssClasses' property is no longer used on iOS, or isn't accessed the same way anymore.
This only seems to be an issue on iOS.
3.0.33.0.13.0.1tns-core-modules: 3.0.1Call classList.toggle on an object (i.e. container.classList.toggle('collapsed');)
The offending line is 691 in ui/core/view-base.js:
690: var classes = view.cssClasses;
691: classes.clear();
JS ERROR TypeError: undefined is not an object (evaluating 'classes.clear')
cssClasses is undefined.
I'm having a similar issue using nativescript-dom 2.0.0. If I have it installed, I get an instant crash upon running iOS with the same error: cssClasses is undefined. Two different plugins, same story.
@AdamDenoon Part of NativeScript v3.0 Breaking Changes:
Property cssClass removed, use className instead.
@AdamDenoon can you tell us the names of all plugins (apart from nativescript-dom) that are throwing with that error (so we can contact the authors for migration tips)
@NathanaelA nativescript-dom 2.0.0 is using cssClasses on this line
@NickIliev - Thanks... Working on a fix...
@NickIliev @AdamDenoon - No fix is needed. ;-) cssClassses is actually part of the View-Base:
https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/core/view-base/view-base.ts#L429 cssClass (no es) is what was removed from 3.0 , not cssClasses (with es).
This is used in the View-Base to keep a unique list of css classes. I use the same variable during the classlist function code... In addition I have double checked by running my "demo" in the repo on a totally fresh 3.0x install.
@AdamDenoon - Can you provide some code that you are using that is causing your issue; this variable should be created long before anything accesses it since it is part of view-base.
I have double checked a fresh version of my demo on both iOS and Android. And for me my dom classlist.toggle() is working properly in the demo on both platforms.
@NathanaelA my bad I must have thought of cssClass when looking through the source
Thanks for the help guys: it seems the issue is only with nativescript-dom 2.0.0 - The error I'm getting (that when I tried to circumvent the issue above surfaced) from "dom.js" is:
file:///app/tns_modules/nativescript-dom/dom.js:105:16: JS ERROR TypeError: undefined is not an object (evaluating 't.cssClasses.forEach')
It would appear that the cssClasses is only undefined because t is undefined.
This is likely not an issue with tns-core-modules. I've posted this issue here: https://github.com/NathanaelA/nativescript-dom/issues/12, so I'll close it here. Thank you all again for your help.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.