2022-05-06 10:14:10 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { Button } from 'react-native-paper';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
2022-06-20 14:53:19 +00:00
|
|
|
import { openSheet } from '../../../../base/dialog/actions';
|
2022-05-06 10:14:10 +00:00
|
|
|
import AudioRoutePickerDialog from '../../../../mobile/audio-mode/components/AudioRoutePickerDialog';
|
|
|
|
|
|
|
|
import AudioIcon from './AudioIcon';
|
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Button for selecting sound device in carmode.
|
|
|
|
*
|
|
|
|
* @returns {JSX.Element} - The sound device button.
|
|
|
|
*/
|
|
|
|
const SelectSoundDevice = () : JSX.Element => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
const onSelect = useCallback(() =>
|
2022-06-20 14:53:19 +00:00
|
|
|
dispatch(openSheet(AudioRoutePickerDialog))
|
2022-05-06 10:14:10 +00:00
|
|
|
, [ dispatch ]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
accessibilityLabel = { t('carmode.actions.selectSoundDevice') }
|
|
|
|
children = { t('carmode.actions.selectSoundDevice') }
|
|
|
|
icon = { AudioIcon }
|
|
|
|
labelStyle = { styles.soundDeviceButtonLabel }
|
|
|
|
mode = 'contained'
|
|
|
|
onPress = { onSelect }
|
|
|
|
style = { styles.soundDeviceButton } />
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SelectSoundDevice;
|