React-Native:图像未显示
我编写了给定的代码,但图像未显示建筑物中的应用程序停止。在此处输入图像描述 当我在模拟器上运行时,卡在构建过程中。我尝试了所有方法但没有任何反应。
``` import React from "react";
import { Image, StyleSheet, View, Dimensions} from "react-native";
const dimensions = Dimensions.get('window');
const imageHeight = Math.round(dimensions.width * 9 / 16); //calculate with aspect
ratio
const imageWidth = dimensions.width;
'function App() {
return (
<View>
<Image
style={styles.backgroundImage}
source={require('D:\nativeproject\AwesomeProject\images\abl.jpg')}
/>
</View>
);
}
const styles = StyleSheet.create({
backgroundImage: {
height: imageHeight,
width: imageWidth,
zIndex: 1,
},
});
export default App; ```
I write the given code but the image is not showing the app stop in the building.enter image description here when I run on the emulator stuck in the building process. I try all things but no response.
``` import React from "react";
import { Image, StyleSheet, View, Dimensions} from "react-native";
const dimensions = Dimensions.get('window');
const imageHeight = Math.round(dimensions.width * 9 / 16); //calculate with aspect
ratio
const imageWidth = dimensions.width;
'function App() {
return (
<View>
<Image
style={styles.backgroundImage}
source={require('D:\nativeproject\AwesomeProject\images\abl.jpg')}
/>
</View>
);
}
const styles = StyleSheet.create({
backgroundImage: {
height: imageHeight,
width: imageWidth,
zIndex: 1,
},
});
export default App; ```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论