fix(android): check for root view on configuration changed (#7944)

This commit is contained in:
Vasil Chimev
2019-10-16 10:00:22 +03:00
committed by Manol Donev
parent 08e23bcc3b
commit 135aeffdf1
2 changed files with 11 additions and 2 deletions

View File

@ -143,6 +143,10 @@ function removeCssClass(rootView: View, cssClass: string) {
}
export function orientationChanged(rootView: View, newOrientation: "portrait" | "landscape" | "unknown"): void {
if (!rootView) {
return;
}
const newOrientationCssClass = `${CLASS_PREFIX}${newOrientation}`;
if (!rootView.cssClasses.has(newOrientationCssClass)) {
ORIENTATION_CSS_CLASSES.forEach(cssClass => removeCssClass(rootView, cssClass));
@ -152,6 +156,10 @@ export function orientationChanged(rootView: View, newOrientation: "portrait" |
}
export function systemAppearanceChanged(rootView: View, newSystemAppearance: "dark" | "light"): void {
if (!rootView) {
return;
}
const newSystemAppearanceCssClass = `${CLASS_PREFIX}${newSystemAppearance}`;
if (!rootView.cssClasses.has(newSystemAppearanceCssClass)) {
SYSTEM_APPEARANCE_CSS_CLASSES.forEach(cssClass => removeCssClass(rootView, cssClass));