diff --git a/native/connected-status-bar.react.js b/native/connected-status-bar.react.js index 598aa319c..892804875 100644 --- a/native/connected-status-bar.react.js +++ b/native/connected-status-bar.react.js @@ -1,60 +1,37 @@ // @flow -import PropTypes from 'prop-types'; import React from 'react'; import { StatusBar, Platform } from 'react-native'; import { globalLoadingStatusSelector } from 'lib/selectors/loading-selectors'; -import type { LoadingStatus } from 'lib/types/loading-types'; -import { connect } from 'lib/utils/redux-utils'; -import type { AppState } from './redux/redux-setup'; -import { type GlobalTheme, globalThemePropType } from './types/themes'; +import { useSelector } from './redux/redux-utils'; type Props = {| - barStyle?: 'default' | 'light-content' | 'dark-content', - animated?: boolean, - // Redux state - globalLoadingStatus: LoadingStatus, - activeTheme: ?GlobalTheme, + +barStyle?: 'default' | 'light-content' | 'dark-content', + +animated?: boolean, + +hidden?: boolean, |}; -class ConnectedStatusBar extends React.PureComponent { - static propTypes = { - barStyle: PropTypes.oneOf(['default', 'light-content', 'dark-content']), - animated: PropTypes.bool, - globalLoadingStatus: PropTypes.string.isRequired, - activeTheme: globalThemePropType, - }; - - render() { - const { - barStyle: inBarStyle, - activeTheme, - globalLoadingStatus, - ...statusBarProps - } = this.props; - - let barStyle = inBarStyle; - if (!barStyle) { - if (Platform.OS !== 'android' && this.props.activeTheme === 'light') { - barStyle = 'dark-content'; - } else { - barStyle = 'light-content'; - } +export default function ConnectedStatusBar(props: Props) { + const globalLoadingStatus = useSelector(globalLoadingStatusSelector); + const activeTheme = useSelector((state) => state.globalThemeInfo.activeTheme); + const { barStyle: inBarStyle, ...statusBarProps } = props; + + let barStyle = inBarStyle; + if (!barStyle) { + if (Platform.OS !== 'android' && activeTheme === 'light') { + barStyle = 'dark-content'; + } else { + barStyle = 'light-content'; } - - const fetchingSomething = this.props.globalLoadingStatus === 'loading'; - return ( - - ); } -} -export default connect((state: AppState) => ({ - globalLoadingStatus: globalLoadingStatusSelector(state), - activeTheme: state.globalThemeInfo.activeTheme, -}))(ConnectedStatusBar); + const fetchingSomething = globalLoadingStatus === 'loading'; + return ( + + ); +}