Files
JKVideo/components/CommentItem.tsx
Developer 463c0db058 feat: 性能优化 + Bug修复 + 搜索增强
- expo-image 替换 RN Image(VideoCard/LiveCard/BigVideoCard/CommentItem,recyclingKey)
- DanmakuList Animated.Value 对象池,减少 GC 压力
- FlatList 性能参数:windowSize=7 / maxToRenderPerBatch=6 / removeClippedSubviews
- bilibili.ts 请求去重(getVideoDetail/getPlayUrl)
- SESSDATA 迁移至 expo-secure-store(utils/secureStorage.ts,启动自动迁移)
- 主题系统扩展:新增 sheetBg/modalBg/modalText/placeholder/iconDefault/danger 等 token
- 多组件深色模式适配:DownloadSheet/LivePlayer/NativeVideoPlayer/DownloadProgressBtn/CommentItem/LoginModal
- 搜索页增强:搜索建议 + 热搜榜(hooks/useSearch.ts + app/search.tsx)
- LoginModal 修复轮询竞态(cancelled flag + try-catch)
- 修复 downloads.tsx 冗余三元表达式
2026-03-26 01:16:20 +08:00

43 lines
1.9 KiB
TypeScript

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { Image } from 'expo-image';
import { Ionicons } from '@expo/vector-icons';
import type { Comment } from '../services/types';
import { formatTime } from '../utils/format';
import { proxyImageUrl } from '../utils/imageUrl';
import { useTheme } from '../utils/theme';
interface Props { item: Comment; }
export function CommentItem({ item }: Props) {
const theme = useTheme();
return (
<View style={[styles.row, { borderBottomColor: theme.border }]}>
<Image source={{ uri: proxyImageUrl(item.member.avatar) }} style={styles.avatar} />
<View style={styles.content}>
<Text style={styles.username}>{item.member.uname}</Text>
<Text style={[styles.message, { color: theme.text }]}>{item.content.message}</Text>
<View style={styles.footer}>
<Text style={[styles.time, { color: theme.textSub }]}>{formatTime(item.ctime)}</Text>
<View style={styles.likeRow}>
<Ionicons name="thumbs-up-outline" size={12} color={theme.textSub} />
<Text style={[styles.likeCount, { color: theme.textSub }]}>{item.like > 0 ? item.like : ''}</Text>
</View>
</View>
</View>
</View>
);
}
const styles = StyleSheet.create({
row: { flexDirection: 'row', paddingHorizontal: 16, paddingVertical: 10, borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: '#eee' },
avatar: { width: 34, height: 34, borderRadius: 17, marginRight: 10 },
content: { flex: 1 },
username: { fontSize: 12, color: '#00AEEC', marginBottom: 3 },
message: { fontSize: 14, color: '#212121', lineHeight: 20 },
footer: { flexDirection: 'row', justifyContent: 'space-between', marginTop: 4 },
time: { fontSize: 11, color: '#bbb' },
likeRow: { flexDirection: 'row', alignItems: 'center', gap: 2 },
likeCount: { fontSize: 11, color: '#999' },
});