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 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* @flow */
  2. import PropTypes from 'prop-types';
  3. import React from 'react';
  4. import { ActivityIndicator, View } from 'react-native';
  5. import { connect } from 'react-redux';
  6. import AbstractBlankPage from './AbstractBlankPage';
  7. import styles from './styles';
  8. /**
  9. * Mobile/React Native implementation of <tt>AbstractBlankPage</tt>. Since this
  10. * is the <tt>Component</tt> rendered when there is no <tt>WelcomePage</tt>,
  11. * it will show a progress indicator when there are ongoing network requests
  12. * (notably, the loading of config.js before joining a conference). The use case
  13. * which prompted the introduction of this <tt>Component</tt> is mobile where
  14. * SDK users probably disable the <tt>WelcomePage</tt>.
  15. */
  16. class BlankPage extends AbstractBlankPage {
  17. /**
  18. * <tt>BlankPage</tt> React <tt>Component</tt>'s prop types.
  19. *
  20. * @static
  21. */
  22. static propTypes = {
  23. ...AbstractBlankPage.propTypes,
  24. /**
  25. * Indicates whether there is network activity i.e. ongoing network
  26. * requests.
  27. *
  28. * @private
  29. */
  30. _networkActivity: PropTypes.bool
  31. };
  32. /**
  33. * Implements React's {@link Component#render()}.
  34. *
  35. * @inheritdoc
  36. * @override
  37. * @returns {ReactElement}
  38. */
  39. render() {
  40. return (
  41. <View style = { styles.blankPage }>
  42. <ActivityIndicator
  43. animating = { this.props._networkActivity }
  44. size = { 'large' } />
  45. </View>
  46. );
  47. }
  48. }
  49. /**
  50. * Maps (parts of) the redux state to the React <tt>Component</tt> props of
  51. * <tt>BlankPage</tt>.
  52. *
  53. * @param {Object} state - The redux state.
  54. * @private
  55. * @returns {{
  56. * networkActivity: boolean
  57. * }}
  58. */
  59. function _mapStateToProps(state) {
  60. const { requests } = state['features/network-activity'];
  61. return {
  62. _networkActivity:
  63. Boolean(requests && (requests.length || requests.size))
  64. };
  65. }
  66. export default connect(_mapStateToProps)(BlankPage);