您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ContextMenuLobbyParticipantReject.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { TouchableOpacity, View } from 'react-native';
  5. import { 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 = { 24 } />
  37. <View style = { styles.contextMenuItemText }>
  38. <Text style = { styles.contextMenuItemName }>
  39. { displayName }
  40. </Text>
  41. </View>
  42. </View>
  43. <TouchableOpacity
  44. onPress = { reject }
  45. style = { styles.contextMenuItem }>
  46. <Icon
  47. size = { 24 }
  48. src = { IconClose }
  49. style = { styles.contextMenuItemIcon } />
  50. <Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
  51. </TouchableOpacity>
  52. </BottomSheet>
  53. );
  54. };