您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LoadConfigOverlay.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { SafeAreaView, Text, View } 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. <View
  48. style = { [
  49. styles.loadingOverlayWrapper,
  50. _styles.loadingOverlayWrapper
  51. ] }>
  52. <SafeAreaView>
  53. <LoadingIndicator
  54. color = { _styles.indicatorColor }
  55. size = 'large'
  56. style = { styles.connectIndicator } />
  57. <Text
  58. style = { [
  59. styles.loadingOverlayText,
  60. _styles.loadingOverlayText
  61. ] }>
  62. { this.props.t('connectingOverlay.joiningRoom') }
  63. </Text>
  64. </SafeAreaView>
  65. </View>
  66. </OverlayFrame>
  67. );
  68. }
  69. }
  70. /**
  71. * Maps part of the Redux state to the props of this component.
  72. *
  73. * @param {Object} state - The Redux state.
  74. * @returns {{
  75. * _styles: StyleType
  76. * }}
  77. */
  78. function _mapStateToProps(state) {
  79. return {
  80. _styles: ColorSchemeRegistry.get(state, 'LoadConfigOverlay')
  81. };
  82. }
  83. export default translate(connect(_mapStateToProps)(LoadConfigOverlay));