UNPKG

react-native-chating-ui-kit

Version:

CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly

60 lines 2.24 kB
// @ts-ignore import React from 'react'; // @ts-ignore import { View, Image, Text, Linking } from 'react-native'; import whiteboard from "./resources/whiteboard.png"; import { Styles } from "./styles"; import { CollaborativeBubbleStyle } from "./CollaborativeBubbleStyle"; export const CometChatCollaborativeBubble = (props) => { const openLink = () => { if (props.url != "") if (props.onTap != undefined) { props.onTap(props.url); } else { console.log("opening uRL , ", props.url); Linking.openURL(props.url); } }; const getIcon = () => { if (props.icon) { if (typeof props.icon == 'number') return props.icon; if (typeof props.icon == 'string') return { uri: props.icon }; } return whiteboard; }; const getButtonText = () => { if (props.buttonText && props.buttonText.trim().length > 0) { return props.buttonText; } return ""; }; const { style } = props; return (<View style={Styles(style).containerStyle}> <View style={Styles(style).rowStyle}> <View style={{ flex: 1 }}> <Text numberOfLines={2} ellipsizeMode={"tail"} style={Styles(style).titleStyle}>{props.title}</Text> <Text numberOfLines={2} ellipsizeMode={"tail"} style={Styles(style).subtitleStyle}>{props.subTitle}</Text> </View> <View style={Styles(style).imageContainerStyle}> <Image source={getIcon()} style={Styles(style).imageStyle}/> </View> </View> <View style={Styles(style).dividerStyle}/> <View style={Styles(style).buttonViewStyle}> <Text onPress={openLink} style={Styles(style).linkStyle}>{getButtonText()}</Text> </View> </View>); }; CometChatCollaborativeBubble.defaultProps = { title: "", subTitle: "", buttonText: "", icon: undefined, whiteboardURL: "", loggedInUser: undefined, style: new CollaborativeBubbleStyle({}), }; //# sourceMappingURL=CometChatCollaborativeBubble.js.map