UNPKG

@cometchat/chat-uikit-react-native

Version:

Ready-to-use Chat UI Components for React Native

36 lines 1.61 kB
import { CometChat } from "@cometchat/chat-sdk-react-native"; import React, { useMemo } from "react"; import { Image, View } from "react-native"; import { useTheme } from "../../../theme"; import { useCompTheme } from "../../../theme/hook"; import { deepMerge } from "../../helper/helperFunctions"; /** * CometChatStatusIndicator is a component used for indicating the status of a user or group. * It displays the online/offline or custom status of the user/group using a predefined symbol or style. * * @author CometChat */ export const CometChatStatusIndicator = ({ type = "offline", style, }) => { const theme = useTheme(); const compTheme = useCompTheme(); const statusIndicatorStyles = useMemo(() => { return deepMerge(theme.statusIndicatorStyle, compTheme.statusIndicatorStyle ?? {}, style ?? {}); }, [theme, compTheme, style]); if (type === CometChat.USER_STATUS.ONLINE) { return (<View style={[statusIndicatorStyles.containerStyleOnline]}/>); } if (type === CometChat.GROUP_TYPE.PRIVATE) { return (<View style={[statusIndicatorStyles.containerStylePrivate]}> <Image style={[statusIndicatorStyles.imageStylePrivate]} source={require("./private.png")}/> </View>); } if (type === CometChat.GROUP_TYPE.PROTECTED) { return (<View style={[ statusIndicatorStyles.containerStyleProtected, ]}> <Image style={[statusIndicatorStyles.imageStyleProtected]} source={require("./protected.png")}/> </View>); } return null; }; //# sourceMappingURL=CometChatStatusIndicator.js.map