question

JB-2190 avatar image
0 Votes"
JB-2190 asked JarvanZhang-MSFT commented

Xamarin iOS status bar color after closing form sheet

Hi. On my app, have a white navigation with texts in black. The status bar text is set accordingly and everything is fine.

95051-screen1.png

I then load a page in modal as form sheet. As the top of the screen is black, I need to set BarTextColor to white in page to see the status bar (navigation is still light but I set the text color to black in title view). This makes the status bar text color switch to white. Again, everything is fine.

95042-screen2.png

Finally, when I dismiss the modal page, the status bar do not revert to original color. It remains in the color set by the modal page. The status bar is now not visible.

95043-screen3.png

Am I supposed to set manually the status bar color when closing the modal page? I don't think so as if the same page is opened full screen, the status bar color alternate properly between white and black. It's only when opened as form sheet that the problem occurs.

So currently, the only way to have this working properly is to use a dark navigation in my app so that I don't need to have a different color for status bar when opening form sheet.

dotnet-xamarin
screen1.png (18.2 KiB)
screen2.png (15.1 KiB)
screen3.png (13.5 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I then load a page in modal as form sheet. As the top of the screen is black

Hi, JB-2190. I created a basic demo to test the function, the background color of the status bar will not become black when navigating to the modal page. Do you add some extra settings? Could you please post the related code to reproduce the issue? It'll help to get the cause.

0 Votes 0 ·

Hi

To reproduce the problem, you need to set UIViewControllerBasedStatusBarAppearance to false in info.plist and setup the NavigationPage BarBackgroundColor property to black for the main page and to white for the page opened in form sheet. If you don't set the BarBackgroundColor property to white, the status bar stay in black so it's not readable (black on black). If we look at Apple own apps, like Music, when a page is opened as form sheet (like it appears when adding a playlist), the status bar text color changes. That's why I tried to switch the status bar text color. More over, as said above, if I just disable the form sheet layout and display the new page in full screen, the status bar changes to white and revert to black properly. It's only when opened as form sheet that the problem occurs. If necessary, I can prepare a solution tonight when back at home.

Regards
Jacques

0 Votes 0 ·

0 Answers