Closed kingtross88 closed 6 years ago
Looks like you forgot the .latitude in your first argument.
For everything else, we would need to see more of your code.
I'm sorry I wrote it out wrong. I should've just pasted from my code rather than type it over. I'm still getting the same error. I'm running the getCurrentPosition function in componentDidMount.
getCurrentPosition(){ navigator.geolocation.getCurrentPosition((position) => { region = { latitude: position.coords.latitude, longitude: position.coords.longitude, latitudeDelta: 0.00922, longitudeDelta: 0.00421, error: null, } this.setState({ region, }); }, (error) => this.setState({ error: error.message }), { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 },
);
}
then I run the following code in another function. var ref = firebase.firestore().collection('myCollection'); const geoFirestore = new GeoFirestore(this.ref); const geoQuery = geoFirestore.query({ center: new firebase.firestore.GeoPoint(this.state.region.latitude, this.state.region.longitude), radius: 10.5 });
Which version of firebase and geofirestore are you using?
geofirestore "version": "2.0.2" firebase "version": "4.13.1"
Try to update firebase to any version above 5.0.0, they changed docChanges into a method at that release, so it might be possible that the geofirestore code tries to access a variable that now is a function.
@MvRemmerden is absolutely correct, geofirestore
is designed for firebase
version5.x.x
. Try that and you should be all set.
@kingtross88 let me know if updating your firebase did the trick for you. If we don't hear back I'll be closing this in a day or so.
still working on getting this done. I did an update on my react native and now my project won't build. I'll get this sorted out today and let you know.
Thank you!
updated firebase and did a node update. closing this out
I keep getting the above error when I run a query. Can anyone point me in the right direction?
const geoQuery = geoFirestore.query({ center: new firebase.firestore.GeoPoint(this.state.region, this.state.region.longitude), radius: 10.5 });