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

PageReloadOverlay.native.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import React from 'react';
  2. import { Text, View } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { appNavigate } from '../../app';
  5. import { translate } from '../../base/i18n';
  6. import { LoadingIndicator } from '../../base/react';
  7. import { _reloadNow } from '../actions';
  8. import AbstractPageReloadOverlay, { abstractMapStateToProps }
  9. from './AbstractPageReloadOverlay';
  10. import OverlayFrame from './OverlayFrame';
  11. import { pageReloadOverlay as styles } from './styles';
  12. /**
  13. * Implements a React Component for page reload overlay. Shown before the
  14. * conference is reloaded. Shows a warning message and counts down towards the
  15. * reload.
  16. */
  17. class PageReloadOverlay extends AbstractPageReloadOverlay {
  18. /**
  19. * Initializes a new PageReloadOverlay instance.
  20. *
  21. * @param {Object} props - The read-only properties with which the new
  22. * instance is to be initialized.
  23. * @public
  24. */
  25. constructor(props) {
  26. super(props);
  27. this._onCancel = this._onCancel.bind(this);
  28. this._onReloadNow = this._onReloadNow.bind(this);
  29. }
  30. /**
  31. * Handle clicking of the "Cancel" button. It will navigate back to the
  32. * welcome page.
  33. *
  34. * @private
  35. * @returns {void}
  36. */
  37. _onCancel() {
  38. clearInterval(this._interval);
  39. this.props.dispatch(appNavigate(undefined));
  40. }
  41. /**
  42. * Handle clicking on the "Reload Now" button. It will navigate to the same
  43. * conference URL as before immediately, without waiting for the timer to
  44. * kick in.
  45. *
  46. * @private
  47. * @returns {void}
  48. */
  49. _onReloadNow() {
  50. clearInterval(this._interval);
  51. this.props.dispatch(_reloadNow());
  52. }
  53. /**
  54. * Implements React's {@link Component#render()}.
  55. *
  56. * @inheritdoc
  57. * @returns {ReactElement}
  58. */
  59. render() {
  60. const { t } = this.props;
  61. const { message, timeLeft, title } = this.state;
  62. return (
  63. <OverlayFrame>
  64. <View style = { styles.container }>
  65. <View style = { styles.loadingIndicator }>
  66. <LoadingIndicator />
  67. </View>
  68. <Text style = { styles.title }>
  69. { t(title) }
  70. </Text>
  71. <Text style = { styles.message }>
  72. { t(message, { seconds: timeLeft }) }
  73. </Text>
  74. <View style = { styles.buttonBox }>
  75. <Text
  76. onPress = { this._onReloadNow }
  77. style = { styles.button } >
  78. { t('dialog.rejoinNow') }
  79. </Text>
  80. <Text
  81. onPress = { this._onCancel }
  82. style = { styles.button } >
  83. { t('dialog.Cancel') }
  84. </Text>
  85. </View>
  86. </View>
  87. </OverlayFrame>
  88. );
  89. }
  90. }
  91. export default translate(connect(abstractMapStateToProps)(PageReloadOverlay));