2019-10-07 20:56:30 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { View, Text } from 'react-native';
|
|
|
|
import Touchable from 'react-native-platform-touchable';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { formatLastMessage, BUTTON_HIT_SLOP } from './utils';
|
|
|
|
import styles from './styles';
|
|
|
|
import I18n from '../../i18n';
|
|
|
|
import { CustomIcon } from '../../lib/Icons';
|
2019-12-11 23:01:12 +00:00
|
|
|
import { themes } from '../../constants/colors';
|
2019-10-07 20:56:30 +00:00
|
|
|
|
|
|
|
const CallButton = React.memo(({
|
2019-12-11 23:01:12 +00:00
|
|
|
dlm, theme, callJitsi
|
2019-10-07 20:56:30 +00:00
|
|
|
}) => {
|
|
|
|
const time = formatLastMessage(dlm);
|
|
|
|
return (
|
|
|
|
<View style={styles.buttonContainer}>
|
|
|
|
<Touchable
|
|
|
|
onPress={callJitsi}
|
2019-12-11 23:01:12 +00:00
|
|
|
background={Touchable.Ripple(themes[theme].bannerBackground)}
|
|
|
|
style={[styles.button, styles.smallButton, { backgroundColor: themes[theme].tintColor }]}
|
2019-10-07 20:56:30 +00:00
|
|
|
hitSlop={BUTTON_HIT_SLOP}
|
|
|
|
>
|
|
|
|
<>
|
2019-12-11 23:01:12 +00:00
|
|
|
<CustomIcon name='video' size={20} style={styles.buttonIcon} color={themes[theme].buttonText} />
|
|
|
|
<Text style={[styles.buttonText, { color: themes[theme].buttonText }]}>{I18n.t('Click_to_join')}</Text>
|
2019-10-07 20:56:30 +00:00
|
|
|
</>
|
|
|
|
</Touchable>
|
2019-12-11 23:01:12 +00:00
|
|
|
<Text style={[styles.time, { color: themes[theme].auxiliaryText }]}>{time}</Text>
|
2019-10-07 20:56:30 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
CallButton.propTypes = {
|
|
|
|
dlm: PropTypes.string,
|
2019-12-11 23:01:12 +00:00
|
|
|
theme: PropTypes.string,
|
2019-10-07 20:56:30 +00:00
|
|
|
callJitsi: PropTypes.func
|
|
|
|
};
|
|
|
|
CallButton.displayName = 'CallButton';
|
|
|
|
|
|
|
|
export default CallButton;
|