From 9457efa84c872f029027cdcfc3bae4f403715e48 Mon Sep 17 00:00:00 2001 From: Rajat Gupta Date: Fri, 17 Jan 2020 16:12:41 -0800 Subject: [PATCH] Always update background color and bar style on Android status bar Summary: Changelog: [Fix] Fix status bar color not updating when navigating between two screens with the same status bar color. Reviewed By: RSNara Differential Revision: D19439424 fbshipit-source-id: 44388f1f94c87c12102471d72183bb6c152a46b6 --- Libraries/Components/StatusBar/StatusBar.js | 38 ++++++++------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Libraries/Components/StatusBar/StatusBar.js b/Libraries/Components/StatusBar/StatusBar.js index 16137272440f31..b62c0dcb11a432 100644 --- a/Libraries/Components/StatusBar/StatusBar.js +++ b/Libraries/Components/StatusBar/StatusBar.js @@ -455,31 +455,21 @@ class StatusBar extends React.Component { ); } } else if (Platform.OS === 'android') { - if ( - !oldProps || - oldProps.barStyle.value !== mergedProps.barStyle.value - ) { - NativeStatusBarManagerAndroid.setStyle(mergedProps.barStyle.value); - } - if ( - !oldProps || - oldProps.backgroundColor.value !== mergedProps.backgroundColor.value - ) { - const processedColor = processColor( - mergedProps.backgroundColor.value, + //todo(T60684787): Add back optimization to only update bar style and + //background color if the new value is different from the old value. + NativeStatusBarManagerAndroid.setStyle(mergedProps.barStyle.value); + const processedColor = processColor(mergedProps.backgroundColor.value); + if (processedColor == null) { + console.warn( + `\`StatusBar._updatePropsStack\`: Color ${ + mergedProps.backgroundColor.value + } parsed to null or undefined`, + ); + } else { + NativeStatusBarManagerAndroid.setColor( + processedColor, + mergedProps.backgroundColor.animated, ); - if (processedColor == null) { - console.warn( - `\`StatusBar._updatePropsStack\`: Color ${ - mergedProps.backgroundColor.value - } parsed to null or undefined`, - ); - } else { - NativeStatusBarManagerAndroid.setColor( - processedColor, - mergedProps.backgroundColor.animated, - ); - } } if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) { NativeStatusBarManagerAndroid.setHidden(mergedProps.hidden.value);