@cometchat/chat-uikit-react-native
Version:
Ready-to-use Chat UI Components for React Native
23 lines • 957 B
JavaScript
import React from "react";
import { Text, View } from "react-native";
import { useTheme } from "../../../theme";
import { dateHelperInstance } from "../../helper/dateHelper";
/**
* CometChatDateSeparator is a component that displays a formatted date/time separator
* between messages. If a custom date string is provided, it will be displayed instead.
*
* - Props for the component.
* The rendered date separator view.
*/
export const CometChatDateSeparator = (props) => {
const { timeStamp, pattern, customDateString, style } = props;
const theme = useTheme();
return (<View style={[theme.dateSeparatorStyles.containerStyle, style?.containerStyle]}>
<Text style={[theme.dateSeparatorStyles.textStyle, style?.textStyle]}>
{customDateString
? customDateString
: dateHelperInstance.getFormattedDate(timeStamp, pattern)}
</Text>
</View>);
};
//# sourceMappingURL=CometChatDateSeparator.js.map