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-06-20 14:53:19 +00:00
|
|
|
import { openSheet } from '../../../../base/dialog/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-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import AudioRoutePickerDialog from '../../../../mobile/audio-mode/components/AudioRoutePickerDialog';
|
|
|
|
|
|
|
|
import AudioIcon from './AudioIcon';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Button for selecting sound device in carmode.
|
|
|
|
*
|
|
|
|
* @returns {JSX.Element} - The sound device button.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
const SelectSoundDevice = (): JSX.Element => {
|
2022-05-06 10:14:10 +00:00
|
|
|
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
|
2022-07-07 12:29:18 +00:00
|
|
|
accessibilityLabel = 'carmode.actions.selectSoundDevice'
|
2022-05-06 10:14:10 +00:00
|
|
|
icon = { AudioIcon }
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'carmode.actions.selectSoundDevice'
|
|
|
|
onClick = { onSelect }
|
2022-07-07 12:29:18 +00:00
|
|
|
style = { styles.soundDeviceButton }
|
|
|
|
type = { BUTTON_TYPES.SECONDARY } />
|
2022-05-06 10:14:10 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SelectSoundDevice;
|