Nativescript: Application CSS no longer exposed

Created on 4 Jun 2018  路  3Comments  路  Source: NativeScript/NativeScript

Did you verify this is a real problem by searching the [NativeScript Forum]

yes

Tell us about the problem

In NS 2.0 the application wide css variables where exposed so that my NS-Themes plugin could easily allow dynmically re-theming the application. The user could chose any number of themes while running the application and it would apply them in real time. Key factor, without messing up any other loaded css.

In NS 4 (possibly in a 3.x version???) this value was moved was put into local variables of the Style-Scope.ts file https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/styling/style-scope.ts#L66

Without that ability anymore; I investigated the ability to change is the localCssSelectors
https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/styling/style-scope.ts#L517 of the frame object. However, these are NOT propagated to the children from the Frame (see: #5911) . So basically with the new version of 4.x; I can't actually dynamically theme the entire app at runtime properly using either the frame or application value.. If I apply it to the page; then the theme is only applied to a single page. If I use the cssChanged event to attempt to modify the application wide css;
https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/styling/style-scope.ts#L239 then I will overwrite any "app.css" which is NOT the desired behavior.

I need either some method to access the applicationAdditionalSelectors or I need the Frame to propagate the CSS (see: #5911) to its child properly.

Which platform(s) does your issue occur on?

Confirmed Android, iOS probably -- code is in common code files...

Please provide the following version numbers that your issue occurs with:

4.1 - Current latest release on everything.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

https://github.com/NathanaelA/NativeScript-Themes

css

Most helpful comment

If the PR #6124 is accepted then NS-Themes will be working again! Yay!

All 3 comments

@NickIliev - If I add a pull request to add a getting/setter to Application that allows me to get the applicationAdditionalSelectors would that be an acceptable compromise so that I can release a new version of NativeScript-Themes that works with NS?

If the PR #6124 is accepted then NS-Themes will be working again! Yay!

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.

Was this page helpful?
0 / 5 - 0 ratings