feat: add CSS classes to app/modal root views to target platform/device/orientation/type (#7606)

This commit is contained in:
Vasil Chimev
2019-08-19 14:09:44 +03:00
committed by GitHub
parent 70f8d70f07
commit 3adba6826b
10 changed files with 284 additions and 70 deletions

View File

@@ -31,6 +31,10 @@ export * from "../view-base";
export { LinearGradient };
import * as am from "../../animation";
import { CSS_CLASS_PREFIX } from "../../../application";
const MODAL = "modal";
let animationModule: typeof am;
function ensureAnimationModule() {
if (!animationModule) {
@@ -347,8 +351,9 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
return this._modal;
}
protected _showNativeModalView(parent: ViewCommon, options: ShowModalOptions) { //context: any, closeCallback: Function, fullscreen?: boolean, animated?: boolean, stretched?: boolean, iosOpts?: any) {
protected _showNativeModalView(parent: ViewCommon, options: ShowModalOptions) {
_rootModalViews.push(this);
this.cssClasses.add(`${CSS_CLASS_PREFIX}${MODAL}`);
parent._modal = this;
this._modalParent = parent;

View File

@@ -619,10 +619,6 @@ export class View extends ViewCommon {
}
protected _showNativeModalView(parent: View, options: ShowModalOptions) {
super._showNativeModalView(parent, options);
if (!this.backgroundColor) {
this.backgroundColor = new Color("White");
}
initializeDialogFragment();
const df = new DialogFragment();
@@ -767,7 +763,7 @@ export class View extends ViewCommon {
const AnimatorSet = android.animation.AnimatorSet;
const duration = nativeView.getContext().getResources().getInteger(shortAnimTime) / 2;
let elevation = this.androidElevation;
if (typeof elevation === "undefined" || elevation === null) {
elevation = this.getDefaultElevation();
@@ -1049,7 +1045,7 @@ function createNativePercentLengthProperty(options: NativePercentLengthPropertyO
const { getter, setter, auto = 0 } = options;
let setPixels, getPixels, setPercent;
if (getter) {
View.prototype[getter] = function(this: View): PercentLength {
View.prototype[getter] = function (this: View): PercentLength {
if (options) {
setPixels = options.setPixels;
getPixels = options.getPixels;
@@ -1065,7 +1061,7 @@ function createNativePercentLengthProperty(options: NativePercentLengthPropertyO
};
}
if (setter) {
View.prototype[setter] = function(this: View, length: PercentLength) {
View.prototype[setter] = function (this: View, length: PercentLength) {
if (options) {
setPixels = options.setPixels;
getPixels = options.getPixels;