import React, { useMemo } from "react"; import { StyleSheet, Text, TouchableOpacity, View } from "react-native"; import { CometChatTheme } from "../../theme/type"; import { useTheme } from "../../theme"; import { deepMerge } from "../../shared/helper/helperFunctions"; import { DeepPartial } from "../../shared/helper/types"; import { JSX } from "react"; import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew"; /** * Props for the CometChatMeetCallBubble component. * * @interface CometChatMeetCallBubbleInterface */ export interface CometChatMeetCallBubbleInterface { /** Title text to be displayed in the bubble */ titleText: string; /** Subtitle text to be displayed under the title */ subTitleText: string; /** Text to be displayed on the button */ buttonText: string; /** JSX element to display as an icon */ icon: JSX.Element; /** Callback function to be executed on button press */ onClick: () => void; /** Custom style overrides for the meet call bubble */ style: DeepPartial; } /** * Component representing a meet call bubble. * * @param {CometChatMeetCallBubbleInterface} props - Component properties. * @returns {JSX.Element} The rendered component. */ export const CometChatMeetCallBubble = (props: CometChatMeetCallBubbleInterface) => { const { icon, titleText, subTitleText, buttonText, onClick, style } = props; return ( {/* Row container for icon and texts */} {icon} {titleText} {subTitleText} {/* Divider */} {/* Action button */} {buttonText} ); }; /** * Props for the CometChatCallActionBubble component. * * @interface CometChatUserCallBubbleInterface */ export interface CometChatUserCallBubbleInterface { /** Title text to be displayed (e.g., call status) */ titleText: string; /** JSX element to display as an icon */ icon: JSX.Element; /** Optional custom style overrides for the call action bubble */ style?: DeepPartial; } /** * Component representing a call action bubble. * * This component displays a call action with an icon and text. * It differentiates styles if the call is missed. * * @param {CometChatUserCallBubbleInterface} props - Component properties. * @returns {JSX.Element} The rendered component. */ export const CometChatCallActionBubble = (props: CometChatUserCallBubbleInterface) => { const { titleText, icon, style } = props; const theme = useTheme(); const {t} = useCometChatTranslation() // Merge default theme styles with optional style overrides const callActionBubbleStyles = useMemo(() => { return deepMerge(theme.messageListStyles.callActionBubbleStyles, style ?? {}); }, [theme.messageListStyles.callActionBubbleStyles, style]); return ( {icon} {titleText} ); }; const styles = StyleSheet.create({ row: { flexDirection: "row", alignItems: "center", marginBottom: 16, gap: 8, }, textContainer: { gap: 4, }, });