RN图像:通过网络(来自doc)的远程图像渲染不起作用

时间:2019-06-30 18:43:02

标签: react-native

如RN的document(0.60.RC。仅显示相关部分)所述,在RN中用Image渲染网络图像似乎很简单:

export default class DisplayAnImage extends Component {
  render() {
    return (
      <View>
        <Image
          style={{width: 50, height: 50}}
          source={{uri: 'https://facebook.github.io/react-native/docs/assets/favicon.png'}}
        />
      </View>
    );
  }
}

https://facebook.github.io/react-native/docs/assets/favicon.png在浏览器中显示为:

enter image description here

我测试了渲染代码,但没有用:

render() {
      return ( 
        <View>
          <View>
            <Image
              style={{width:200, height:200}}
              source={{uri:'https://facebook.github.io/react-native/docs/assets/favicon.png'}}
            />
          </View>
        </View>         
      );
    }

}

屏幕上没有任何显示。 uri链接已经过测试,可以正常工作和加载。 uri语法正确。这里缺少什么?

0 个答案:

没有答案
相关问题