diff --git a/app/screens/HomeScreen.tsx b/app/screens/HomeScreen.tsx
index d470078..cec2b6f 100644
--- a/app/screens/HomeScreen.tsx
+++ b/app/screens/HomeScreen.tsx
@@ -52,6 +52,61 @@ type CategoryContentType = {
[key: string]: SubcategoryItem[];
};
+// 懒加载图片组件 - 改进版本
+const LazyImage = React.memo(
+ ({
+ uri,
+ style,
+ resizeMode,
+ }: {
+ uri: string;
+ style: any;
+ resizeMode: any;
+ }) => {
+ const [isLoaded, setIsLoaded] = useState(false);
+ const [hasError, setHasError] = useState(false);
+
+ const onLoad = useCallback(() => {
+ setIsLoaded(true);
+ }, []);
+
+ const onError = useCallback(() => {
+ setHasError(true);
+ setIsLoaded(true); // Also mark as loaded on error to remove placeholder
+ }, []);
+
+ return (
+
+ {/* Show placeholder while image is loading */}
+ {!isLoaded && !hasError && (
+
+ )}
+
+ {/* Show error state if image failed to load */}
+ {hasError && (
+
+
+
+ 加载失败
+
+
+ )}
+
+ {/* Actual image */}
+
+
+ );
+ }
+);
+
// 产品骨架屏组件 - 用于加载状态
const ProductSkeleton = React.memo(() => {
// 创建动画值
@@ -303,19 +358,30 @@ export const HomeScreen = () => {
activeOpacity={0.9}
style={styles.beautyProductCard1}
>
-
+
+ {item.product_image_urls && item.product_image_urls.length > 0 ? (
+
+ ) : (
+
+
+
+ )}
+
{userStore.user?.user_id && (
-
- VIP
-
- {userStore.user?.vip_level}
-
-
+
+
+ VIP
+
+ {userStore.user?.vip_level}
+
+
+
)}
-
+