React-Native - 图像未在Android模拟器中显示

时间:2017-12-20 15:50:09

标签: android image react-native

为什么图片无法在Android模拟器上呈现?

我只有两个文件:

Index.js

import { AppRegistry } from 'react-native';
import App from './src/App';

AppRegistry.registerComponent('FirstApp', () => App);

App.js

    import React, { Component } from 'react';
    import {View, Image, Text} from 'react-native';

    export default class App extends Component<{}> {
        render() {
            return (
                <View>
                    <Image source={{uri: "https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg"}}
                           style={{width: 193, height: 110}}/>
                    <Text>Some text here..</Text>
                </View>
            );
        }
    }

Android模拟器:

enter image description here

Android设备:

enter image description here

1 个答案:

答案 0 :(得分:3)

我的模拟器刚刚没有网络..