Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ContextMenuLobbyParticipantReject.js 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { TouchableOpacity, View } from 'react-native';
  4. import { Text } from 'react-native-paper';
  5. import { useDispatch, useSelector } from 'react-redux';
  6. import { Avatar } from '../../../base/avatar';
  7. import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
  8. import {
  9. Icon, IconClose
  10. } from '../../../base/icons';
  11. import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
  12. import { getKnockingParticipantsById } from '../../../lobby/functions';
  13. import styles from './styles';
  14. type Props = {
  15. /**
  16. * Participant reference.
  17. */
  18. participant: Object
  19. };
  20. const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
  21. const dispatch = useDispatch();
  22. const knockParticipantsIDArr = useSelector(getKnockingParticipantsById);
  23. const knockParticipantIsAvailable = knockParticipantsIDArr.find(knockPartId => knockPartId === p.id);
  24. const displayName = p.name;
  25. const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
  26. const { t } = useTranslation();
  27. // eslint-disable-next-line react/no-multi-comp
  28. const renderMenuHeader = () => (
  29. <View
  30. style = { styles.contextMenuItemSectionAvatar }>
  31. <Avatar
  32. className = 'participant-avatar'
  33. participantId = { p.id }
  34. size = { 24 } />
  35. <Text style = { styles.contextMenuItemName }>
  36. { displayName }
  37. </Text>
  38. </View>
  39. );
  40. return (
  41. <BottomSheet
  42. addScrollViewPadding = { false }
  43. /* eslint-disable-next-line react/jsx-no-bind */
  44. renderHeader = { renderMenuHeader }
  45. showSlidingView = { Boolean(knockParticipantIsAvailable) }
  46. style = { styles.contextMenuMore }>
  47. <TouchableOpacity
  48. onPress = { reject }
  49. style = { styles.contextMenuItem }>
  50. <Icon
  51. size = { 24 }
  52. src = { IconClose } />
  53. <Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
  54. </TouchableOpacity>
  55. </BottomSheet>
  56. );
  57. };
  58. export default ContextMenuLobbyParticipantReject;