feat: 优化图片加载和展示功能

- 新增 SmartImage 组件优化图片加载体验
- 新增 ImageGrid 组件支持多图布局展示
- 新增 imageHelper 工具函数
- 优化 PostCard 帖子卡片图片展示
- 优化消息页面 SegmentRenderer
- 优化日程页面 ScheduleScreen
- 优化上传服务 uploadService
This commit is contained in:
2026-03-15 02:25:55 +08:00
parent e9d42fdb01
commit 592167e667
8 changed files with 299 additions and 46 deletions

View File

@@ -438,11 +438,20 @@ const renderLinkSegment = (
): React.ReactNode => {
const { onLinkPress, isMe } = props;
const handlePress = () => {
const handlePress = async () => {
if (onLinkPress) {
onLinkPress(data.url);
} else {
Linking.openURL(data.url).catch(() => {});
try {
const supported = await Linking.canOpenURL(data.url);
if (supported) {
await Linking.openURL(data.url);
} else {
console.warn('无法打开链接:', data.url);
}
} catch (error) {
console.warn('打开链接失败:', error);
}
}
};
@@ -466,7 +475,13 @@ const renderLinkSegment = (
</Text>
)}
<Text style={styles.linkUrl} numberOfLines={1}>
{new URL(data.url).hostname}
{(() => {
try {
return new URL(data.url).hostname;
} catch {
return data.url;
}
})()}
</Text>
</View>
</TouchableOpacity>