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

ContextMenuReject.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 ContextMenuReject = ({ 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.contextMenuItemDetails }>
  33. <Avatar
  34. className = 'participant-avatar'
  35. participantId = { p.id }
  36. size = { 32 } />
  37. <View style = { styles.contextMenuItemText }>
  38. <Text style = { styles.contextMenuItemParticipantName }>
  39. { displayName }
  40. </Text>
  41. </View>
  42. </View>
  43. <TouchableOpacity
  44. onPress = { reject }
  45. style = { styles.contextMenuItemReject }>
  46. <Icon
  47. size = { 24 }
  48. src = { IconClose } />
  49. <Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
  50. </TouchableOpacity>
  51. </BottomSheet>
  52. );
  53. };