選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AbstractDialogContainer.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { type ReactionEmojiProps } from '../../../reactions/constants';
  4. /**
  5. * The type of the React {@code Component} props of {@link DialogContainer}.
  6. */
  7. type Props = {
  8. /**
  9. * The component to render.
  10. */
  11. _component: Function,
  12. /**
  13. * The props to pass to the component that will be rendered.
  14. */
  15. _componentProps: Object,
  16. /**
  17. * True if the UI is in a compact state where we don't show dialogs.
  18. */
  19. _reducedUI: boolean,
  20. /**
  21. * Array of reactions to be displayed.
  22. */
  23. _reactionsQueue: Array<ReactionEmojiProps>
  24. };
  25. /**
  26. * Implements a DialogContainer responsible for showing all dialogs.
  27. */
  28. export default class AbstractDialogContainer extends Component<Props> {
  29. /**
  30. * Returns the dialog to be displayed.
  31. *
  32. * @private
  33. * @returns {ReactElement|null}
  34. */
  35. _renderDialogContent() {
  36. const {
  37. _component: component,
  38. _reducedUI: reducedUI
  39. } = this.props;
  40. return (
  41. component && !reducedUI
  42. ? React.createElement(component, this.props._componentProps)
  43. : null);
  44. }
  45. }
  46. /**
  47. * Maps (parts of) the redux state to the associated
  48. * {@code AbstractDialogContainer}'s props.
  49. *
  50. * @param {Object} state - The redux state.
  51. * @private
  52. * @returns {Props}
  53. */
  54. export function abstractMapStateToProps(state: Object): $Shape<Props> {
  55. const stateFeaturesBaseDialog = state['features/base/dialog'];
  56. const { reducedUI } = state['features/base/responsive-ui'];
  57. return {
  58. _component: stateFeaturesBaseDialog.component,
  59. _componentProps: stateFeaturesBaseDialog.componentProps,
  60. _reducedUI: reducedUI
  61. };
  62. }