mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Allow updates to application CSS rules.
Expose an `application.addCss` method and hide `application.cssSelectors` from end-user typings. Update StyleScope's with new application selectors on style application. NOT updating existing controls/views unless reloaded, or forced (via a change to className, etc).
This commit is contained in:
@@ -322,7 +322,20 @@ function onConfigurationChanged(context: android.content.Context, intent: androi
|
||||
}
|
||||
|
||||
function loadCss() {
|
||||
typedExports.cssSelectorsCache = typedExports.loadCss(typedExports.cssFile);
|
||||
//HACK: identical to application.ios.ts
|
||||
typedExports.appSelectors = typedExports.loadCss(typedExports.cssFile) || [];
|
||||
if (typedExports.appSelectors.length > 0) {
|
||||
typedExports.mergeCssSelectors(typedExports);
|
||||
}
|
||||
}
|
||||
|
||||
export function addCss(cssText: string) {
|
||||
//HACK: identical to application.ios.ts
|
||||
const parsed = typedExports.parseCss(cssText);
|
||||
if (parsed) {
|
||||
typedExports.additionalSelectors.push.apply(typedExports.additionalSelectors, parsed);
|
||||
typedExports.mergeCssSelectors(typedExports);
|
||||
}
|
||||
}
|
||||
|
||||
global.__onLiveSync = function () {
|
||||
@@ -351,4 +364,4 @@ global.__onUncaughtError = function (error: definition.NativeScriptError) {
|
||||
}
|
||||
|
||||
typedExports.notify({ eventName: typedExports.uncaughtErrorEvent, object: appModule.android, android: error });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user