12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- // @flow
-
- import React, { useCallback } from 'react';
- import { useTranslation } from 'react-i18next';
- import { TouchableOpacity, View } from 'react-native';
- import { Divider, Text } from 'react-native-paper';
- import { useDispatch } from 'react-redux';
-
- import { Avatar } from '../../../base/avatar';
- import { hideDialog } from '../../../base/dialog';
- import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
- import {
- Icon, IconClose
- } from '../../../base/icons';
- import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
-
- import styles from './styles';
- type Props = {
-
- /**
- * Participant reference
- */
- participant: Object
- };
-
- export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
- const dispatch = useDispatch();
- const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
- const displayName = p.name;
- const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
- const { t } = useTranslation();
-
- return (
- <BottomSheet
- onCancel = { cancel }
- style = { styles.contextMenuMore }>
- <View
- style = { styles.contextMenuItemSection }>
- <Avatar
- className = 'participant-avatar'
- participantId = { p.id }
- size = { 20 } />
- <View style = { styles.contextMenuItemText }>
- <Text style = { styles.contextMenuItemName }>
- { displayName }
- </Text>
- </View>
- </View>
- <Divider style = { styles.divider } />
- <TouchableOpacity
- onPress = { reject }
- style = { styles.contextMenuItem }>
- <Icon
- size = { 20 }
- src = { IconClose }
- style = { styles.contextMenuItemIcon } />
- <Text style = { styles.contextMenuItemText }>{ t('lobby.reject') }</Text>
- </TouchableOpacity>
- </BottomSheet>
- );
- };
|