mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 08:09:32 +08:00
feat(base-components): add ability to remove ios and md theme (#26669)
This commit is contained in:
@ -2,7 +2,7 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core';
|
||||
import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core';
|
||||
|
||||
import { config } from '../../global/config';
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { getIonStylesheet, getIonBehavior } from '../../global/ionic-global';
|
||||
import type {
|
||||
Animation,
|
||||
AnimationBuilder,
|
||||
@ -47,6 +47,7 @@ import { setCardStatusBarDark, setCardStatusBarDefault } from './utils';
|
||||
// TODO(FW-2832): types
|
||||
|
||||
/**
|
||||
* @virtualProp {true | false} useBase - useBase determines if base components is enabled.
|
||||
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
|
||||
*
|
||||
* @slot - Content is placed inside of the `.modal-content` element.
|
||||
@ -58,6 +59,7 @@ import { setCardStatusBarDark, setCardStatusBarDefault } from './utils';
|
||||
@Component({
|
||||
tag: 'ion-modal',
|
||||
styleUrls: {
|
||||
base: 'modal.scss',
|
||||
ios: 'modal.ios.scss',
|
||||
md: 'modal.md.scss',
|
||||
},
|
||||
@ -466,7 +468,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
* start of the animation so that it completes
|
||||
* by the time the card animation is done.
|
||||
*/
|
||||
if (hasCardModal && getIonMode(this) === 'ios') {
|
||||
if (hasCardModal && getIonBehavior(this) === 'ios') {
|
||||
// Cache the original status bar color before the modal is presented
|
||||
this.statusBarStyle = await StatusBar.getStyle();
|
||||
setCardStatusBarDark();
|
||||
@ -508,7 +510,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
}
|
||||
|
||||
private initSwipeToClose() {
|
||||
if (getIonMode(this) !== 'ios') {
|
||||
if (getIonBehavior(this) !== 'ios') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -637,7 +639,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
* finishes when the dismiss animation does.
|
||||
*/
|
||||
const hasCardModal = presentingElement !== undefined;
|
||||
if (hasCardModal && getIonMode(this) === 'ios') {
|
||||
if (hasCardModal && getIonBehavior(this) === 'ios') {
|
||||
setCardStatusBarDefault(this.statusBarStyle);
|
||||
}
|
||||
|
||||
@ -824,7 +826,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes } = this;
|
||||
|
||||
const showHandle = handle !== false && isSheetModal;
|
||||
const mode = getIonMode(this);
|
||||
const mode = getIonStylesheet(this);
|
||||
const { modalId } = this;
|
||||
const isCardModal = presentingElement !== undefined && mode === 'ios';
|
||||
const isHandleCycle = handleBehavior === 'cycle';
|
||||
|
||||
Reference in New Issue
Block a user