我已经启动了一个新的react-native项目,之后我安装了react-native-mapsi无法运行,react-native run-android因为终端显示以下错误:
module.js:550
throw err;
^
Error: Cannot find module 'asap/raw'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/valentino/Scrivania/lolo/node_modules/promise/lib/core.js:3:12)
at Module._compile (module.js:653:30)
at Module._compile (/home/valentino/Scrivania/lolo/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (module.js:664:10)
at Object.newLoader [as .js] (/home/valentino/Scrivania/lolo/node_modules/pirates/lib/index.js:88:7)
at Module.load (module.js:566:32)
Run Code Online (Sandbox Code Playgroud)
如果我安装react-native-maps,则会显示该消息,这是我用以下内容构建项目的命令:
react-native init appName
cd appName
npm install react-native-maps --save
react-native run-android
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
难道我做错了什么?
谢谢您的帮助.
我正在用 React Native 开发一个应用程序,我有这个 JSON:
const places = {
"place1":{
"title":"title 1",
"image":"../img/image1.jpeg",
"description":"description 1.",
},
"place2":{
"title":"title 2",
"image":"../img/image2.jpeg",
"description":"description 2.",
}
};
Run Code Online (Sandbox Code Playgroud)
我想在元素列表中输出它,我知道要做到这一点,我必须使用 map() 这是我的代码:
export default class App extends Component{
render() {
return (
<View style={styles.container}>
{places.map((place) => {
return (
<Text>{place.title}</Text>
<Text>{place.description}</Text>
)
})}
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,有谁知道我错了或者我怎样才能达到我的目标?