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.

OverflowMenu.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { Platform } from 'react-native';
  4. import { connect } from 'react-redux';
  5. import {
  6. BottomSheet,
  7. bottomSheetItemStylesCombined,
  8. hideDialog
  9. } from '../../../base/dialog';
  10. import { AudioRouteButton } from '../../../mobile/audio-mode';
  11. import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
  12. import { LiveStreamButton, RecordButton } from '../../../recording';
  13. import { RoomLockButton } from '../../../room-lock';
  14. import { ClosedCaptionButton } from '../../../subtitles';
  15. import { TileViewButton } from '../../../video-layout';
  16. import AudioOnlyButton from './AudioOnlyButton';
  17. import ToggleCameraButton from './ToggleCameraButton';
  18. /**
  19. * The type of the React {@code Component} props of {@link OverflowMenu}.
  20. */
  21. type Props = {
  22. /**
  23. * Used for hiding the dialog when the selection was completed.
  24. */
  25. dispatch: Function,
  26. };
  27. /**
  28. * The exported React {@code Component}. We need it to execute
  29. * {@link hideDialog}.
  30. *
  31. * XXX It does not break our coding style rule to not utilize globals for state,
  32. * because it is merely another name for {@code export}'s {@code default}.
  33. */
  34. let OverflowMenu_; // eslint-disable-line prefer-const
  35. /**
  36. * Implements a React {@code Component} with some extra actions in addition to
  37. * those in the toolbar.
  38. */
  39. class OverflowMenu extends Component<Props> {
  40. /**
  41. * Initializes a new {@code OverflowMenu} instance.
  42. *
  43. * @inheritdoc
  44. */
  45. constructor(props: Props) {
  46. super(props);
  47. // Bind event handlers so they are only bound once per instance.
  48. this._onCancel = this._onCancel.bind(this);
  49. }
  50. /**
  51. * Implements React's {@link Component#render()}.
  52. *
  53. * @inheritdoc
  54. * @returns {ReactElement}
  55. */
  56. render() {
  57. const buttonProps = {
  58. afterClick: this._onCancel,
  59. showLabel: true,
  60. styles: bottomSheetItemStylesCombined
  61. };
  62. return (
  63. <BottomSheet onCancel = { this._onCancel }>
  64. <AudioRouteButton { ...buttonProps } />
  65. <ToggleCameraButton { ...buttonProps } />
  66. <AudioOnlyButton { ...buttonProps } />
  67. <RoomLockButton { ...buttonProps } />
  68. <ClosedCaptionButton { ...buttonProps } />
  69. {
  70. // Apple rejected our app because they claim requiring a
  71. // Dropbox account for recording is not acceptable.
  72. // Ddisable it until we can find a way around it.
  73. Platform.OS !== 'ios'
  74. && <RecordButton { ...buttonProps } />
  75. }
  76. <LiveStreamButton { ...buttonProps } />
  77. <TileViewButton { ...buttonProps } />
  78. <PictureInPictureButton { ...buttonProps } />
  79. </BottomSheet>
  80. );
  81. }
  82. _onCancel: () => void;
  83. /**
  84. * Hides this {@code OverflowMenu}.
  85. *
  86. * @private
  87. * @returns {void}
  88. */
  89. _onCancel() {
  90. this.props.dispatch(hideDialog(OverflowMenu_));
  91. }
  92. }
  93. OverflowMenu_ = connect()(OverflowMenu);
  94. export default OverflowMenu_;