如何在React Native中显示https图像

时间:2019-09-12 05:32:39

标签: react-native

react-native的图片标签正在运行,但图片未在android仿真器中显示。只有卡来了。源代码的屏幕快照如下。source code

2 个答案:

答案 0 :(得分:4)

尝试一下,希望对您有帮助

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

export default class App extends Component {
  render() {
  let Image_Http_URL ={ uri: 'https://reactnativecode.com/wp-content/uploads/2017/05/react_thumb_install.png'};

 return (
 <View style={{elevation:10, justifyContent: 'center', flex:1, margin:10}}>
 <Image source={Image_Http_URL} style = {{height: 200, resizeMode : 'stretch', padding:5 }} />
 </View>
 );
  }
}

答案 1 :(得分:0)

检查2件事可能解决了问题

1:Internet权限已添加到android / app / src / main / AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />

2:互联网是否正在模拟器上运行?尝试签入模拟器的浏览器。