Comments (14)
I ran into this problem. Basically all the new firestore stuff is separate from firebase itself, so you have to import it differently:
import * as firebase from "firebase";
require("firebase/firestore");
Firestore should be defined after that.
from geofirestore-js.
@ebouJ 1.2.0 was published last night where if you're using Firebase 5, you should be all good
from geofirestore-js.
@Nexuist you don't happen to have a sample report do you?
from geofirestore-js.
A sample report? I'm not sure what that is, but I can try to get one if you clarify.
from geofirestore-js.
Sorry, haha, I meant repo!!!!
from geofirestore-js.
I don't have a repo but here's a simple full blown example:
import React, { Component } from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { Constants, MapView, Permissions, Location } from 'expo';
import * as firebase from "firebase";
require("firebase/firestore");
import { GeoFirestore } from "geofirestore";
// Fill in as appropriate
const FirebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: ""
};
export default class App extends Component {
state = {
region: { latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421 }
}
async componentWillMount() {
firebase.initializeApp(FirebaseConfig);
// Avoid deprecation warning
firebase.firestore().settings({
timestampsInSnapshots: true
});
// Get the user's location
let { status } = await Permissions.askAsync(Permissions.LOCATION);
let location = await Location.getCurrentPositionAsync({});
this.setState({
region: {
latitude: location.coords.latitude,
longitude: location.coords.longitude,
latitudeDelta: 0.01,
longitudeDelta: 0.01
}
});
// Just a simple collection with one or two premade items
const locationsRef = firebase.firestore().collection("locations");
const geoFirestore = new GeoFirestore(locationsRef);
const query = geoFirestore.query({
center: [this.state.region.latitude, this.state.region.longitude],
radius: 1
});
query.on("ready", () => this.setState({ loading: false }));
query.on("key_entered", (key, coords, distance) => {
console.log(key);
});
}
render() {
return (
<MapView
ref={map => (this._mapView = map)}
style={styles.map}
showsUserLocation={true}
showsPointsOfInterest={false}
followsUserLocation={true}
provider="google"
region={this.state.region}
></MapView>
);
}
}
const styles = StyleSheet.create({
map: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
}
});
Interestingly the error seems to have changed a little:
Here's the error I get if I don't change those firestore settings:
Hope this helps.
Andi
from geofirestore-js.
help me !! new Geofirestore undefied
from geofirestore-js.
Unfortunately I'm not going to be able to jump on this at the moment. I'm prioritizing the support for custom data in version 2.0.0. Anyhoo, I will be looking into this come v2, and will probably be supporting different build typed (like for react native).
However I would appreciate if anyone could throw together a sample repository so I can take a look at and tinker with it as I get to this (hopefully come early June).
from geofirestore-js.
So this seems to be an issue with firebase
5.x.x. Which while "supported," I didn't take into account such a change to firestore
. Anyway, based on feedback by @Nexuist this issue will be resolved in v1.2.0 as well as v2.0.0.
Yes v2.0.0 is coming and will be a drastic change, more along the lines of what you all wanted from geofire
and version 1 of geofirestore
...
from geofirestore-js.
@MichaelSolati what's the status of this issue. I want to use it on my React native app.
from geofirestore-js.
So does geofirestore support react native ?
from geofirestore-js.
@patpune I don't officially support it, however when someone reports an issue where I see that I can make a simple or easy fix to support it, I will. there was an issue opened about a month or two ago which I was able to resolve and that RNF user said things were working well after that.
from geofirestore-js.
@MichaelSolati - Thanks - appreciate your response and outstanding work on this. I think this would merge to be the only one for ReactNative. I wonder why you say "I don't officially support it".
from geofirestore-js.
I don't write tests around it being the big reason, and I've also had difficulty in the past trying to set up my Mac to run/build for my phones (I don't know why, other native stuff works fine). Finally, for the interfaces/typings I require the official Firebase libraries as dependencies, I don't plan/intend on adding extra dependencies for non-official Firebase libraries/typings.
from geofirestore-js.
Related Issues (20)
- Paginating data after fetched HOT 1
- Question - how can I find near documents with each unique radius? HOT 11
- How to write to firestore after geofirestore query HOT 1
- can't write to firestore properly after geofirestore query HOT 1
- StartAt or startAfter support HOT 1
- Query speed HOT 6
- Custom document key HOT 1
- Geoqueries with additional queries? HOT 3
- When querying `near`: `distance` prop is missing when distance is 0 HOT 1
- Support for Firebase JS SDK 9 HOT 9
- customKey not working on read HOT 10
- Pass a custom document ID HOT 1
- Query returning zero results when filtering with where HOT 8
- Support for new firestore 9.x? HOT 1
- runTransaction on a collection (server-side using cloud functions) HOT 1
- firebase geofirestore v9 not working HOT 1
- Bug double removed on a marker HOT 1
- Geofirestore and onSnapshot are giving delayed events - information is not updating properly
- Unsubscribe from GeoQuery.onSnapshot on document deletion HOT 1
- Typescript errors when trying to deploy function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geofirestore-js.