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

DialogContainer.tsx 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { Fragment } from 'react';
  2. import { connect } from 'react-redux';
  3. import { IReduxState } from '../../../../app/types';
  4. import ReactionEmoji from '../../../../reactions/components/native/ReactionEmoji';
  5. import { getReactionsQueue } from '../../../../reactions/functions.native';
  6. import AbstractDialogContainer, {
  7. abstractMapStateToProps
  8. } from '../AbstractDialogContainer';
  9. /**
  10. * Implements a DialogContainer responsible for showing all dialogs. We will
  11. * need a separate container so we can handle multiple dialogs by showing them
  12. * simultaneously or queueing them.
  13. *
  14. * @augments AbstractDialogContainer
  15. */
  16. class DialogContainer extends AbstractDialogContainer {
  17. /**
  18. * Returns the reactions to be displayed.
  19. *
  20. * @returns {Array<React$Element>}
  21. */
  22. _renderReactions() {
  23. const { _reactionsQueue } = this.props;
  24. return _reactionsQueue.map(({ reaction, uid }, index) => (<ReactionEmoji
  25. index = { index }
  26. key = { uid }
  27. reaction = { reaction }
  28. uid = { uid } />));
  29. }
  30. /**
  31. * Implements React's {@link Component#render()}.
  32. *
  33. * @inheritdoc
  34. * @returns {ReactElement}
  35. */
  36. render() {
  37. return (
  38. <Fragment>
  39. {this._renderReactions()}
  40. {this._renderDialogContent()}
  41. </Fragment>
  42. );
  43. }
  44. }
  45. const mapStateToProps = (state: IReduxState) => {
  46. return {
  47. ...abstractMapStateToProps(state),
  48. _reactionsQueue: getReactionsQueue(state)
  49. };
  50. };
  51. export default connect(mapStateToProps)(DialogContainer);