components/CommentItem.tsx
import React from 'react'; import {View, StyleSheet, Text} from 'react-native'; export interface CommentItemProps { id ; message ; username ; publishedAt ; } function ({message, username, publishedAt} CommentItemProps) { const formattedDate new Date(publishedAt). (); return ( <View style={styles.block}> <View style={styles.head}> <Text style={styles.username}>{username}</Text> <Text style={styles.date}>{formattedDate}</Text> </View> <Text style={styles.message}>{message}</Text> </View> ); } const styles StyleSheet. ({ block { paddingTop 8, paddingBottom 16, }, head { flexDirection 'row', justifyContent 'space-between', }, username { fontWeight 'bold', }, date { color '#546e7a', fontSize 10, marginTop 4, }, message { marginTop 4, }, }); export default CommentItem;