This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
The following commit(s) were added to refs/heads/master by this push:
new 04fccb98 doc(statusbar.js): document `visible` property and
`setBackgroundColor` method (#1670)
04fccb98 is described below
commit 04fccb9827a77d909cead366a11de5944431fbe2
Author: Manuel Beck <[email protected]>
AuthorDate: Thu Aug 27 12:28:20 2026 +0200
doc(statusbar.js): document `visible` property and `setBackgroundColor`
method (#1670)
- Document `visible` property. Make clear that this hides the system status
bar completely when `false` is set.
- Document `setBackgroundColor` that alpha is supported since cordova-ios
8.1.1. Mention that `setBackgroundColor` is intended for special cases only,
and not a recommended API. The recommended way to set the background colour of
the status bar is with the `<meta name="theme-color">` tag.
- The comments don't make references to the status bar plugin, because that
is likely to add to developer confusion about whether the status bar plugin is
required or not. If people are using the status bar plugin, they should be
calling its APIs. We added the fallback for compatibility reasons, not to
encourage mixing the two.
---------
Co-authored-by: エリス <[email protected]>
---
cordova-js-src/plugin/ios/statusbar.js | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/cordova-js-src/plugin/ios/statusbar.js
b/cordova-js-src/plugin/ios/statusbar.js
index 63349877..dc43b2fb 100644
--- a/cordova-js-src/plugin/ios/statusbar.js
+++ b/cordova-js-src/plugin/ios/statusbar.js
@@ -26,20 +26,23 @@ var statusBar = {};
const statusBarScript = document.createElement('script');
document.head.appendChild(statusBarScript);
+/**
+ * Hides or shows the system status bar. No status bar will be visible at all
when false is passed.
+ */
Object.defineProperty(statusBar, 'visible', {
configurable: false,
enumerable: true,
get: function () {
+ // If cordova-plugin-statusbar is installed fallback to it for
compatibility reasons
if (window.StatusBar) {
- // Let the CDVStatusBar plugin handle it
return window.StatusBar.isVisible;
}
return statusBarVisible;
},
set: function (value) {
+ // If cordova-plugin-statusbar is installed fallback to it for
compatibility reasons
if (window.StatusBar) {
- // Let the CDVStatusBar plugin handle it
if (value) {
window.StatusBar.show();
} else {
@@ -52,6 +55,13 @@ Object.defineProperty(statusBar, 'visible', {
}
});
+/**
+ * Sets the background color of the visible status bar.
+ * Supports valid CSS color values, e.g. `rebeccapurple`, `#RRGGBBAA`,
`rgb(255 0 153)`.
+ * Alpha is supported since cordova-ios 8.1.1.
+ * Note: This is intended for special cases only, and not a recommended API.
The recommended way
+ * to set the background colour of the status bar is with the `<meta
name="theme-color">` tag.
+ */
Object.defineProperty(statusBar, 'setBackgroundColor', {
configurable: false,
enumerable: false,
@@ -69,6 +79,7 @@ Object.defineProperty(statusBar, 'setBackgroundColor', {
return;
}
+ // If cordova-plugin-statusbar is installed fallback to it for
compatibility reasons
if (window.StatusBar) {
window.StatusBar.backgroundColorByHexString('#' +
rgbVals[0].toString(16).padStart(2, '0') + rgbVals[1].toString(16).padStart(2,
'0') + rgbVals[2].toString(16).padStart(2, '0'));
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]