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.

LoadConfigOverlay.js 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { SafeAreaView, Text } from 'react-native';
  4. import { ColorSchemeRegistry } from '../../../base/color-scheme';
  5. import { translate } from '../../../base/i18n';
  6. import { LoadingIndicator } from '../../../base/react';
  7. import { connect } from '../../../base/redux';
  8. import { StyleType } from '../../../base/styles';
  9. import OverlayFrame from './OverlayFrame';
  10. import styles from './styles';
  11. type Props = {
  12. /**
  13. * The color schemed style of the component.
  14. */
  15. _styles: StyleType,
  16. /**
  17. * The Function to be invoked to translate i18n keys.
  18. */
  19. t: Function
  20. };
  21. /**
  22. * Implements an overlay to tell the user that there is an operation in progress in the background during connect
  23. * so then the app doesn't seem hung.
  24. */
  25. class LoadConfigOverlay extends Component<Props> {
  26. /**
  27. * Determines whether this overlay needs to be rendered (according to a
  28. * specific redux state). Called by {@link OverlayContainer}.
  29. *
  30. * @param {Object} state - The redux state.
  31. * @returns {boolean} - If this overlay needs to be rendered, {@code true};
  32. * {@code false}, otherwise.
  33. */
  34. static needsRender(state: Object) {
  35. return Boolean(state['features/overlay'].loadConfigOverlayVisible);
  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. <OverlayFrame>
  47. <SafeAreaView
  48. style = { [
  49. styles.loadingOverlayWrapper,
  50. _styles.loadingOverlayWrapper
  51. ] }>
  52. <LoadingIndicator
  53. color = { _styles.indicatorColor }
  54. size = 'large'
  55. style = { styles.connectIndicator } />
  56. <Text
  57. style = { [
  58. styles.loadingOverlayText,
  59. _styles.loadingOverlayText
  60. ] }>
  61. { this.props.t('connectingOverlay.joiningRoom') }
  62. </Text>
  63. </SafeAreaView>
  64. </OverlayFrame>
  65. );
  66. }
  67. }
  68. /**
  69. * Maps part of the Redux state to the props of this component.
  70. *
  71. * @param {Object} state - The Redux state.
  72. * @returns {{
  73. * _styles: StyleType
  74. * }}
  75. */
  76. function _mapStateToProps(state) {
  77. return {
  78. _styles: ColorSchemeRegistry.get(state, 'LoadConfigOverlay')
  79. };
  80. }
  81. export default translate(connect(_mapStateToProps)(LoadConfigOverlay));