Skip to content

Commit 9457efa

Browse files
Rajat Guptafacebook-github-bot
Rajat Gupta
authored andcommitted
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
1 parent 44678bb commit 9457efa

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

Libraries/Components/StatusBar/StatusBar.js

+14-24
Original file line numberDiff line numberDiff line change
@@ -455,31 +455,21 @@ class StatusBar extends React.Component<Props> {
455455
);
456456
}
457457
} else if (Platform.OS === 'android') {
458-
if (
459-
!oldProps ||
460-
oldProps.barStyle.value !== mergedProps.barStyle.value
461-
) {
462-
NativeStatusBarManagerAndroid.setStyle(mergedProps.barStyle.value);
463-
}
464-
if (
465-
!oldProps ||
466-
oldProps.backgroundColor.value !== mergedProps.backgroundColor.value
467-
) {
468-
const processedColor = processColor(
469-
mergedProps.backgroundColor.value,
458+
//todo(T60684787): Add back optimization to only update bar style and
459+
//background color if the new value is different from the old value.
460+
NativeStatusBarManagerAndroid.setStyle(mergedProps.barStyle.value);
461+
const processedColor = processColor(mergedProps.backgroundColor.value);
462+
if (processedColor == null) {
463+
console.warn(
464+
`\`StatusBar._updatePropsStack\`: Color ${
465+
mergedProps.backgroundColor.value
466+
} parsed to null or undefined`,
467+
);
468+
} else {
469+
NativeStatusBarManagerAndroid.setColor(
470+
processedColor,
471+
mergedProps.backgroundColor.animated,
470472
);
471-
if (processedColor == null) {
472-
console.warn(
473-
`\`StatusBar._updatePropsStack\`: Color ${
474-
mergedProps.backgroundColor.value
475-
} parsed to null or undefined`,
476-
);
477-
} else {
478-
NativeStatusBarManagerAndroid.setColor(
479-
processedColor,
480-
mergedProps.backgroundColor.animated,
481-
);
482-
}
483473
}
484474
if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) {
485475
NativeStatusBarManagerAndroid.setHidden(mergedProps.hidden.value);

0 commit comments

Comments
 (0)