2019-05-27 16:19:39 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-06-26 20:22:56 +00:00
|
|
|
import { View } from 'react-native';
|
2019-05-27 16:19:39 +00:00
|
|
|
|
2020-03-30 19:50:27 +00:00
|
|
|
import { CancelEditingButton, ActionsButton } from './buttons';
|
2020-06-26 20:22:56 +00:00
|
|
|
import styles from './styles';
|
2019-05-27 16:19:39 +00:00
|
|
|
|
|
|
|
const LeftButtons = React.memo(({
|
2020-06-26 20:22:56 +00:00
|
|
|
theme, showMessageBoxActions, editing, editCancel, isActionsEnabled
|
2019-05-27 16:19:39 +00:00
|
|
|
}) => {
|
|
|
|
if (editing) {
|
2019-12-04 16:39:53 +00:00
|
|
|
return <CancelEditingButton onPress={editCancel} theme={theme} />;
|
2019-05-27 16:19:39 +00:00
|
|
|
}
|
2020-06-26 20:22:56 +00:00
|
|
|
if (isActionsEnabled) {
|
|
|
|
return <ActionsButton onPress={showMessageBoxActions} theme={theme} />;
|
|
|
|
}
|
|
|
|
return <View style={styles.buttonsWhitespace} />;
|
2019-05-27 16:19:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
LeftButtons.propTypes = {
|
2019-12-04 16:39:53 +00:00
|
|
|
theme: PropTypes.string,
|
2020-03-30 19:50:27 +00:00
|
|
|
showMessageBoxActions: PropTypes.func.isRequired,
|
2019-05-27 16:19:39 +00:00
|
|
|
editing: PropTypes.bool,
|
2020-06-26 20:22:56 +00:00
|
|
|
editCancel: PropTypes.func.isRequired,
|
|
|
|
isActionsEnabled: PropTypes.bool
|
2019-05-27 16:19:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default LeftButtons;
|