Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Fixed PreferredStatusBarStyle not called on page renderers #14247

Merged
merged 4 commits into from
Jan 14, 2022

Conversation

knasher
Copy link
Contributor

@knasher knasher commented May 5, 2021

Description of Change

  • Added override for ChildViewControllerForStatusBarStyle to ShellFlyoutRenderer to return renderer for current page
  • Added override for ModalPresentationCapturesStatusBarAppearance to ModalWrapper so modal pages can also change style
  • Added code for manual test

Issues Resolved

When using the Shell the PreferredStatusBarStyle method is not called in an iOS PageRenderer and therefore the colour of the status bar text cannot be changed on devices using latest OS.

API Changes

Added:

  • public override UIViewController ChildViewControllerForStatusBarStyle() -> ShellFlyoutRenderer.cs
  • public override bool ModalPresentationCapturesStatusBarAppearance => true; -> ModalWrapper.cs
  • Push Modal button -> StorePages.cs

Platforms Affected

  • iOS

Behavioral/Visual Changes

PreferredStatusBarStyle will begin to work when using page renderers and the Shell

Testing Procedure

  • Load Xamarin.Forms.Controls app in iOS
  • Tap SwapRoot - Store shell located on the top list
  • Notice the status bar text is black
  • Tap List tab
  • The status bar text is now white
  • Tap Home tab
  • The status bar text is now black again
  • Scroll to bottom of the list
  • Tap Push Model
  • The status bar text is now white again (I should have changed the background colour of the page so it can be seen)

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

- Added override for ChildViewControllerForStatusBarStyle to ShellFlyoutRenderer to return renderer for current page
- Added override for ModalPresentationCapturesStatusBarAppearance to ModalWrapper so modal pages can also change style
- Added code for manual test
@net-foundation-cla
Copy link

net-foundation-cla bot commented May 5, 2021

CLA assistant check
All CLA requirements met.

@knasher
Copy link
Contributor Author

knasher commented May 30, 2021

@PureWeen Could you take a look at my PR please? It's been open for a little while and I'd love to get this fix into Forms so I can get the status bar style changing on the app I want to release

@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Sep 17, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

Hey @knasher thanks for your patience here! Just tried this and seems to work great. Awesome first contribution, thank you so much. We hope that you're willing and able to continue this for .NET MAUI and we'll promise to get to it a bit sooner 😬

Go forth and update your socials with: Xamarin.Forms Contributor!

@jfversluis jfversluis merged commit 2822e79 into xamarin:5.0.0 Jan 14, 2022
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] PreferredStatusBarStyle is not called inside PageRenderers when using the Shell
3 participants