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.

ReactionMenu.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // @flow
  2. import React from 'react';
  3. import { View } from 'react-native';
  4. import { useSelector } from 'react-redux';
  5. import { ColorSchemeRegistry } from '../../../base/color-scheme';
  6. import { getParticipantCount } from '../../../base/participants';
  7. import { REACTIONS } from '../../constants';
  8. import RaiseHandButton from './RaiseHandButton';
  9. import ReactionButton from './ReactionButton';
  10. /**
  11. * The type of the React {@code Component} props of {@link ReactionMenu}.
  12. */
  13. type Props = {
  14. /**
  15. * Used to close the overflow menu after raise hand is clicked.
  16. */
  17. onCancel: Function,
  18. /**
  19. * Whether or not it's displayed in the overflow menu.
  20. */
  21. overflowMenu: boolean
  22. };
  23. /**
  24. * Animated reaction emoji.
  25. *
  26. * @returns {ReactElement}
  27. */
  28. function ReactionMenu({
  29. onCancel,
  30. overflowMenu
  31. }: Props) {
  32. const _styles = useSelector(state => ColorSchemeRegistry.get(state, 'Toolbox'));
  33. const _participantCount = useSelector(state => getParticipantCount(state));
  34. return (
  35. <View style = { overflowMenu ? _styles.overflowReactionMenu : _styles.reactionMenu }>
  36. {_participantCount > 1
  37. && <View style = { _styles.reactionRow }>
  38. {Object.keys(REACTIONS).map(key => (
  39. <ReactionButton
  40. key = { key }
  41. reaction = { key }
  42. styles = { _styles.reactionButton } />
  43. ))}
  44. </View>
  45. }
  46. <RaiseHandButton onCancel = { onCancel } />
  47. </View>
  48. );
  49. }
  50. export default ReactionMenu;