You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BlankPage.native.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* @flow */
  2. import PropTypes from 'prop-types';
  3. import React, { Component } from 'react';
  4. import { connect } from 'react-redux';
  5. import { destroyLocalTracks } from '../../base/tracks';
  6. import { NetworkActivityIndicator } from '../../mobile/network-activity';
  7. import { isWelcomePageAppEnabled } from '../functions';
  8. import LocalVideoTrackUnderlay from './LocalVideoTrackUnderlay';
  9. /**
  10. * The React {@code Component} displayed by {@code AbstractApp} when it has no
  11. * {@code Route} to render. Renders a progress indicator when there are ongoing
  12. * network requests.
  13. */
  14. class BlankPage extends Component<*> {
  15. /**
  16. * {@code BlankPage} React {@code Component}'s prop types.
  17. *
  18. * @static
  19. */
  20. static propTypes = {
  21. /**
  22. * The indicator which determines whether {@code WelcomePage} is (to
  23. * be) rendered.
  24. *
  25. * @private
  26. */
  27. _welcomePageEnabled: PropTypes.bool,
  28. dispatch: PropTypes.func
  29. };
  30. /**
  31. * Destroys the local tracks (if any) since no media is desired when this
  32. * component is rendered.
  33. *
  34. * @inheritdoc
  35. * @returns {void}
  36. */
  37. componentWillMount() {
  38. this.props._welcomePageEnabled
  39. || this.props.dispatch(destroyLocalTracks());
  40. }
  41. /**
  42. * Implements React's {@link Component#render()}.
  43. *
  44. * @inheritdoc
  45. * @returns {ReactElement}
  46. */
  47. render() {
  48. return (
  49. <LocalVideoTrackUnderlay>
  50. <NetworkActivityIndicator />
  51. </LocalVideoTrackUnderlay>
  52. );
  53. }
  54. }
  55. /**
  56. * Maps (parts of) the redux state to the React {@code Component} props of
  57. * {@code BlankPage}.
  58. *
  59. * @param {Object} state - The redux state.
  60. * @private
  61. * @returns {{
  62. * _welcomePageEnabled: boolean
  63. * }}
  64. */
  65. function _mapStateToProps(state) {
  66. return {
  67. _welcomePageEnabled: isWelcomePageAppEnabled(state)
  68. };
  69. }
  70. export default connect(_mapStateToProps)(BlankPage);