Closed ivan133 closed 5 years ago
hi, "#ffffff" is white :)
try changeNavigationBarColor('#000000', true);
Sorry I probably didn't explain it right. I want to use the white background for navbar. I thought if I set changeNavigationBarColor('#ffffff', false); the buttons themself should become dark
Like this
Ah yes. This is the result that should be expected. I just did a test and it worked as expected.
When it set to white, did it work as expected? the problem is just the same buttons?
Yes, the problem is the button color for me they did not change color no matter what I pass as the second argument.
Please, let me see your package version in package.json
Sure
"dependencies": { "react": "^16.3.0", "react-native": "^0.55.0", "react-native-appsflyer": "1.1.9", "react-native-document-scanner": "^1.4.1", "react-native-gifted-chat": "^0.4.3", "react-native-meteor": "^1.2.0", "react-native-navigation-bar-color": "0.0.6", "react-native-onesignal": "github:BlackTies/react-native-onesignal#7ecedccf20a26fc9ce8a5d9ff44c7fb57bfd2e17", "react-native-smart-splash-screen": "^2.3.5", "react-native-vector-icons": "^4.4.2", "react-native-webview-android": "github:pmogollons/react-native-webview-android#209fa6f6f2a9ccb0d84a0302836c95ece3ebcef3", "react-native-wkwebview-reborn": "^1.16.0" },
ok, i'm work in this
Hi! Any news about this one?
Unfortunately I could not find a solution. We will have to wait for someone to help us: /
Take a test: not setting to light when setting the color, maybe solve.
changeNavigationBarColor('#000000');
Sadly it just crates back background with white buttons
There you guys go. Pull request #6
Nice, please test merged version, npm i -s react-native-navigation-bar-color@0.0.8
"react-native-navigation-bar-color": "^0.0.8" still not working
@jeodiong What version of Android are you testing on and what code are you using to test?
I'm trying to set white natigation bar color with dark buttons:
import changeNavigationBarColor from 'react-native-navigation-bar-color'; ... changeNavigationBarColor('#ffffff', false);
But looks like it does not work - the buttons are always white.
Just in case I've tried to set changeNavigationBarColor('#ffffff', true); Nothing changed.
I've tested it on androids from 6 to 8.
Tested and working:
"react-native-navigation-bar-color": "^0.0.8" changeNavigationBarColor('#ffffff', true);
it works when I remove
<StatusBar barStyle="dark-content" backgroundColor="white" />
but I need StatusBar in dark-content, they can not work the same time now
add
setTimeout(() => { changeNavigationBarColor('white', true); }, 1000);
works fine
That might be an issue directly related to your code then, especially if it's working when you delay setting the navigation bar color.
On Tue, Oct 16, 2018 at 6:54 PM Joe notifications@github.com wrote:
add setTimeout(() => { changeNavigationBarColor('white', true); }, 1000); works fine
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thebylito/react-native-navigation-bar-color/issues/3#issuecomment-430461475, or mute the thread https://github.com/notifications/unsubscribe-auth/AG3WbPGZwmwTlV2ceXkg7ycfvAkKbB7fks5ulo2wgaJpZM4URJr3 .
tried with new project, it comes again
maybe you can try add
changeNavigationBarColor('white', true);
<StatusBar barStyle="dark-content" backgroundColor="white" />
the same time, you may facing the same problem
@jeodiong Why not just style your StatusBar accordingly instead of expecting something that's not targeting the statusbar to do it? That just confirms that the issue is on your end.
You might wanna open up a separate issue for that since this was resolved.
Closing due to inactivity and confirmation of issue being resolved by others.
On API 33 if theme is changed (ie. light to dark or dark to light), while the app is open in the background, the navigation bar color scheme isn't being picked up as far as button foreground color is concerned when the app is brought to foreground... (I think this behaviour likely started with API 30+ because that's when SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR got deprecated)
When I update setNavigationBarTheme function as follows it seems to work better (ie. app picks up light <-> dark theme changes as far as button color is concerned without needing to be restarted):
public void setNavigationBarTheme(Activity activity, Boolean light) {
if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Window window = activity.getWindow();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
int flags = window.getDecorView().getSystemUiVisibility();
if (light) {
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
} else {
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
window.getDecorView().setSystemUiVisibility(flags);
}
else {
WindowInsetsController insetsController = window.getInsetsController();
if (light) {
insetsController.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS,
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
);
}
else {
insetsController.setSystemBarsAppearance(
0,
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
);
}
}
}
}
Maybe it's worthwhile updating the package with something similar to the above ?
I'm trying to set white natigation bar color with dark buttons:
But looks like it does not work - the buttons are always white.
Just in case I've tried to set changeNavigationBarColor('#ffffff', true); Nothing changed.
I've tested it on androids from 6 to 8.