From 5c99d8aa8d8a59d000dd23cd9855d489a2c7ae70 Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Wed, 13 May 2020 17:26:26 -0300 Subject: [PATCH] [FIX] Wait attach activity before changeNavigationBarColor (#2111) * [FIX] Wait attach activity before changeNavigationBarColor * Remove timeout and add try/catch Co-authored-by: Diego Mello --- app/utils/theme.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/utils/theme.js b/app/utils/theme.js index 24405d34..3c265eb5 100644 --- a/app/utils/theme.js +++ b/app/utils/theme.js @@ -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); };