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-07 12:29:18 +00:00
|
|
|
import Button from '../../../../base/react/components/native/Button';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-07-07 12:29:18 +00:00
|
|
|
import { BUTTON_TYPES } from '../../../../base/react/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.
|
|
|
|
*/
|
|
|
|
const SelectSoundDevice = () : JSX.Element => {
|
|
|
|
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-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
icon = { AudioIcon }
|
2022-07-07 12:29:18 +00:00
|
|
|
label = 'carmode.actions.selectSoundDevice'
|
2022-05-06 10:14:10 +00:00
|
|
|
onPress = { 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;
|