2021-09-14 15:31:30 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { Button } from 'react-native-paper';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
2021-11-23 13:14:59 +00:00
|
|
|
import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
|
2021-09-14 15:31:30 +00:00
|
|
|
import { moveToRoom } from '../../actions';
|
|
|
|
|
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
const LeaveBreakoutRoomButton = () => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
2021-11-23 13:14:59 +00:00
|
|
|
const onLeave = useCallback(() => {
|
|
|
|
sendAnalytics(createBreakoutRoomsEvent('leave'));
|
|
|
|
dispatch(moveToRoom());
|
|
|
|
}
|
2021-09-14 15:31:30 +00:00
|
|
|
, [ dispatch ]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
accessibilityLabel = { t('breakoutRooms.actions.leaveBreakoutRoom') }
|
|
|
|
children = { t('breakoutRooms.actions.leaveBreakoutRoom') }
|
|
|
|
labelStyle = { styles.leaveButtonLabel }
|
|
|
|
mode = 'contained'
|
|
|
|
onPress = { onLeave }
|
|
|
|
style = { styles.transparentButton } />
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default LeaveBreakoutRoomButton;
|