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

[iOS] Allow VC renderers of FlyoutPage to specify UIStatusBarStyle #13143

Merged
merged 5 commits into from
Jan 14, 2022

Conversation

rmarinho
Copy link
Member

Description of Change

Since we were wrapping the renderers of FlyoutPage and DetailPage on a internal ViewController, the users couldn't provide overrides for PreferredStatusBarStyle().
To fix this we override ChildViewControllerForStatusBarStyle on our internal ChildViewController and point to page's VC.

Issues Resolved

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

Should be able to provide UIStatusBar color

Before/After Screenshots

Before:
Screenshot 2020-12-14 at 23 36 46

After:
Screenshot 2020-12-14 at 23 34 21

Testing Procedure

Start the ControlGallery and check if the UIStatus bar shows white content on the left, and black content on the right.

PR Checklist

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

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Captura de pantalla 2021-01-18 a las 17 20 37


public override UIViewController ChildViewControllerForStatusBarStyle()
{
return ChildViewControllers?.LastOrDefault() ?? base.ChildViewControllerForStatusBarStyle();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChildViewControllers is an array - can we just check the last index instead of allocating an enumerator?

Also, are we guaranteed that the last controller in the array is the correct one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it @hartez , this ChildVIewController wrapper is internal and we are the only ones adding to it the detail or flout as a children, it's the only children.

@knasher
Copy link
Contributor

knasher commented May 3, 2021

Is it possible that a fix like this would be needed for the Shell too? I'm using a Shell and cannot change the color of the status bar text using PreferredStatusBarStyle on any of the pages I navigate to

@knasher
Copy link
Contributor

knasher commented May 5, 2021

For anyone who might be having the same problem with Shell, I have created a bug #14246 and a PR #14247

@jfversluis jfversluis merged commit 000000c into 5.0.0 Jan 14, 2022
@jfversluis jfversluis deleted the fix-13053 branch January 14, 2022 13:13
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] MasterDetailPage (and FlyoutPage) cannot customize status bar text color on iOS
6 participants