Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

RaisedHandIndicator.tsx 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React, { Component } from 'react';
  2. import { View, ViewStyle } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { IReduxState } from '../../../app/types';
  5. import { IconRaiseHand } from '../../../base/icons/svg';
  6. import { getParticipantById, hasRaisedHand } from '../../../base/participants/functions';
  7. import BaseIndicator from '../../../base/react/components/native/BaseIndicator';
  8. import styles from './styles';
  9. export interface IProps {
  10. /**
  11. * True if the hand is raised for this participant.
  12. */
  13. _raisedHand?: boolean;
  14. /**
  15. * The participant id who we want to render the raised hand indicator
  16. * for.
  17. */
  18. participantId: string;
  19. }
  20. /**
  21. * Thumbnail badge showing that the participant would like to speak.
  22. *
  23. * @augments Component
  24. */
  25. class RaisedHandIndicator extends Component<IProps> {
  26. /**
  27. * Implements {@code Component#render}.
  28. *
  29. * @inheritdoc
  30. */
  31. render() {
  32. if (!this.props._raisedHand) {
  33. return null;
  34. }
  35. return this._renderIndicator();
  36. }
  37. /**
  38. * Renders the platform specific indicator element.
  39. *
  40. * @returns {React$Element<*>}
  41. */
  42. _renderIndicator() {
  43. return (
  44. <View style = { styles.raisedHandIndicator as ViewStyle }>
  45. <BaseIndicator
  46. icon = { IconRaiseHand }
  47. iconStyle = { styles.raisedHandIcon } />
  48. </View>
  49. );
  50. }
  51. }
  52. /**
  53. * Maps part of the Redux state to the props of this component.
  54. *
  55. * @param {Object} state - The Redux state.
  56. * @param {IProps} ownProps - The own props of the component.
  57. * @returns {Object}
  58. */
  59. function _mapStateToProps(state: IReduxState, ownProps: IProps) {
  60. const participant = getParticipantById(state, ownProps.participantId);
  61. return {
  62. _raisedHand: hasRaisedHand(participant)
  63. };
  64. }
  65. export default connect(_mapStateToProps)(RaisedHandIndicator);