我想显示平面列表数据,但不显示某些数据,尤其是图像

问题描述

我用它来从服务器中收集数据

getPopularProduct = async () => {
        const url = `https://swissmade.direct/wp-json/swissmade/home/popular`;
        fetch(url)
            .then(response => response.json())
            .then((responseJson) => {
                console.log(responseJson.products.thumbnail,"details")
                if(responseJson.error == false){
                this.setState({
                    dataSourcePopularProduct: responseJson.products,//isLoading: false,})
            }
            })
            .catch((error) => {
                console.log(error)
            })
    }

this the blank space imag,这是平面列表和渲染项目

renderPopularProduct = ({ item }) => {
        const entities = new Entities();
        var id = item.pid;
        var img = { 'uri': item.thumbnail };
        return (
            <TouchableOpacity onPress={() => this.props.navigation.navigate('ProductDetails',{ id })}>
                <View style={styles.GalleryBox}>
                    <View style={styles.GalleryImg} onPress={() => this.props.navigation.navigate("ProductDetails")}>
                        <Image source={img} style={styles.SingelImg} largeHeap="true"/>
                    </View>
                    <View style={styles.GalleryText}>
                        <Text style={styles.userNmae}>{item.title}</Text>
                    </View>
                    <View style={styles.amount}>
                        <Text style={styles.userNmae}>{entities.decode(item.currency)} {item.price}</Text>
                    </View>
                </View>
            </TouchableOpacity>
        )


    }



<FlatList
                            data={this.state.dataSourcePopularProduct}
                            renderItem={this.renderPopularProduct}
                            keyExtractor={(item,index) => index}
                            horizontal={true}
                            showsHorizontalScrollIndicator={false}
                            
                        />

和样式表

SingelImg: {
        width: '150%',height: '120%',//resizeMode: 'cover',marginLeft: -25

    },

这样,我使用平面列表,但是当它显示某些数据(尤其是图像)丢失时。但是我的API会返回所有正确的数据。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...