This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch
pr-feat-change-appearance-of-statusbar-by-setting-background-color
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
The following commit(s) were added to
refs/heads/pr-feat-change-appearance-of-statusbar-by-setting-background-color
by this push:
new 0d9bf6e4 since iOS 18.5+ the system handles the appearance
automatically
0d9bf6e4 is described below
commit 0d9bf6e46cff84975dbf844a8032da9de7436adc
Author: Manuel Beck <[email protected]>
AuthorDate: Mon Aug 10 12:33:16 2026 +0200
since iOS 18.5+ the system handles the appearance automatically
- Since iOS 18.5 the system automatically changes the appearance of the
status bar based on the underlying color.
---
CordovaLib/Classes/Public/CDVViewController.m | 6 ++++++
tests/CordovaLibTests/CDVStatusBarTests.m | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/CordovaLib/Classes/Public/CDVViewController.m
b/CordovaLib/Classes/Public/CDVViewController.m
index e3a2c590..7a5cc93b 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -899,6 +899,12 @@ static UIColor *defaultBackgroundColor(void) {
- (UIStatusBarStyle)preferredStatusBarStyle
{
+ // Since iOS 18.5, the system automatically determines the status bar
style based on the background color of the status bar
+ // so let the system handle it
+ if (@available(iOS 18.5, *)) {
+ return [super preferredStatusBarStyle];
+ }
+
CGFloat red = 0.f;
CGFloat green = 0.f;
CGFloat blue = 0.f;
diff --git a/tests/CordovaLibTests/CDVStatusBarTests.m
b/tests/CordovaLibTests/CDVStatusBarTests.m
index cf0827d3..880967c8 100644
--- a/tests/CordovaLibTests/CDVStatusBarTests.m
+++ b/tests/CordovaLibTests/CDVStatusBarTests.m
@@ -170,6 +170,13 @@ andWaitForCordovaCommandQueueWithWebViewEngine:self.plugin
[self evaluateJavaScript:@"window.statusbar.setBackgroundColor('#ffffff');"
andWaitForCordovaCommandQueueWithWebViewEngine:self.plugin
timeout:5];
+
+ // Since iOS 18.5, the system automatically determines the status bar
style based on the background color of the status bar
+ // Check this
+ if (@available(iOS 18.5, *)) {
+ XCTAssertEqual(self.viewController.preferredStatusBarStyle,
[UIViewController new].preferredStatusBarStyle);
+ return;
+ }
XCTAssertEqual(self.viewController.preferredStatusBarStyle,
UIStatusBarStyleDarkContent);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]