Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

BlankPage.native.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { View } from 'react-native';
  4. import type { Dispatch } from 'redux';
  5. import { ColorSchemeRegistry } from '../../base/color-scheme';
  6. import { LoadingIndicator } from '../../base/react';
  7. import { connect } from '../../base/redux';
  8. import { StyleType } from '../../base/styles';
  9. import { destroyLocalTracks } from '../../base/tracks';
  10. import styles from './styles';
  11. /**
  12. * The type of React {@code Component} props of {@link BlankPage}.
  13. */
  14. type Props = {
  15. /**
  16. * The color schemed style of the component.
  17. */
  18. _styles: StyleType,
  19. dispatch: Dispatch<any>
  20. };
  21. /**
  22. * The React {@code Component} displayed by {@code AbstractApp} when it has no
  23. * {@code Route} to render. Renders a progress indicator when there are ongoing
  24. * network requests.
  25. */
  26. class BlankPage extends Component<Props> {
  27. /**
  28. * Destroys the local tracks (if any) since no media is desired when this
  29. * component is rendered.
  30. *
  31. * @inheritdoc
  32. * @returns {void}
  33. */
  34. componentDidMount() {
  35. this.props.dispatch(destroyLocalTracks());
  36. }
  37. /**
  38. * Implements React's {@link Component#render()}.
  39. *
  40. * @inheritdoc
  41. * @returns {ReactElement}
  42. */
  43. render() {
  44. const { _styles } = this.props;
  45. return (
  46. <View
  47. style = { [
  48. styles.blankPageWrapper,
  49. _styles.loadingOverlayWrapper
  50. ] }>
  51. <LoadingIndicator
  52. color = { _styles.indicatorColor }
  53. size = 'large' />
  54. </View>
  55. );
  56. }
  57. }
  58. /**
  59. * Maps part of the Redux state to the props of this component.
  60. *
  61. * @param {Object} state - The Redux state.
  62. * @returns {Props}
  63. */
  64. function _mapStateToProps(state) {
  65. return {
  66. _styles: ColorSchemeRegistry.get(state, 'LoadConfigOverlay')
  67. };
  68. }
  69. export default connect(_mapStateToProps)(BlankPage);