New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CSS classes to root views to target platform/device/orientation/modals #7313
Comments
|
Just a FYI; NS-Platform-css (https://github.com/NathanaelA/nativescript-platform-css/tree/master/src) does add: And if you can use ns-orientation; it will add I'm not sure their is any point to adding
Having a You are able to handle both types of devices without adding more processing rules to the css engine to have to process on every element. Same thing with I wrote and have been using my NS-Platform-css/NS-Orientation since NS 1 days, I have NEVER ran into a situation where I felt I actually needed |
|
@NathanaelA Yep, we are aware of the plugins, they are great and they were part of the reason why these weren't added in the core of NativeScript. They would still be very useful for the additional specific classes. Now, with the re-work of the theme, it came up that we might need the classes listed above to come from the core, so that the plugins are not a requirement for the core theme. The There is a point in not needing the |
|
Ah, good thought -- I didn't even think about non-mobile. Maybe that should be Any time line on if/when this will be added to core? (6.0? 6.2, 7.0) If this really is being added to core; I would also recommend you plan on moving most of my plugin into core, so that you also add:
|
|
The idea of We would like to release this for 6.0, but I don't think we can commit and guarantee it for sure. Regarding the rest of the classes that are provided by the plugins, I think it would be better if they stay in a separate plugin as they are. Is there a problem with the users getting them from a plugin? |
|
I think Marto already said everything that is to say. I will add some notes:
|
|
Well, the only reason I would recommend you move them is so that another plugin can be eliminated as core would take over its duties. 4 years later the NS team has finally decided I was right in my approach at this. As for As an aside; @bundyo -- I did a quick search for phones with side notches and couldn't find one. Any idea which phone you are talking about?
Sizing groups acts exactly like media queries (for the sizing part) so I would disagree with sub-optimal. All sizes from X to Y are lumped in .androidXXXX and .iosXXXX so allows you to catch all the devices 1024 to 1200 and treat them as one size, 1200 to 1400 as another; etc... There is even another plugin who took my code and made specific separate height and width versions, so obviously people want things like this... CSS media queries are the gold standard so it is obviously better to be supported, but it has been on the backlog since NS 2; so maybe something that can be EASILY implemented to move forward would be worth doing... Many times just accepting good enough is way better than accepting nothing at all.
Yeah, when I got to that point; I realized that this might be the only reason to keep my plugin around. I don't need that support often, but it does come in handy.... However, if NS wanted to take it over; I would be very happy as that would eliminate another of my plugin into core so that I would no longer have to maintain it. |
|
Available with |
|
Great to see that these were merged in! It looks like |
|
This issue is a bit misleading, since the dark mode support is a completely different feature - the classes would be |
|
Dark Mode support tracking issue: #7800. |

MartoYankov commentedJun 5, 2019
•
edited by vchimev
Describe the solution you'd like
This came up as a request from @bundyo based on the re-work of the NativeScript theme. The idea is to add a CSS class to the root view of the application for specific states. This would allow much more flexible theming and styling. Here is a list for the app root view:
We should also add a class to the root view of any modal view
Describe alternatives you've considered
The alternative, which was used until now, is to have state specific files, e.g. app.android.css, app.ios.css, app.land.css. The problem with these is they can't be chained, there are no device type specific and modal ones (and don't work with webpack).
Additional Info
CSS Color Adjustment Module for Browsers (regarding dark/light mode in OS) - https://www.w3.org/TR/css-color-adjust-1/
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: