import { View, Image, StyleSheet, Platform, Text, TouchableOpacity, } from "react-native"; import { HelloWave } from "@/components/HelloWave"; import ParallaxScrollView from "@/components/ParallaxScrollView"; import { ThemedText } from "@/components/ThemedText"; import { ThemedView } from "@/components/ThemedView"; import { useEffect, useState } from "react"; import { FAKE_DATA, type ImageAsset } from "@/cloudinary/cloudinary"; import { MasonryFlashList } from "@shopify/flash-list"; import { useRouter } from "expo-router"; import { useStore } from "@/store/store"; export default function HomeScreen() { const router = useRouter(); const setSelectedWallpaper = useStore((store) => store.setSelectedWallpaper); const [images, setImages] = useState(null); const [isLoading, setIsLoading] = useState(false); useEffect(() => { async function fetchWallpapers() { setIsLoading(true); const res = await fetch("http://localhost:8080/wallpapers"); const images: ImageAsset[] = await res.json(); setImages(images); setIsLoading(false); } fetchWallpapers(); }, []); return ( ( Wallpapers )} renderItem={({ item }) => ( { setSelectedWallpaper(item); router.push("/wallpaper"); }} > {item.public_id.replace("wallpaper/", "")} )} estimatedItemSize={200} /> ); }