2022-07-18 13:16:08 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2022-05-06 10:14:10 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { createToolbarEvent, sendAnalytics } from '../../../../analytics';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { appNavigate } from '../../../../app/actions';
|
2022-07-27 08:40:34 +00:00
|
|
|
import Button from '../../../../base/ui/components/native/Button';
|
|
|
|
import { BUTTON_TYPES } from '../../../../base/ui/constants';
|
2022-05-06 10:14:10 +00:00
|
|
|
|
|
|
|
import EndMeetingIcon from './EndMeetingIcon';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Button for ending meeting from carmode.
|
|
|
|
*
|
|
|
|
* @returns {JSX.Element} - The end meeting button.
|
|
|
|
*/
|
|
|
|
const EndMeetingButton = () : JSX.Element => {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
const onSelect = useCallback(() => {
|
|
|
|
sendAnalytics(createToolbarEvent('hangup'));
|
|
|
|
|
|
|
|
dispatch(appNavigate(undefined));
|
|
|
|
}, [ dispatch ]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
2022-07-07 12:29:18 +00:00
|
|
|
accessibilityLabel = 'carmode.actions.leaveMeeting'
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
icon = { EndMeetingIcon }
|
2022-07-07 12:29:18 +00:00
|
|
|
label = 'carmode.actions.leaveMeeting'
|
2022-05-06 10:14:10 +00:00
|
|
|
onPress = { onSelect }
|
2022-07-07 12:29:18 +00:00
|
|
|
style = { styles.endMeetingButton }
|
|
|
|
type = { BUTTON_TYPES.DESTRUCTIVE } />
|
2022-05-06 10:14:10 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default EndMeetingButton;
|