我認為在我的代碼中我以某種方式循環遍歷圖像,但我的 console.log 確實很瘋狂。我每個文件夾里只有 3 張圖片。一個打來電話back,另一個打來電話front。我怎樣才能讓它顯示所有圖像而不導致應用程序緩慢停止。同樣,每個文件夾中只有 3 張圖像。為了簡潔起見,我只發布其中之一。 const [frontImage, setFrontImage] = useState(); const getFrontImage = async () => { var user = firebase.auth().currentUser.email;// like this right here gets put out almost 50 times console.log(user + "this is name"); const imageRefs = await firebase.storage().ref().child(user + '/FrontPic/').listAll(); const urls = await Promise.all(imageRefs.items.map((ref) => ref.getDownloadURL())); setFrontImage(urls); } useEffect(() => { getFrontImage(); });稍后在此處調用圖像 <View style={styles.DisplayImageWith}> {frontImage && frontImage.map(url => ( <View style={{ justifyContent: 'center' }} key={url}> <Image source={{ uri: url }} style={{ width: 150, height: 150 }} /> </View> ))} </View>
調用 Firestore 存儲導致應用程序停止
小唯快跑啊
2023-12-14 14:24:06