2017-06-07 11 views
0

私はすべてのユーザーの友達のプロフィール写真を取得してリストビューで表示しようとしています。ユーザーのお友達のプロフィール画像を取得するReact-native

私はこのグラフ要求を持つアプリケーションにあるすべてのユーザの友人を得る:私はこの機能

`renderFriends() { 
     if(this.state.user != null) { 
     return this.state.user.friends.data.map(friend => 
      <View> 
      <Image 
       source={{uri:'https://graph.facebook.com/{friend.id}/picture? 
         type=large'}} 
       style={styles.profilePicture} 
      /> 
      <Text key={friend.id} >{friend.name}</Text> 
      </View> 
     ) 
     } 
    }` 

と彼の友人のプロフィール画像をレンダリングするすべての名前をしようとしている、そして、

`const infoRequest = new GraphRequest(
     '/me', 
     { 
      parameters: { 
       fields: { 
         string: 'email, name, first_name, middle_name, 
       last_name, picture.type(large), cover, birthday, location, friends' 
        } 
       } 
      }, 
      this._responseInfoCallback 
     );` 

をイメージはレンダリングされません。

あなたは下の画像のスタイルをチェックすることができます。

{{ uri: 'https://graph.facebook.com/' + friend.id + '/picture?type=large' }} 

{friend.id}は友人IDに置き換えません、それは

{{ uri: 'https://graph.facebook.com/{friend.id}/picture?type=large' }} 

では

`profilePicture: { 
    height: 120, 
    width: 120, 
    borderRadius: 60, 
    marginTop: height/15, 
    },` 

答えて

1

変更をリテラル文字列{friend.id}と解釈され、間違ったURLが返されます。

関連する問題