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 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { Image, View } from 'react-native';
  4. import { useSelector } from 'react-redux';
  5. import { ColorSchemeRegistry } from '../../../base/color-scheme';
  6. import { isGifEnabled } from '../../../gifs/functions';
  7. import { navigate } from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
  8. import { screen } from '../../../mobile/navigation/routes';
  9. import { REACTIONS } from '../../constants';
  10. import RaiseHandButton from './RaiseHandButton';
  11. import ReactionButton from './ReactionButton';
  12. /**
  13. * The type of the React {@code Component} props of {@link ReactionMenu}.
  14. */
  15. type Props = {
  16. /**
  17. * Used to close the overflow menu after raise hand is clicked.
  18. */
  19. onCancel: Function,
  20. /**
  21. * Whether or not it's displayed in the overflow menu.
  22. */
  23. overflowMenu: boolean
  24. };
  25. /**
  26. * Animated reaction emoji.
  27. *
  28. * @returns {ReactElement}
  29. */
  30. function ReactionMenu({
  31. onCancel,
  32. overflowMenu
  33. }: Props) {
  34. const _styles = useSelector(state => ColorSchemeRegistry.get(state, 'Toolbox'));
  35. const gifEnabled = useSelector(isGifEnabled);
  36. const openGifMenu = useCallback(() => {
  37. navigate(screen.conference.gifsMenu);
  38. onCancel();
  39. }, []);
  40. return (
  41. <View style = { overflowMenu ? _styles.overflowReactionMenu : _styles.reactionMenu }>
  42. <View style = { _styles.reactionRow }>
  43. {
  44. Object.keys(REACTIONS).map(key => (
  45. <ReactionButton
  46. key = { key }
  47. reaction = { key }
  48. styles = { _styles.reactionButton } />
  49. ))
  50. }
  51. {
  52. gifEnabled && (
  53. <ReactionButton
  54. onClick = { openGifMenu }
  55. styles = { _styles.reactionButton }>
  56. <Image
  57. height = { 22 }
  58. source = { require('../../../../../images/GIPHY_icon.png') } />
  59. </ReactionButton>
  60. )
  61. }
  62. </View>
  63. <RaiseHandButton onCancel = { onCancel } />
  64. </View>
  65. );
  66. }
  67. export default ReactionMenu;