2022-05-06 10:14:10 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
|
|
|
import { createToolbarEvent, sendAnalytics } from '../../../../analytics';
|
|
|
|
import { appNavigate } from '../../../../app/actions';
|
2022-07-07 12:29:18 +00:00
|
|
|
import Button from '../../../../base/react/components/native/Button';
|
|
|
|
import { BUTTON_TYPES } from '../../../../base/react/constants';
|
2022-05-06 10:14:10 +00:00
|
|
|
|
|
|
|
import EndMeetingIcon from './EndMeetingIcon';
|
|
|
|
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-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;
|