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

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