From 7d9f666577e012448a0c07d99427f4cae2b19b3c Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Tue, 12 May 2020 10:09:43 -0300 Subject: [PATCH 1/2] [FIX] Wait attach activity before changeNavigationBarColor --- app/utils/theme.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/utils/theme.js b/app/utils/theme.js index 24405d34a67..a86b65c8f8e 100644 --- a/app/utils/theme.js +++ b/app/utils/theme.js @@ -35,14 +35,14 @@ export const newThemeState = (prevState, newTheme) => { return { themePreferences, theme: getTheme(themePreferences) }; }; -export const setNativeTheme = (themePreferences) => { +export const setNativeTheme = themePreferences => setTimeout(async() => { const theme = getTheme(themePreferences); if (isAndroid) { const iconsLight = theme === 'light'; - changeNavigationBarColor(themes[theme].navbarBackground, iconsLight); + await changeNavigationBarColor(themes[theme].navbarBackground, iconsLight); } setRootViewColor(themes[theme].backgroundColor); -}; +}, 500); export const unsubscribeTheme = () => { if (themeListener && themeListener.remove) { From 7a393efd3bc9bcc551630095b6a8e88fb6d03a4c Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 13 May 2020 17:24:12 -0300 Subject: [PATCH 2/2] Remove timeout and add try/catch --- app/utils/theme.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/utils/theme.js b/app/utils/theme.js index a86b65c8f8e..3c265eb5aa9 100644 --- a/app/utils/theme.js +++ b/app/utils/theme.js @@ -35,14 +35,18 @@ export const newThemeState = (prevState, newTheme) => { return { themePreferences, theme: getTheme(themePreferences) }; }; -export const setNativeTheme = themePreferences => setTimeout(async() => { +export const setNativeTheme = async(themePreferences) => { const theme = getTheme(themePreferences); if (isAndroid) { const iconsLight = theme === 'light'; - await changeNavigationBarColor(themes[theme].navbarBackground, iconsLight); + try { + await changeNavigationBarColor(themes[theme].navbarBackground, iconsLight); + } catch (error) { + // Do nothing + } } setRootViewColor(themes[theme].backgroundColor); -}, 500); +}; export const unsubscribeTheme = () => { if (themeListener && themeListener.remove) {