I’m using react native and have firestore structured like this. and i want access the geopoint latitude and longitude. how do i do that? sorry i’m still newbie
users:[{
name:""
geo_point:[latitude, longitutde]
},
{
name:""
geo_point:[latitude, longitutde]
}]i’m getting error with this code
{this.state.users.map((user, idx) => <Marker
key={idx}
coordinate={{latitude: user.geo_point[0], longitude: user.geo_point[1]}}
>Advertisement
Answer
Firestore GeoPoint is not an array; it’s an object
you can access the lat & long using their field names, like below
coordinate={{latitude: user.geo_point.latitude, longitude: user.geo_point.longitude}}