Files
jitsi-meet/react/features/mobile/network-activity/components/NetworkActivityIndicator.js
Lyubo Marinov 4bf19d73fd [RN] Fix documentation comments
* Javadoc introduced @code as a replacement of <code> and <tt> which is
  better aligned with other javadoc tags such as @link. Use it in the
  Java source code. If we switch to Kotlin, then we'll definitely use
  Markdown.

* There are more uses of @code in the JavaScript source code than <tt>
  so use @code for the sake of consistency. Eventually, I'd rather we
  switch to Markdown because it's easier on my eyes.

* Xcode is plain confused by @code and @link. The Internet says that
  Xcode supports the backquote character to denote the beginning and end
  of a string of characters which should be formatted for display as
  code but it doesn't work for me. <tt> is not rendered at all. So use
  the backquote which is rendered itself. Hopefully, if we switch to
  Markdown, then it'll be common between JavaScript and Objective-C
  source code.
2017-10-01 01:35:19 -05:00

59 lines
1.4 KiB
JavaScript

/* @flow */
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { LoadingIndicator } from '../../../base/react';
/**
* The React {@code Component} which renders a progress indicator when there
* are ongoing network requests.
*/
class NetworkActivityIndicator extends Component {
/**
* {@code NetworkActivityIndicator} React {@code Component}'s prop types.
*
* @static
*/
static propTypes = {
/**
* Indicates whether there is network activity i.e. ongoing network
* requests.
*
* @private
*/
_networkActivity: PropTypes.bool
};
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
return this.props._networkActivity ? <LoadingIndicator /> : null;
}
}
/**
* Maps (parts of) the redux state to the React {@code Component} props of
* {@code NetworkActivityIndicator}.
*
* @param {Object} state - The redux state.
* @private
* @returns {{
* _networkActivity: boolean
* }}
*/
function _mapStateToProps(state) {
const { requests } = state['features/network-activity'];
return {
_networkActivity: Boolean(requests && requests.size)
};
}
export default connect(_mapStateToProps)(NetworkActivityIndicator);