mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
fix(modal): status bar color now correct with sheet modal (#25424)
resolves #20501
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
import { StatusBar, Style } from '../../utils/native/status-bar';
|
||||
import { win } from '../../utils/window';
|
||||
|
||||
/**
|
||||
* Use y = mx + b to
|
||||
* figure out the backdrop value
|
||||
@ -57,3 +60,31 @@ export const getBackdropValueForSheet = (x: number, backdropBreakpoint: number)
|
||||
|
||||
return x * slope + b;
|
||||
};
|
||||
|
||||
/**
|
||||
* The tablet/desktop card modal activates
|
||||
* when the window width is >= 768.
|
||||
* At that point, the presenting element
|
||||
* is not transformed, so we do not need to
|
||||
* adjust the status bar color.
|
||||
*
|
||||
* Note: We check supportsDefaultStatusBarStyle so that
|
||||
* Capacitor <= 2 users do not get their status bar
|
||||
* stuck in an inconsistent state due to a lack of
|
||||
* support for Style.Default.
|
||||
*/
|
||||
export const setCardStatusBarDark = () => {
|
||||
if (!win || win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
|
||||
return;
|
||||
}
|
||||
|
||||
StatusBar.setStyle({ style: Style.Dark });
|
||||
};
|
||||
|
||||
export const setCardStatusBarDefault = () => {
|
||||
if (!win || win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
|
||||
return;
|
||||
}
|
||||
|
||||
StatusBar.setStyle({ style: Style.Default });
|
||||
};
|
||||
|
Reference in New Issue
Block a user