1 import React, { useCallback } from 'react'; 2 import { useDispatch } from 'react-redux'; 3 4 import { createToolbarEvent } from '../../../../analytics/AnalyticsEvents'; 5 import { sendAnalytics } from '../../../../analytics/functions'; 6 import { appNavigate } from '../../../../app/actions.native'; 7 import Button from '../../../../base/ui/components/native/Button'; 8 import { BUTTON_TYPES } from '../../../../base/ui/constants.native'; 9 10 import EndMeetingIcon from './EndMeetingIcon'; 11 import styles from './styles'; 12 13 /** 14 * Button for ending meeting from carmode. 15 * 16 * @returns {JSX.Element} - The end meeting button. 17 */ 18 const EndMeetingButton = (): JSX.Element => { 19 const dispatch = useDispatch(); 20 21 const onSelect = useCallback(() => { 22 sendAnalytics(createToolbarEvent('hangup')); 23 24 dispatch(appNavigate(undefined)); 25 }, [ dispatch ]); 26 27 return ( 28 <Button 29 accessibilityLabel = 'toolbar.accessibilityLabel.leaveConference' 30 icon = { EndMeetingIcon } 31 labelKey = 'toolbar.leaveConference' 32 onClick = { onSelect } 33 style = { styles.endMeetingButton } 34 type = { BUTTON_TYPES.DESTRUCTIVE } /> 35 ); 36 }; 37 38 export default EndMeetingButton;