Skip to content

Commit

Permalink
formatDate prop for MessageSimple component
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Jan 28, 2020
1 parent 9a8d9a3 commit c3cfdf6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/MessageSimple/MessageContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export const MessageContent = themed(
PropTypes.node,
PropTypes.elementType,
]),
formatDate: PropTypes.func,
};

static defaultProps = {
Expand Down Expand Up @@ -534,7 +535,9 @@ export const MessageContent = themed(
{!MessageFooter && showTime ? (
<MetaContainer>
<MetaText alignment={pos}>
{moment(message.created_at).format('h:mmA')}
{this.props.formatDate
? this.props.formatDate(message.created_at)
: moment(message.created_at).format('h:mmA')}
</MetaText>
</MetaContainer>
) : null}
Expand Down
1 change: 1 addition & 0 deletions src/components/MessageSimple/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export const MessageSimple = themed(
PropTypes.node,
PropTypes.elementType,
]),
formatDate: PropTypes.func,
};

static defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ export interface MessageUIComponentProps
/** https://github.com/beefe/react-native-actionsheet/blob/master/lib/styles.js */
actionSheetStyles?: object;
AttachmentFileIcon?: React.ElementType<FileIconUIComponentProps>;
formatDate(date: string): string;
}

export interface MessageRepliesUIComponentProps {
Expand Down

0 comments on commit c3cfdf6

Please sign in to comment.