Reputation: 1331
I am trying to use GeoFire in my React Native application to get the currently authenticated user's location and save this as a GeoLocation in the Firebase database. I can't find an actual example of working code to do this anywhere on the net.
This is what I am trying:
var firebaseRef = firebase.database().ref().child("Users");
var geofireUser = geofire(firebaseRef);
This is the error I am getting:
TypeError: Attempted to assign to readonly property.
I had this up and running fine in my Android Studio app, and the equivalent code above would create the following data in Firebase under the UID of the user:
DatabaseName:
-Users
-cdshnnHd8493jdNndi0
-g: fhejhe987
-l:
0: 0.324239
1: 12.4587493
I just need to get React Native to a point where I am creating that code in the database again and it will unlock the whole spectrum of GeoFire commands for me, but I just can't get it working and there are just no resources for any of this stuff.
Upvotes: 2
Views: 2834
Reputation: 1591
If you some difficulties with GeoFire
I propose you to use react-native-geolocation-service
package, which works as needed for both IOS and Android platforms
Upvotes: 1
Reputation: 598708
According to the Geofire documentation you create a new instance with:
// Create a GeoFire index
var geoFire = new GeoFire(firebaseRef);
In your snippet it looks like you're trying to redefine the geofire
module itself, hence the message.
Upvotes: 3