Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ContextMenuLobbyParticipantReject.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { TouchableOpacity, View } from 'react-native';
  5. import { Divider, Text } from 'react-native-paper';
  6. import { useDispatch } from 'react-redux';
  7. import { Avatar } from '../../../base/avatar';
  8. import { hideDialog } from '../../../base/dialog';
  9. import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
  10. import {
  11. Icon, IconClose
  12. } from '../../../base/icons';
  13. import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
  14. import styles from './styles';
  15. type Props = {
  16. /**
  17. * Participant reference
  18. */
  19. participant: Object
  20. };
  21. export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
  22. const dispatch = useDispatch();
  23. const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
  24. const displayName = p.name;
  25. const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
  26. const { t } = useTranslation();
  27. return (
  28. <BottomSheet
  29. onCancel = { cancel }
  30. style = { styles.contextMenuMore }>
  31. <View
  32. style = { styles.contextMenuItemSection }>
  33. <Avatar
  34. className = 'participant-avatar'
  35. participantId = { p.id }
  36. size = { 20 } />
  37. <View style = { styles.contextMenuItemText }>
  38. <Text style = { styles.contextMenuItemName }>
  39. { displayName }
  40. </Text>
  41. </View>
  42. </View>
  43. <Divider style = { styles.divider } />
  44. <TouchableOpacity
  45. onPress = { reject }
  46. style = { styles.contextMenuItem }>
  47. <Icon
  48. size = { 20 }
  49. src = { IconClose }
  50. style = { styles.contextMenuItemIcon } />
  51. <Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
  52. </TouchableOpacity>
  53. </BottomSheet>
  54. );
  55. };