0

Im using a flatlist in react native and my listitem is as follows:

    <ListItem
      roundAvatar
      title={item.name}
      subtitle={item.vicinity}
      avatar={{
        uri:
          'https://lh3.googleusercontent.com/p/AF1QipNePpAvxLPZRcL9TbdEu_iX6XL6TZYkav7iPAYz=s1600-w400',
      }}
      containerStyle={{ borderBottomWidth: 0 }}
      onPress={() => console.log('item: ', item)}
    />

My item variable represents the object(s) returned from a call to the Google Places API.
As you can see Ive put in a dummy value for the uri prop...but what I really want is the uri of the image belonging to that particular place pulled from Places api.

I know i need to call the Photos api with the photos.photo_reference value from Places api.....however how do I fetch the image uri and submit it as the value for my uri prop? Perhaps I should use a function for the uri prop that returns the image uri from Photos api?....documentation doesnt tell you how to get uri though.

Hope this makes sence! Thanks

james murphy
  • 1,505
  • 5
  • 31
  • 57
  • I think you just have to use uri in the form `https://maps.googleapis.com/maps/api/place/photo?parameters` as shown [here](https://developers.google.com/places/web-service/photos) – Milore Feb 06 '19 at 08:25
  • 1
    Youre right that worked....thanks so much – james murphy Feb 10 '19 at 00:23

0 Answers0