mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 08:09:32 +08:00
fix(modal): status bar style defaults to app settings (#26291)
Resolves #26173
This commit is contained in:
@ -22,6 +22,7 @@ import { raf, inheritAttributes } from '../../utils/helpers';
|
||||
import type { Attributes } from '../../utils/helpers';
|
||||
import { KEYBOARD_DID_OPEN } from '../../utils/keyboard/keyboard';
|
||||
import { printIonWarning } from '../../utils/logging';
|
||||
import { Style as StatusBarStyle, StatusBar } from '../../utils/native/status-bar';
|
||||
import { BACKDROP, activeAnimations, dismiss, eventMethod, prepareOverlay, present } from '../../utils/overlays';
|
||||
import { getClassMap } from '../../utils/theme';
|
||||
import { deepReady } from '../../utils/transition';
|
||||
@ -68,6 +69,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
private keyboardOpenCallback?: () => void;
|
||||
private moveSheetToBreakpoint?: (options: MoveSheetToBreakpointOptions) => Promise<void>;
|
||||
private inheritedAttributes: Attributes = {};
|
||||
private statusBarStyle?: StatusBarStyle;
|
||||
|
||||
private inline = false;
|
||||
private workingDelegate?: FrameworkDelegate;
|
||||
@ -519,7 +521,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
* If we did not do this check, then not using swipeToClose would mean you could
|
||||
* not run canDismiss on swipe as there would be no swipe gesture created.
|
||||
*/
|
||||
const hasCardModal = this.swipeToClose || (this.canDismiss !== undefined && this.presentingElement !== undefined);
|
||||
const hasCardModal = this.presentingElement !== undefined && (this.swipeToClose || this.canDismiss !== undefined);
|
||||
|
||||
/**
|
||||
* We need to change the status bar at the
|
||||
@ -527,6 +529,8 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
* by the time the card animation is done.
|
||||
*/
|
||||
if (hasCardModal && getIonMode(this) === 'ios') {
|
||||
// Cache the original status bar color before the modal is presented
|
||||
this.statusBarStyle = await StatusBar.getStyle();
|
||||
setCardStatusBarDark();
|
||||
}
|
||||
|
||||
@ -584,7 +588,9 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
this.gesture = createSwipeToCloseGesture(el, ani, () => {
|
||||
const statusBarStyle = this.statusBarStyle ?? StatusBarStyle.Default;
|
||||
|
||||
this.gesture = createSwipeToCloseGesture(el, ani, statusBarStyle, () => {
|
||||
/**
|
||||
* While the gesture animation is finishing
|
||||
* it is possible for a user to tap the backdrop.
|
||||
@ -691,9 +697,9 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
* finishes when the dismiss animation does.
|
||||
* TODO (FW-937)
|
||||
*/
|
||||
const hasCardModal = this.swipeToClose || (this.canDismiss !== undefined && this.presentingElement !== undefined);
|
||||
const hasCardModal = this.presentingElement !== undefined && (this.swipeToClose || this.canDismiss !== undefined);
|
||||
if (hasCardModal && getIonMode(this) === 'ios') {
|
||||
setCardStatusBarDefault();
|
||||
setCardStatusBarDefault(this.statusBarStyle);
|
||||
}
|
||||
|
||||
/* tslint:disable-next-line */
|
||||
|
||||
Reference in New Issue
Block a user