我正在开发一个react native项目,我想显示从Firebase检索并存储在数组中的URL集合中的图像,使用下面的代码
{/* //==================================================== */}
<View style={styles.container}>
<View>
<View style={{flexDirection: 'column'}}>
<Text>ProductName</Text>
<Text>ProductName</Text>
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={{flexDirection: 'column', justifyContent: 'space-between'}}>
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}}/>
<View style={{width: 50, height: 50, backgroundColor: 'skyblue'}}/>
<View style={{width: 50, height: 50, backgroundColor: 'steelblue'}}/>
</View>
<View style={{flexDirection: 'row'}}>
{/* <View style={{width: 200, height: 200, backgroundColor: 'green'}} /> */}
{imageUrls.map((item, i) => console.log("Swiper inside Item:" + i + " " + item))}
<Swiper>{
imageUrls.map((item, i) =>
<View>
<FullWidthImage source={{uri: item}} key={i}/>
</View>
)}</Swiper>
</View>
<View style={{flexDirection: 'column', justifyContent: 'space-between'}}>
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}}/>
</View>
</View>
</View>
</View>
{/* //==================================================== */}
<Swiper>{
imageUrls.map((item, i) =>
<View>
<FullWidthImage source={{uri: item}} key={i}/>
</View>
)}
</Swiper>
下面显示的swaiper代码可以正常工作并显示图像, 但是上面的swaiper代码不起作用。数组imageUrls不是 在代码的任何部分为空。我使用控制台对其进行了检查。