Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: swipeable modal does not toggle statusbar color for black background #20501

Closed
hansPeter055 opened this issue Feb 15, 2020 · 14 comments · Fixed by #25424
Closed

bug: swipeable modal does not toggle statusbar color for black background #20501

hansPeter055 opened this issue Feb 15, 2020 · 14 comments · Fixed by #25424
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@hansPeter055
Copy link

Feature Request

Ionic version:

[x] 5.x

Describe the Feature Request

On the iPhone X or any iPhone with an edge-to-edge display, in ionic the new iOS 13 style modal presents in a kind of wrong animation. The edges should start transform from the iPhone X round edges.

How it is in Ionic:
ezgif com-video-to-gif-4

Describe Preferred Solution

How it should be:
ezgif com-video-to-gif-5

It would be nice if anyone could add this animation when on an iPhone with an edge-to-edge display to start transforming the border-radius of the presenting element with the correct iPhone edge radius. And it should also change the statusbar color from black to white (in light mode).

Also in dark mode the background of the presenting element should transition to a dark gray.

@ionitron-bot ionitron-bot bot added the triage label Feb 15, 2020
@hansPeter055 hansPeter055 changed the title feat: Swipeable Modal add correct animation for iPhones with edge-to-edge display and fix statusbar color (bug) feat: Swipeable Modal add correct animation for iPhones with edge-to-edge display and fix statusbar color bug Feb 15, 2020
@hansPeter055 hansPeter055 changed the title feat: Swipeable Modal add correct animation for iPhones with edge-to-edge display and fix statusbar color bug feat: Swipeable Modal add correct animation for iPhones with edge-to-edge display and fix statusbar color (bug) Feb 15, 2020
@EinfachHans
Copy link
Contributor

+1

@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Feb 17, 2020
@ionitron-bot ionitron-bot bot removed the triage label Feb 17, 2020
@liamdebeasi
Copy link
Contributor

Thanks, I agree that this should be automatic. As a temporary workaround, you can toggle the status bar color yourself when you open/close a modal.

@liamdebeasi liamdebeasi changed the title feat: Swipeable Modal add correct animation for iPhones with edge-to-edge display and fix statusbar color (bug) bug: swipeable modal does not toggle statusbar color for black background Feb 17, 2020
@liamdebeasi liamdebeasi added type: feature request a new feature, enhancement, or improvement and removed type: bug a confirmed bug report labels Feb 17, 2020
@liamdebeasi
Copy link
Contributor

Changing this to a feature request and this is going to require an update to Capacitor. For now, developers can manually toggle the status bar styles themselves.

@BerkeAras
Copy link

@liamdebeasi How is it possible to toggle the statusbar color manually? On native modals, the statusbar toggles if the modal is on the half height of the statusbar. Is it possible to get the top position of the modal?

@jakubforman
Copy link

I have a same issue, and annoying me.

Ionic 5 introduced Swipe to Close Modal on this link and on video toggling working perfect: https://ionicframework.com/blog/announcing-ionic-5/ but now its not working and status bar must be change manually.

Would be handy if can set the automatic change in modal property config or disable automatic and toggle maually when I want.

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Feb 4, 2021

I have a same issue, and annoying me.

Ionic 5 introduced Swipe to Close Modal on this link and on video toggling working perfect: https://ionicframework.com/blog/announcing-ionic-5/ but now its not working and status bar must be change manually.

Would be handy if can set the automatic change in modal property config or disable automatic and toggle maually when I want.

The code that is running in the video changed the status bar manually as well. Capacitor v3 will give us the ability to do this automatically in Ionic Framework via the updated Status Bar plugin: https://capacitorjs.com/docs/v3/apis/status-bar#style.

@spencerdezartsmith
Copy link

spencerdezartsmith commented Jul 10, 2021

With Capacitor 3 now released are there any plans to implement this? @liamdebeasi

@BerkeAras
Copy link

Any updates on this issue? @liamdebeasi?

@WilliamFischer
Copy link

WilliamFischer commented Apr 25, 2022

  • bump ... i love the card modals.. though i find this fix pretty essential. @liamdebeasi

@liamdebeasi liamdebeasi added type: bug a confirmed bug report and removed type: feature request a new feature, enhancement, or improvement labels May 26, 2022
@liamdebeasi
Copy link
Contributor

liamdebeasi commented May 26, 2022

Hi everyone,

I have a dev build with a proposed fix for this if anyone would like to test and provide feedback: 6.1.7-dev.11653592708.12aae268

(Note: This dev build works with any Ionic package (@ionic/angular, @ionic/vue, etc))

A few requirements for this:

  1. Apps must be using Capacitor 3. This functionality will not work in Capacitor <= 2 or Cordova.
  2. The @capacitor/status-bar plugin must be installed.

The remaining blocker here is to find out how to not break Capacitor 2 applications. When dismissing the modal, we call StatusBar.setStyle({ style: 'DEFAULT' }) which lets us revert the status bar style to its default state without having to know if an app is in dark/light mode. The 'DEFAULT' option was added in Capacitor 3.

As a result, if you were to try this in a Capacitor 2 application, you would see the status bar text turn to white when opening a modal. However, the text would never revert back to black, leaving the status bar in an inconsistent state for the rest of the session's lifespan.

Update: I have found a potential solution that would not degrade the Capacitor 2 experience. I have updated the dev build above.

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #25424, and a fix will be available in an upcoming release of Ionic Framework. Please continue testing and let me know if you run into any issues. Thanks!

@WilliamFischer
Copy link

Hey @liamdebeasi

Thank you! I love this fix, however..

There are many different scenarios with this status bar thing... especially with a custom solution required for flipping back to the set colour.

May i recommend, simply, an option on the ModalOptions Interface, such as effectStatusBar?: boolean;

Obviously if this is disabled the status bar sticks to whatever has been previously set. Otherwise it applies this fix. Default should be true.

I know its a bit anti-my-previous-comment but this would just give a bit more control :)

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Jun 21, 2022

I recommend opening a feature request for this.

@ionitron-bot
Copy link

ionitron-bot bot commented Jul 21, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jul 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants