1 import React, { useCallback } from 'react'; 2 import { useDispatch } from 'react-redux'; 3 4 import { openSheet } from '../../../../base/dialog/actions'; 5 import Button from '../../../../base/ui/components/native/Button'; 6 import { BUTTON_TYPES } from '../../../../base/ui/constants.native'; 7 import AudioRoutePickerDialog from '../../../../mobile/audio-mode/components/AudioRoutePickerDialog'; 8 9 import AudioIcon from './AudioIcon'; 10 import styles from './styles'; 11 12 /** 13 * Button for selecting sound device in carmode. 14 * 15 * @returns {JSX.Element} - The sound device button. 16 */ 17 const SelectSoundDevice = (): JSX.Element => { 18 const dispatch = useDispatch(); 19 20 const onSelect = useCallback(() => 21 dispatch(openSheet(AudioRoutePickerDialog)) 22 , [ dispatch ]); 23 24 return ( 25 <Button 26 accessibilityLabel = 'carmode.actions.selectSoundDevice' 27 icon = { AudioIcon } 28 labelKey = 'carmode.actions.selectSoundDevice' 29 onClick = { onSelect } 30 style = { styles.soundDeviceButton } 31 type = { BUTTON_TYPES.SECONDARY } /> 32 ); 33 }; 34 35 export default SelectSoundDevice;