[FIX] Wait attach activity before changeNavigationBarColor (#2111)

* [FIX] Wait attach activity before changeNavigationBarColor

* Remove timeout and add try/catch

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Djorkaeff Alexandre 2020-05-13 17:26:26 -03:00 committed by GitHub
parent 70462f7c6f
commit 5c99d8aa8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -35,11 +35,15 @@ export const newThemeState = (prevState, newTheme) => {
return { themePreferences, theme: getTheme(themePreferences) };
};
export const setNativeTheme = (themePreferences) => {
export const setNativeTheme = async(themePreferences) => {
const theme = getTheme(themePreferences);
if (isAndroid) {
const iconsLight = theme === 'light';
changeNavigationBarColor(themes[theme].navbarBackground, iconsLight);
try {
await changeNavigationBarColor(themes[theme].navbarBackground, iconsLight);
} catch (error) {
// Do nothing
}
}
setRootViewColor(themes[theme].backgroundColor);
};