2020-02-17 12:14:56 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
2020-03-30 19:50:27 +00:00
|
|
|
import { SendButton, AudioButton, ActionsButton } from './buttons';
|
2020-02-17 12:14:56 +00:00
|
|
|
|
|
|
|
const RightButtons = React.memo(({
|
2020-03-30 19:50:27 +00:00
|
|
|
theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled, showMessageBoxActions
|
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} />
|
2020-03-30 19:50:27 +00:00
|
|
|
<ActionsButton onPress={showMessageBoxActions} theme={theme} />
|
2020-02-20 21:02:09 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
2020-03-30 19:50:27 +00:00
|
|
|
return <ActionsButton onPress={showMessageBoxActions} 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-03-30 19:50:27 +00:00
|
|
|
showMessageBoxActions: PropTypes.func.isRequired
|
2020-02-17 12:14:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default RightButtons;
|