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-07-06 19:23:46 +00:00
|
|
|
import { SendButton, 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-07-06 19:23:46 +00:00
|
|
|
theme, showSend, submit, showMessageBoxActions, isActionsEnabled
|
2020-02-17 12:14:56 +00:00
|
|
|
}) => {
|
|
|
|
if (showSend) {
|
|
|
|
return <SendButton onPress={submit} theme={theme} />;
|
|
|
|
}
|
2020-07-06 19:23:46 +00:00
|
|
|
if (isActionsEnabled) {
|
|
|
|
return <ActionsButton onPress={showMessageBoxActions} theme={theme} />;
|
2020-02-20 21:02:09 +00:00
|
|
|
}
|
2020-07-06 19:23:46 +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,
|
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;
|