Skip to content

Commit

Permalink
Change StatusBar default style handling strategy
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Android] - Change StatusBar style handling strategy

Previously Android status bar can set to `dark-content` or `default`, I made the following changes:

- Added `light-content` to get align with iOS
- Changed the behavior of `default` from setting status bar with 'SYSTEM_UI_FLAG_LIGHT_STATUS_BAR' to not doing anything, I did this because 1, `setStyle('default')` is found called even without explicitly declared <StatusBar> on that surface, which I think should fail silently 2, my idea is that user should set status bar style to `dark-content` or `light-content` explicitly instead of using `default`.
- Fixed the bug found in Dating Settings's Second Look.

Reviewed By: RSNara

Differential Revision: D24714152

fbshipit-source-id: 76e7d0d45fd3b8c3733efaee81426f5f449cc7d8
  • Loading branch information
luluwu2032 authored and facebook-github-bot committed Nov 4, 2020
1 parent b141dd7 commit 7324b92
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const NativeStatusBarManager = {
/**
* - statusBarStyles can be:
* - 'default'
* - 'light-content'
* - 'dark-content'
*/
setStyle(statusBarStyle?: ?string): void {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/StatusBar/StatusBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import NativeStatusBarManagerIOS from './NativeStatusBarManagerIOS';
*/
export type StatusBarStyle = $Keys<{
/**
* Default status bar style (dark for iOS, light for Android)
* Default status bar style (dark for iOS, no change for Android)
*/
default: string,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void run() {
int systemUiVisibilityFlags = decorView.getSystemUiVisibility();
if ("dark-content".equals(style)) {
systemUiVisibilityFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
} else {
} else if ("light-content".equals(style)) {
systemUiVisibilityFlags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
decorView.setSystemUiVisibility(systemUiVisibilityFlags);
Expand Down

0 comments on commit 7324b92

Please sign in to comment.