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