Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

using css class parameter breaks iOS when navigating #58

Closed
johnnyzen opened this issue Jun 21, 2017 · 8 comments
Closed

using css class parameter breaks iOS when navigating #58

johnnyzen opened this issue Jun 21, 2017 · 8 comments

Comments

@johnnyzen
Copy link

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:

<CardView class="cardStyle" elevation="4" radius="1" marginBottom="2" width="100%"> <StackLayout orientation="vertical" padding="20"> </StackLayout> </CardView>

This works:

<CardView elevation="4" radius="1" marginBottom="2" width="100%"> <StackLayout orientation="vertical" padding="20"> </StackLayout> </CardView>

.cardStyle { background-color: #ffffff; }

Everything works in Android as expected.

@johnnyzen
Copy link
Author

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
Copy link
Collaborator

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

@manijak
Copy link
Contributor

manijak commented Jun 25, 2017

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
Copy link
Collaborator

bradmartin commented Jun 25, 2017 via email

@manijak
Copy link
Contributor

manijak commented Jun 25, 2017

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
Copy link
Contributor

manijak commented Jun 25, 2017

@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
Copy link
Collaborator

bradmartin commented Jun 25, 2017 via email

@johnnyzen
Copy link
Author

Thanks guys for looking into 👍

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

No branches or pull requests

3 participants