Skip to content

Commit 5286adf

Browse files
authored
feat(core): boolean to disable systemAppearanceChanged (theme) (NativeScript#8827)
1 parent 354b935 commit 5286adf

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/core/application/application-common.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,14 @@ export function orientationChanged(rootView: View, newOrientation: 'portrait' |
148148
applyCssClass(rootModalView, ORIENTATION_CSS_CLASSES, newOrientationCssClass);
149149
});
150150
}
151+
export let autoSystemAppearanceChanged = true;
152+
153+
export function setAutoSystemAppearanceChanged(value: boolean) {
154+
autoSystemAppearanceChanged = value;
155+
}
151156

152157
export function systemAppearanceChanged(rootView: View, newSystemAppearance: 'dark' | 'light'): void {
153-
if (!rootView) {
158+
if (!rootView || !autoSystemAppearanceChanged) {
154159
return;
155160
}
156161

packages/core/application/index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ export const orientationChangedEvent: string;
5454
*/
5555
export const systemAppearanceChangedEvent: string;
5656

57+
/**
58+
* Boolean to enable/disable systemAppearanceChanged
59+
*/
60+
export let autoSystemAppearanceChanged = true;
61+
62+
/**
63+
* enable/disable systemAppearanceChanged
64+
*/
65+
export function setAutoSystemAppearanceChanged (value: boolean);
66+
5767
/**
5868
* Updates root view classes including those of modals
5969
* @param rootView the root view

0 commit comments

Comments
 (0)