【发布时间】:2020-01-19 10:30:16
【问题描述】:
我的代码在 expo (react-native) 上执行时没有给出任何错误,但图像也没有加载。我从 android 中图像的详细信息中获得的路径是“内部存储/DCIM/images.jpeg”,因此在论坛上搜索会看到一个建议,用“file:///storage/emulated/0/”替换内部存储。但这也行不通。我得到的唯一输出是 Hello, world! 文本。我的设备是华为 BG2-U01。
希望我不会错过任何基础知识。
import React, { Component } from 'react';
import { Text, View,Image } from 'react-native';
export default class HelloWorldApp extends Component {
render() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Hello, world!</Text>
<Image source={{uri:'file:///storage/emulated/0/DCIM/images.jpeg'}} style={{width: 60, height: 60}} />
</View>
);
}
}
【问题讨论】:
标签: javascript android react-native expo huawei-mobile-services