diff --git a/src/chat/ChatScreen.js b/src/chat/ChatScreen.js index b128d4e4116..43212bb00b5 100644 --- a/src/chat/ChatScreen.js +++ b/src/chat/ChatScreen.js @@ -22,7 +22,7 @@ import { canSendToNarrow } from '../utils/narrow'; import { getLoading, getSession } from '../directSelectors'; import { getFetchingForNarrow } from './fetchingSelectors'; import { getShownMessagesForNarrow, isNarrowValid as getIsNarrowValid } from './narrowsSelectors'; -import { getTitleBackgroundColor } from '../title/titleSelectors'; +import { getStreamColorForNarrow } from '../subscriptions/subscriptionSelectors'; type Props = $ReadOnly<{| navigation: AppNavigationProp<'chat'>, @@ -114,13 +114,13 @@ export default function ChatScreen(props: Props) { const sayNoMessages = haveNoMessages && !isFetching; const showComposeBox = canSendToNarrow(narrow) && !showMessagePlaceholders; - const titleBackgroundColor = useSelector(state => getTitleBackgroundColor(state, narrow)); + const streamColor = useSelector(state => getStreamColorForNarrow(state, narrow)); return ( - + diff --git a/src/common/ZulipStatusBar.js b/src/common/ZulipStatusBar.js index 5aa495b6b80..1ea9c729b75 100644 --- a/src/common/ZulipStatusBar.js +++ b/src/common/ZulipStatusBar.js @@ -1,26 +1,18 @@ /* @flow strict-local */ import React, { PureComponent } from 'react'; -import { Platform, StatusBar, View } from 'react-native'; +import { Platform, StatusBar } from 'react-native'; import Color from 'color'; -import { compose } from 'redux'; -import { EdgeInsets } from 'react-native-safe-area-context'; -import { withSafeAreaInsets } from '../react-native-safe-area-context'; import type { Orientation, ThemeName, Dispatch } from '../types'; import { connect } from '../react-redux'; -import { DEFAULT_TITLE_BACKGROUND_COLOR } from '../title/titleSelectors'; import { foregroundColorFromBackground } from '../utils/color'; import { getSession, getSettings } from '../selectors'; type BarStyle = $PropertyType, 'barStyle'>; -export const getStatusBarColor = (backgroundColor: string, theme: ThemeName): string => - backgroundColor === DEFAULT_TITLE_BACKGROUND_COLOR - ? theme === 'night' - ? 'hsl(212, 28%, 18%)' - : 'white' - : backgroundColor; +export const getStatusBarColor = (backgroundColor: string | void, theme: ThemeName): string => + backgroundColor ?? (theme === 'night' ? 'hsl(212, 28%, 18%)' : 'white'); export const getStatusBarStyle = (statusBarColor: string): BarStyle => foregroundColorFromBackground(statusBarColor) === 'white' /* force newline */ @@ -33,9 +25,7 @@ type SelectorProps = $ReadOnly<{| |}>; type Props = $ReadOnly<{ - insets: EdgeInsets, - - backgroundColor: string, + backgroundColor?: string | void, hidden: boolean, dispatch: Dispatch, @@ -44,38 +34,34 @@ type Props = $ReadOnly<{ /** * Applies `hidden` and `backgroundColor` in platform-specific ways. + * + * Like `StatusBar`, which is the only thing it ever renders, this + * doesn't have any effect on the spatial layout of the UI. */ class ZulipStatusBar extends PureComponent { static defaultProps = { hidden: false, - backgroundColor: DEFAULT_TITLE_BACKGROUND_COLOR, }; render() { - const { theme, hidden, insets, orientation } = this.props; + const { theme, hidden, orientation } = this.props; const backgroundColor = this.props.backgroundColor; - const style = { height: hidden ? 0 : insets.top, backgroundColor }; const statusBarColor = getStatusBarColor(backgroundColor, theme); return ( orientation === 'PORTRAIT' && ( - - +