feat(SystemBarPlugin): add setNavigationBarBackgroundColor to change the navigation bar - #1983
feat(SystemBarPlugin): add setNavigationBarBackgroundColor to change the navigation bar#1983ollm wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1983 +/- ##
=======================================
Coverage 63.20% 63.20%
=======================================
Files 24 24
Lines 4922 4922
=======================================
Hits 3111 3111
Misses 1811 1811 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@erisu What do you think? I think it's a good idea to let the user also control the appearance of the navigation bar. I think it should be used over its own API. So it should exists a |
|
I saw the native code is not in a |
I think that would be the best approach, since I'm already reusing some functions from I've also made the passed color be applied as the background color of the view ollm@61e2295. This should mitigate/resolve the following issue #1946 |
I'll try to find some time to test the current behavior and the changes in this PR as well.
My suggestion would be to avoid adding this to Instead, one possible approach would be to introduce a new I don't see any issue with both Again, I will try to find some time to look more in-depth. |
|
Ok sounds good. I think the solution with the navigationbar.js is a good one. |
|
If you'd like, I can already move the js code to a |
|
I think you can already move the code to a navigationbar.js |
|
I've moved the code to |
|
Looks good 🙂 |
Platforms affected
Android
Motivation and Context
Since status bar handling has been added directly to cordova, navigation bar control should also be included.
Description
The changes add
window.statusbar.setNavigationBarBackgroundColor('#ffffff00')to change the navigation bar color on older devices or when gesture navigation is disabled (3-button navigation).The navigation buttons color is detected automatically, just like with
setBackgroundColor.transparentNavigationBaris also applied automatically if the provided color is fully transparent.The color is also applied as the background color of the view. This should mitigate/resolve the following issue #1946
Example usage:
Android 11:
Android 17:
Android 11:
Android 17:
Testing
I tested it on the Android 11 and Android 17 emulators.
Note
I'm not sure if this is intentional, but I wanted to mention it. If
#00000000is passed tosetBackgroundColor, the following code treats it as fully transparent, so the navigation bar color is not changed to the expected one (White icons). For now, I'm using#01010100as a workaround.cordova-android/framework/src/org/apache/cordova/SystemBarPlugin.java
Lines 189 to 193 in ed4e629
Checklist
(platform)if this change only applies to one platform (e.g.(android))