feat(statusbar): Simple built-in status bar support #1523
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms affected
iOS
Motivation and Context
Web content authors should have control over how the status bar is handled using the built-in web platform functionality for UI colouring and opting in to showing behind the status bar or not.
Description
This adds a background behind the status bar automatically when a page does not request to extend itself behind the status bar using a meta tag with
viewport-fit=cover
. It automatically shows and hides as the value of the viewport-fit option changes.On iOS 16.4 and newer, it will be coloured according to the meta
theme-color
tag, and a default colour can be set in the storyboard for a CDVViewController.We expose a very basic JS API hanging off the existing
window.statusbar
property that allows controlling the visibility (of the status bar contents entirely, not just of the background view) and overriding the background colour.The colour is determined as follows:
Efforts were made to ensure that this does not interfere with the existing CDVStatusBar plugin implementation (although maybe this can replace it for most common use cases), by making the display of this built-in conditional on not having the CDVStatusBar plugin installed.
Remaining Work
StatusBarBackgroundColor
preference up to an XCAsset colorset in the template and set it in the Main.storyboard fileCDVStatusBar
installed to make sure there are no conflictsTesting
Tested locally in an iPhone 16 Pro Max simulator.
Checklist