verdnatura-chat/app/containers/message/Broadcast.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { View, Text } from 'react-native';
import Touchable from 'react-native-platform-touchable';
import PropTypes from 'prop-types';
import { CustomIcon } from '../../lib/Icons';
import styles from './styles';
import { BUTTON_HIT_SLOP } from './utils';
import I18n from '../../i18n';
2019-12-04 16:39:53 +00:00
import { themes } from '../../constants/colors';
const Broadcast = React.memo(({
2019-12-04 16:39:53 +00:00
author, user, broadcast, replyBroadcast, theme
}) => {
const isOwn = author._id === user.id;
if (broadcast && !isOwn) {
return (
<View style={styles.buttonContainer}>
<Touchable
onPress={replyBroadcast}
2019-12-04 16:39:53 +00:00
background={Touchable.Ripple(themes[theme].bannerBackground)}
style={[styles.button, { backgroundColor: themes[theme].tintColor }]}
hitSlop={BUTTON_HIT_SLOP}
>
<>
2019-12-04 16:39:53 +00:00
<CustomIcon name='back' size={20} style={styles.buttonIcon} color={themes[theme].buttonText} />
<Text style={[styles.buttonText, { color: themes[theme].buttonText }]}>{I18n.t('Reply')}</Text>
</>
</Touchable>
</View>
);
}
return null;
2019-12-04 16:39:53 +00:00
});
Broadcast.propTypes = {
author: PropTypes.object,
user: PropTypes.object,
broadcast: PropTypes.bool,
2019-12-04 16:39:53 +00:00
theme: PropTypes.string,
replyBroadcast: PropTypes.func
};
Broadcast.displayName = 'MessageBroadcast';
export default Broadcast;