NathanaelA / nativescript-platform-css

A NativeScript plugin to deal with Declarative UI and Platform specific CSS
23 stars 18 forks source link

Not working for me #17

Closed lumayara closed 6 years ago

lumayara commented 6 years ago

Hi. I have added the require ("nativescript-platform-css"); in the page I need to change the css and in my css I put

.ios1024 :host .grade {
  padding-top: 55%;
  padding-bottom: 55%;
}

and is not working. I also tried using /deep/ but no success. If I removed the 1024 and only leave .ios :host .grade, it will work but I need the specific config for a 1024 screen. Is there anything else I should have done?

lumayara commented 6 years ago

I have found another way to do it without plugins but will keep watching my question in case I need to use this plugin in future projects. Thanks

NathanaelA commented 6 years ago

@lumayara - Are you sure you are using the latest ns-platform and ns-platform-css?

isaacfi commented 6 years ago

This is not working to me too, I uses the last versión of ios, core modules and platform-css

NathanaelA commented 6 years ago

@isaacfi -

  1. Are you using using NS 4.x or 3.x
  2. Are you using Angular; Vue, or Plain NativeScript.
isaacfi commented 6 years ago
  1. 4.x
  2. Angular

I've noticed that /deep/ works to override properties, but if I want to complement a class I have to avoid to use /deep/ I don't know if this is the right behavior.

gustavost26 commented 6 years ago

I am using nativescript 4.0.1 and angular 5.1.0 and the latest version of nativescript-platform-css.

I'm using the iphone5s, iphone6 and iphonex classes and it works perfectly. I follow the documentation instructions where I want to specify a resolution using ios640 and ios1242 but it does not work.

.ios640 :host .test { margin: 6px; width: 22px; line-height: 22px; font-size: 10px; }

DeepakArora76 commented 6 years ago

Same for me.

This does not work: .android480 :host button { @extend %button-shared; font-size: 19; height: 44 }

This works .android400 :host button { @extend %button-shared; font-size: 19; height: 44 }

DeepakArora76 commented 6 years ago

Appreciate your help on this.

NathanaelA commented 6 years ago

@DeepakArora76 -

  1. When starting up the application; what screen size does the platform-css say the device is?
  2. Which emulator (i.e. what is its settings on it).

@gustavost26 the sizes are: [1280,1024,800,600,540,480,400,360,320] There is no 640 unless you add it to the list.

@isaacfi Unfortunately /deep/ and/or :host are required with Angular because of the way it does CSS rewritting.

datanotion commented 6 years ago

Yeah I'm on NS4.1 and not using Angular, and I can't seem to get it to work either.

If I manually add class="ios" to a page then the iOS styling kicks in, so I know the CSS is correct.

Hey @NathanaelA can you just confirm if it should work with NS4x? Thanks for your help man!

datanotion commented 6 years ago

Ok, working now. It must have been related to the syncing of the modified code - stopped and started the compiler, uninstalled it off the devices and now it works fine. Thanks @NathanaelA!

NathanaelA commented 6 years ago

@datanotion - Pat, thanks for the confirmation that you got it fixed in your case. :grinning:

yalva commented 6 years ago

image

image

Those are demo app page on a phone and tablet emulators, guess thats working,

Then I've added a grid layout like this the same page image

and the css like this

.phone .home-grid{ background-color: red; height:100; }

.tablet.home-grid{ background-color: black; height:100; }

and grid colour stays white, it doesn't seems to pick up the css

if I just use this

.home-grid{ background-color: red; height:100; }

then its changing background colour on both the phone and tablet.

Am I missing anything here to get it working?

NathanaelA commented 6 years ago

@yalva - That should work; I don't see anything obvious why it wouldn't. I'll try running a test and see what happens. I assume this is NS 4.x

yalva commented 6 years ago

Yes, it is NS 4.1.1

NathanaelA commented 6 years ago

@yalva - So I upgraded the project to be NS4.1.3 to verify no issues with 4.x

Css:

.homegrid {
    background-color: purple;
    height: 50;
}

.phone .homegrid{
    background-color: red;
    height:100;
}

I added a default .homegrid css; so that if the phone didn't override it; I would get a purple grid. :grin:

XML:

 <StackLayout>
    <GridLayout rows="auto,auto">
    <StackLayout class="p-20">
        <Label text="ns-platform-css" class="h1 text-center"/>
        <TextView height="300" text="{{ data }}" editable="false" backgroundColor="#d3d3d3"/>
    </StackLayout>
        <Label tap="{{ tap }}" row="1" text="(c)2015-2018, Master Technology" class="text-center copyright"/>
    </GridLayout>
    <GridLayout class="homegrid">
    </GridLayout>
    </StackLayout>

Shows a red grid of 100px high after the copyright. image

lumayara commented 6 years ago

Thanks for your help @NathanaelA !