Merge branch 'master' into remove-tns-core-modules-mentions

This commit is contained in:
Alexander Vakrilov
2019-12-03 14:32:48 +02:00
committed by GitHub
9 changed files with 482 additions and 286 deletions

View File

@@ -7,7 +7,7 @@ import { Page } from "../../page";
// Types.
import { Property, CssProperty, CssAnimationProperty, InheritedProperty, Style, clearInheritedProperties, propagateInheritableProperties, propagateInheritableCssProperties, initNativeView } from "../properties";
import { getModalRootViewCssClass, getRootViewCssClasses } from "../../../css/system-classes";
import { getSystemCssClasses, MODAL_ROOT_VIEW_CSS_CLASS, ROOT_VIEW_CSS_CLASS } from "../../../css/system-classes";
import { Source } from "../../../utils/debug";
import { Binding, BindingOptions, Observable, WrappedValue, PropertyChangeData, traceEnabled, traceWrite, traceCategories } from "../bindable";
import { isIOS, isAndroid } from "../../../platform";
@@ -1045,21 +1045,21 @@ export const classNameProperty = new Property<ViewBase, string>({
name: "className",
valueChanged(view: ViewBase, oldValue: string, newValue: string) {
const cssClasses = view.cssClasses;
const rootViewsCssClasses = getSystemCssClasses();
const modalViewCssClass = getModalRootViewCssClass();
const rootViewCssClasses = getRootViewCssClasses();
const shouldAddModalRootViewCssClass = cssClasses.has(modalViewCssClass);
const shouldAddRootViewCssClasses = cssClasses.has(rootViewCssClasses[0]);
const shouldAddModalRootViewCssClasses = cssClasses.has(MODAL_ROOT_VIEW_CSS_CLASS);
const shouldAddRootViewCssClasses = cssClasses.has(ROOT_VIEW_CSS_CLASS);
cssClasses.clear();
if (shouldAddModalRootViewCssClass) {
cssClasses.add(modalViewCssClass);
if (shouldAddModalRootViewCssClasses) {
cssClasses.add(MODAL_ROOT_VIEW_CSS_CLASS);
} else if (shouldAddRootViewCssClasses) {
rootViewCssClasses.forEach(c => cssClasses.add(c));
cssClasses.add(ROOT_VIEW_CSS_CLASS);
}
rootViewsCssClasses.forEach(c => cssClasses.add(c));
if (typeof newValue === "string" && newValue !== "") {
newValue.split(" ").forEach(c => cssClasses.add(c));
}

View File

@@ -20,7 +20,7 @@ import {
fromString as gestureFromString
} from "../../gestures";
import { getModalRootViewCssClass } from "../../../css/system-classes";
import { getSystemCssClasses, MODAL_ROOT_VIEW_CSS_CLASS } from "../../../css/system-classes";
import { Builder } from "../../builder";
import { sanitizeModuleName } from "../../builder/module-name-sanitizer";
import { StyleScope } from "../../styling/style-scope";
@@ -372,8 +372,9 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
protected _showNativeModalView(parent: ViewCommon, options: ShowModalOptions) {
_rootModalViews.push(this);
const modalRootViewCssClass = getModalRootViewCssClass();
this.cssClasses.add(modalRootViewCssClass);
this.cssClasses.add(MODAL_ROOT_VIEW_CSS_CLASS);
const modalRootViewCssClasses = getSystemCssClasses();
modalRootViewCssClasses.forEach(c => this.cssClasses.add(c));
parent._modal = this;
this._modalParent = parent;

View File

@@ -21,7 +21,12 @@ import {
// TODO: Remove this and get it from global to decouple builder for angular
import { Builder } from "../builder";
import { CLASS_PREFIX, getRootViewCssClasses, pushToRootViewCssClasses } from "../../css/system-classes";
import {
CLASS_PREFIX,
getSystemCssClasses,
pushToSystemCssClasses,
ROOT_VIEW_CSS_CLASS
} from "../../css/system-classes";
import { device } from "../../platform/platform";
import { profile } from "../../profiling";
@@ -1311,12 +1316,14 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
activityRootViewsMap.set(rootView._domId, new WeakRef(rootView));
const deviceType = device.deviceType.toLowerCase();
pushToRootViewCssClasses(`${CLASS_PREFIX}${ANDROID_PLATFORM}`);
pushToRootViewCssClasses(`${CLASS_PREFIX}${deviceType}`);
pushToRootViewCssClasses(`${CLASS_PREFIX}${application.android.orientation}`);
pushToRootViewCssClasses(`${CLASS_PREFIX}${application.android.systemAppearance}`);
const rootViewCssClasses = getRootViewCssClasses();
pushToSystemCssClasses(`${CLASS_PREFIX}${ANDROID_PLATFORM}`);
pushToSystemCssClasses(`${CLASS_PREFIX}${deviceType}`);
pushToSystemCssClasses(`${CLASS_PREFIX}${application.android.orientation}`);
pushToSystemCssClasses(`${CLASS_PREFIX}${application.android.systemAppearance}`);
this._rootView.cssClasses.add(ROOT_VIEW_CSS_CLASS);
const rootViewCssClasses = getSystemCssClasses();
rootViewCssClasses.forEach(c => this._rootView.cssClasses.add(c));
}