/* @flow */ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { ActivityIndicator } from 'react-native'; import { connect } from 'react-redux'; import { destroyLocalTracks } from '../../base/tracks'; import { isWelcomePageAppEnabled } from '../functions'; import LocalVideoTrackUnderlay from './LocalVideoTrackUnderlay'; import styles from './styles'; /** * The React Component displayed by AbstractApp when it has no * Route to render. Renders a progress indicator when there are ongoing * network requests. */ class BlankPage extends Component { /** * BlankPage React Component's prop types. * * @static */ static propTypes = { /** * Indicates whether there is network activity i.e. ongoing network * requests. * * @private */ _networkActivity: PropTypes.bool, /** * The indicator which determines whether WelcomePage is (to * be) rendered. * * @private */ _welcomePageEnabled: PropTypes.bool, dispatch: PropTypes.func }; /** * Destroys the local tracks (if any) since no media is desired when this * component is rendered. * * @inheritdoc * @returns {void} */ componentWillMount() { this.props._welcomePageEnabled || this.props.dispatch(destroyLocalTracks()); } /** * Implements React's {@link Component#render()}. * * @inheritdoc * @override * @returns {ReactElement} */ render() { return ( ); } } /** * Maps (parts of) the redux state to the React Component props of * BlankPage. * * @param {Object} state - The redux state. * @private * @returns {{ * _networkActivity: boolean, * _welcomePageEnabled: boolean * }} */ function _mapStateToProps(state) { const { requests } = state['features/network-activity']; return { _networkActivity: Boolean(requests && (requests.length || requests.size)), _welcomePageEnabled: isWelcomePageAppEnabled(state) }; } export default connect(_mapStateToProps)(BlankPage);