You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LeaveBreakoutRoomButton.js 1021B

12345678910111213141516171819202122232425262728293031323334
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { Button } from 'react-native-paper';
  5. import { useDispatch } from 'react-redux';
  6. import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
  7. import { moveToRoom } from '../../actions';
  8. import styles from './styles';
  9. const LeaveBreakoutRoomButton = () => {
  10. const { t } = useTranslation();
  11. const dispatch = useDispatch();
  12. const onLeave = useCallback(() => {
  13. sendAnalytics(createBreakoutRoomsEvent('leave'));
  14. dispatch(moveToRoom());
  15. }
  16. , [ dispatch ]);
  17. return (
  18. <Button
  19. accessibilityLabel = { t('breakoutRooms.actions.leaveBreakoutRoom') }
  20. children = { t('breakoutRooms.actions.leaveBreakoutRoom') }
  21. labelStyle = { styles.leaveButtonLabel }
  22. mode = 'contained'
  23. onPress = { onLeave }
  24. style = { styles.transparentButton } />
  25. );
  26. };
  27. export default LeaveBreakoutRoomButton;