简体   繁体   中英

React-Native - Image not showing in Android emulator

Why the image doesn't render on Android emulator?

I have only 2 files:

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 emulator:

在此处输入图像描述

Android device:

在此处输入图像描述

我的模拟器只是没有网络..

我发现这个视频对于在 Mac 机器的 android 模拟器中打开互联网很有用https://youtu.be/OfGjE8njmC0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM