import { View, Pressable, StyleSheet } from 'react-native'; import { Path, Svg } from 'react-native-svg'; import React from 'react'; import { moderateScale } from 'react-native-size-matters'; import getStyleObj from './styles'; import { ChatBubbleProps } from 'react-native-chat-bubble'; const ChatBubble: React.FC = ({ isOwnMessage, children, bubbleColor = isOwnMessage ? '#1084ff' : 'grey', tailColor = bubbleColor, withTail = true, style, onPress, hitSlop, maxWidth, ...rest }) => { const styles = getStyleObj({isOwnMessage, maxWidth}) const SvgContainerStyle = isOwnMessage ? styles.svgContainerOwn : styles.svgContainerOther; const Container : typeof View | typeof Pressable = onPress ? Pressable: View; const tailPath = isOwnMessage ? "M48,35c-7-4-6-8.75-6-17.5C28,17.5,29,35,48,35z" : "M38.484,17.5c0,8.75,1,13.5-6,17.5C51.484,35,52.484,17.5,38.484,17.5z"; const bubbleStyle = StyleSheet.flatten([ style, styles.bubble, isOwnMessage && styles.itemOut, { backgroundColor: bubbleColor, }, ]); return ( {children} {withTail && ( )} ); }; export default ChatBubble;