【问题标题】:React native image from Parse从 Parse 反应原生图像
【发布时间】:2015-07-23 21:28:09
【问题描述】:

我正在尝试将图像从 Parse 添加到 React Native Project。 添加文本一切正常:

<Text style={{flex: 1, fontSize: 14, textAlign: 'justify', color: 'black', }}>
     {this.props.tweet.get('username')}
</Text>

但我无法添加图片:

<Image  source={this.props.tweet.get('photo')}
style={{width: 50, height: 50}}/>

我也在尝试

var photo = this.props.tweet.get('photoprofile');
....code
  <Image  source={{uri: {photo}}}
   style={{width: 50, height: 50}}/>

var photo = this.props.tweet.get('photoprofile');
....code
<Image  source={photo}
   style={{width: 50, height: 50}}/>

它不起作用。

【问题讨论】:

  • 你应该提到你正在处理的对象的原型。并且使用正确的图像 url 在源中添加 uri 将起作用。

标签: image parse-platform add react-native


【解决方案1】:

一切正常!!!

var imageFile = this.props.tweet.get('photoprofile');
var imageURL = imageFile.url();  
...code
<Image  source=  {{uri: imageURL}}
              style={{width: 50, height: 50}} />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-27
    • 2018-05-04
    • 2016-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多