Skip to content
Permalink
Browse files
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
  • Loading branch information
Rajat Gupta authored and facebook-github-bot committed Jan 18, 2020
1 parent 44678bb commit 9457efa84c872f029027cdcfc3bae4f403715e48
Showing 1 changed file with 14 additions and 24 deletions.
@@ -455,31 +455,21 @@ class StatusBar extends React.Component<Props> {
);
}
} 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);

0 comments on commit 9457efa

Please sign in to comment.