nstudio / nativescript-cardview

:diamonds: :clubs: NativeScript widget for Material Design CardView
MIT License
282 stars 51 forks source link

using css class parameter breaks iOS when navigating #58

Closed johnnyzen closed 6 years ago

johnnyzen commented 7 years ago

Hi there

Using nativescript 3.0.2 & Angular/Typescript

Using the following in a html layout breaks iOS when navigating to the View. (The navigation doesnt do anything. The app doesnt crash)

this.routerExtensions.navigate(['/main']);

This doesnt work:

`

`

This works:

`

`

.cardStyle { background-color: #ffffff; }

Everything works in Android as expected.

johnnyzen commented 7 years ago

An update:

If I remove from the css background-color: #ffffff;

It works, so it seems there is a problem specifying this property? Any ideas what might be causing this?

bradmartin commented 7 years ago

Not sure. @manijak - do you have any idea what might be happening here on iOS?

manijak commented 7 years ago

This is unknown to me. Every single of my CardView instances have a class applied, and they work just fine both on iOS and Android. Could be an ng2 only issue, I use vanilla js for my apps.

bradmartin commented 7 years ago

Yea might be something with angular instance. Prob need to check with the angular repo to see if they have any idea.

On Sun, Jun 25, 2017, 1:20 PM Ned notifications@github.com wrote:

This is unknown to me. Every single of my CardView instances have a class applied, and they work just fine both on iOS and Android. Could be an ng2 only issue, I use vanilla js for my apps.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/bradmartin/nativescript-cardview/issues/58#issuecomment-310918917, or mute the thread https://github.com/notifications/unsubscribe-auth/AFulhMw6dTNdhAL5HcOoG72xhJVTJp14ks5sHqTbgaJpZM4OAmRV .

manijak commented 7 years ago

Ups, spoke too soon. Just upgraded the plugin to latest version and get the same issue. Using background-color css element makes the app crash when navigating back to a view that has CardView with that css-element. Weird error.

Using backgroundColor="white" directly on the XML, works fine.

manijak commented 7 years ago

@bradmartin It appears to be going down when it hits line 37 in ios.js

CardView.prototype[cardview_common_1.backgroundInternalProperty.setNative] = function (value) {
        this.nativeView.backgroundColor = new color_1.Color(value.color + "").ios;
};

Commenting out this entire property, makes the issue go away. I do not understand what this property does, since there already is a backgroundColorProperty just above this one, and it does the job.

But after a few tests I did also had to add a if(value) check before line 34, since the value was still sometimes undefined. I think this is when CardView is located innside a Repeater.

bradmartin commented 7 years ago

I've seen an issue on another plugin similar to this. Works with XML not css and causes issues. don't recall which plugin. Maybe pull to refresh or radio button. I'll have to look later. However I prob won't be able to dig too deep until late in the week or next.

On Sun, Jun 25, 2017, 3:53 PM Ned notifications@github.com wrote:

@bradmartin https://github.com/bradmartin It appears to be going down when it hits line 37 in common.js

CardView.prototype[cardview_common_1.backgroundInternalProperty.setNative] = function (value) { this.nativeView.backgroundColor = new color_1.Color(value.color + "").ios; };

Commenting out this entire property, makes the issue go away. I do not understand what this property does, since there already is a backgroundColorProperty just above this one, and it does the job.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/bradmartin/nativescript-cardview/issues/58#issuecomment-310927596, or mute the thread https://github.com/notifications/unsubscribe-auth/AFulhKuITpflcxIFZR_jqoazKOjJdTMGks5sHsjdgaJpZM4OAmRV .

johnnyzen commented 7 years ago

Thanks guys for looking into 👍