2020-02-17 12:14:56 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { SendButton, AudioButton, FileButton } from './buttons';
|
|
|
|
|
|
|
|
const RightButtons = React.memo(({
|
2020-02-20 21:02:09 +00:00
|
|
|
theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled, showFileActions
|
2020-02-17 12:14:56 +00:00
|
|
|
}) => {
|
|
|
|
if (showSend) {
|
|
|
|
return <SendButton onPress={submit} theme={theme} />;
|
|
|
|
}
|
2020-02-20 21:02:09 +00:00
|
|
|
if (recordAudioMessageEnabled) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<AudioButton onPress={recordAudioMessage} theme={theme} />
|
|
|
|
<FileButton onPress={showFileActions} theme={theme} />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return <FileButton onPress={showFileActions} theme={theme} />;
|
2020-02-17 12:14:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
RightButtons.propTypes = {
|
|
|
|
theme: PropTypes.string,
|
|
|
|
showSend: PropTypes.bool,
|
|
|
|
submit: PropTypes.func.isRequired,
|
|
|
|
recordAudioMessage: PropTypes.func.isRequired,
|
2020-02-20 21:02:09 +00:00
|
|
|
recordAudioMessageEnabled: PropTypes.bool,
|
2020-02-17 12:14:56 +00:00
|
|
|
showFileActions: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default RightButtons;
|