I am trying to use Geofire in React Native. I have read through all the guides and documentation and YouTube tutorials that I can find (like, all three of them) and there just isn't any information. All I need are the very basics.
Step 1) Do I need to install any packages? One guide said to use:
npm install --save react-native-geofire
This is the only guide that even tried to be useful, but this package doesn't exist.
Step 2) The import statement. One guide said to use:
import RNGeofire from 'react-native-geofire';
But this doesn't look right, and I cannot verify because it may be not working because the package will not install.
Step 3) Usage. I am trying:
itemUserRef = firebase.database().ref().child("Users").child(firebaseUserID);
geoFire = new geoFire(itemUserRef);
As a quick example. But it can't recognise the code, probably because my import statement is wrong, and probably because there is no package to install.
So, what are these three very basic steps to get started with this? Is this even a thing any more? I feel like it must be a thing.
In your code you're trying to call an instance of geoFire
which has not been installed and imported
Therefore you can install geofire-js
library, whose client is for JS
Installation - yarn add geofire
Usage
import geofire from 'geofire';
const firebaseApp = initializeApp({
apiKey: config.API_KEY,
authDomain: config.AUTH_DOMAIN,
databaseURL: config.DATABASE_URL,
storageBucket: config.STORAGE_BUCKET
})
const geofireRef = new geofire(firebaseApp.database().ref())