Javascript 在平面列表中使用本地img(React Native)

Javascript 在平面列表中使用本地img(React Native),javascript,json,reactjs,react-native,react-native-flatlist,Javascript,Json,Reactjs,React Native,React Native Flatlist,我的问题可能很基本,但我是编程新手。 基本上,我想看到一个平面列表,每个类别的标题和img 这是我的类别构造函数: class Category{ constructor(id, title, catImg){ this.id = id; this.title = title; this.catImg = catImg; } } 以下是我的3个类别: export const CATEGORIES = [

我的问题可能很基本,但我是编程新手。 基本上,我想看到一个平面列表,每个类别的标题和img

这是我的类别构造函数:

    class Category{
    constructor(id, title, catImg){
        this.id = id;
        this.title = title;
        this.catImg = catImg;
    }
}
以下是我的3个类别:

     export const CATEGORIES = [
    new Category('c1', 'Studeren', require('../assets/studeren.png')),
    new Category('c2', 'Wonen', require('../assets/wonen.png')),
    new Category('c3', 'EersteVoertuig', require('../assets/voertuig.png'))
  ];
这就是我要调用元素的地方:

    const CategoryGridTile = props  => {
    return(
        <TouchableOpacity style = {styles.gridItem} onPress = {props.onSelect}>
            <View >
                <Text>{props.title}</Text>
            </View>
            <Image source ={props.catImg} style={‌{width: 150, height: 150}}/>
        </TouchableOpacity>

    );
};

您必须将类别作为道具发送到CategotyGridTile

分类屏幕

return <CategotyGridTile 
    categories={CATEGORIES}
    {...props}
   />
返回
分类砖

<Image source ={props.categories.catImg} style={‌{width: 150, height: 150}}/>

实际上我只是设法做到了。我现在要删除这个问题吗?
<Image source ={props.categories.catImg} style={‌{width: 150, height: 150}}/>