Skip to content

Commit 1fb8ff7

Browse files
authored
feat(modal): remove capacitor 2 support for status bar styles (#29028)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Ionic Framework has fallback detection for Capacitor 2 applications to avoid applying status bar style changes to the card modal. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Ionic Framework's detection for applying status bar styles will be based on the APIs available in Capacitor 3+. - Ionic Framework will no longer support the legacy Capacitor 2 configurations. ## Does this introduce a breaking change? - [x] Yes - [ ] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information. --> Developer should upgrade to the latest major release of Capacitor. ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
1 parent 58d7315 commit 1fb8ff7

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

BREAKING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
2121
- [Content](#version-8x-content)
2222
- [Datetime](#version-8x-datetime)
2323
- [Input](#version-8x-input)
24+
- [Modal](#version-8x-modal)
2425
- [Nav](#version-8x-nav)
2526
- [Picker](#version-8x-picker)
2627
- [Progress bar](#version-8x-progress-bar)
@@ -159,6 +160,10 @@ For more information on the dynamic font, refer to the [Dynamic Font Scaling doc
159160
- `accept` has been removed from the `ion-input` component. This was previously used in conjunction with the `type="file"`. However, the `file` value for `type` is not a valid value in Ionic Framework.
160161
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-input` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy input syntax, refer to the [Input documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax).
161162

163+
<h4 id="version-8x-modal">Modal</h4>
164+
165+
- Detection for Capacitor <= 2 with applying status bar styles has been removed. Developers should ensure they are using Capacitor 3 or later when using the card modal presentation.
166+
162167
<h4 id="version-8x-nav">Nav</h4>
163168

164169
- `getLength` returns `Promise<number>` instead of `<number>`. This method was not previously available in Nav's TypeScript interface, but developers could still access it by casting Nav as `any`. Developers should ensure they `await` their `getLength` call before accessing the returned value.

core/src/components/modal/utils.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,17 @@ export const getBackdropValueForSheet = (x: number, backdropBreakpoint: number)
6868
* is not transformed, so we do not need to
6969
* adjust the status bar color.
7070
*
71-
* Note: We check supportsDefaultStatusBarStyle so that
72-
* Capacitor <= 2 users do not get their status bar
73-
* stuck in an inconsistent state due to a lack of
74-
* support for Style.Default.
7571
*/
7672
export const setCardStatusBarDark = () => {
77-
// TODO FW-4696 Remove supportDefaultStatusBarStyle in Ionic v8
78-
if (!win || win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
73+
if (!win || win.innerWidth >= 768) {
7974
return;
8075
}
8176

8277
StatusBar.setStyle({ style: Style.Dark });
8378
};
8479

8580
export const setCardStatusBarDefault = (defaultStyle = Style.Default) => {
86-
// TODO FW-4696 Remove supportDefaultStatusBarStyle in Ionic v8
87-
if (!win || win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
81+
if (!win || win.innerWidth >= 768) {
8882
return;
8983
}
9084

core/src/utils/native/status-bar.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ export const StatusBar = {
2121
}
2222
return undefined;
2323
},
24-
// TODO FW-4696 Remove supportDefaultStatusBarStyle in Ionic v8
25-
supportsDefaultStatusBarStyle() {
26-
const capacitor = getCapacitor() as any;
27-
/**
28-
* The 'DEFAULT' status bar style was added
29-
* to the @capacitor/status-bar plugin in Capacitor 3.
30-
* PluginHeaders is only supported in Capacitor 3+,
31-
* so we can use this to detect Capacitor 3.
32-
*/
33-
return !!capacitor?.PluginHeaders;
34-
},
3524
setStyle(options: StyleOptions) {
3625
const engine = this.getEngine();
3726
if (!engine) {

0 commit comments

Comments
 (0)