UNPKG

fastcomments-react-native-sdk

Version:

React Native FastComments Components. Add live commenting to any React Native application.

26 lines (25 loc) 995 B
import { jsx as _jsx } from "react/jsx-runtime"; import { Text } from "react-native"; export function CommentNotices({ comment, styles, translations }) { let notice = null, noticeStyles = null; if (comment.wasPostedCurrentSession) { if (comment.isSpam) { notice = translations.COMMENT_FLAGGED_SPAM; noticeStyles = styles.commentNotices?.spamNotice; } else if (comment.requiresVerification) { notice = translations.COMMENT_AWAITING_VERIFICATION; noticeStyles = styles.commentNotices?.requiresVerificationApprovalNotice; } } if (!notice && comment.approved === false) { // this is only false upon submission, normally it is undefined notice = translations.AWAITING_APPROVAL_COMMENT; noticeStyles = styles.commentNotices?.awaitingApprovalNotice; } if (notice) { return _jsx(Text, { style: noticeStyles, children: notice }); } else { return null; } }