React native 从react native中的另一个数据文件中提取数据时,如何设置映像?
事实上,我准备了这些数据,但是koala.png没有显示出来。但我在网站上拍的另一张照片看起来很像。我怎样才能解决这个问题React native 从react native中的另一个数据文件中提取数据时,如何设置映像?,react-native,react-native-android,react-native-ios,React Native,React Native Android,React Native Ios,事实上,我准备了这些数据,但是koala.png没有显示出来。但我在网站上拍的另一张照片看起来很像。我怎样才能解决这个问题 导出默认值[ { “单位”:“字母”, “a”:0, “图片”:“./src/img/koala.png”, }, { “单位”:“数字”, “a”:1 “图片”:https://randomuser.me/api/portraits/men/1.jpg", }, ];如果本地图像 export default [ { "
导出默认值[
{
“单位”:“字母”,
“a”:0,
“图片”:“./src/img/koala.png”,
},
{
“单位”:“数字”,
“a”:1
“图片”:https://randomuser.me/api/portraits/men/1.jpg",
},
];代码>如果本地图像
export default [
{
"unit": "Letters",
"a": 0,
"picture": require(‘./assets/images/photo1.jpg’), // like this
},
{
"unit": "Numbers",
"a": 1
"picture": "https://randomuser.me/api/portraits/men/1.jpg",
},
];
<Image source={item.picture} />
导出默认值[
{
“单位”:“字母”,
“a”:0,
“picture”:require('./assets/images/photo1.jpg'),//像这样
},
{
“单位”:“数字”,
“a”:1
“图片”:https://randomuser.me/api/portraits/men/1.jpg",
},
];
如何将其写入数据文件?{“单位”:“字母”,“a”:0,“图片”:./src/img/koala.png“,},@selcukctn更新了我的答案,请检查