mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat: add CSS classes to app/modal root views to target platform/device/orientation/type (#7606)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user