When I try to create a GeoPoint object in my app I get an error:
undefined is not a constructor (evaluating ‘new _Firebase.default.firestore.GeoPoint(_this.state.location.latitude, _this.state.location.longitude)’)
- src/components/PostModal.js:266:14 in
- node_modules/promise/setimmediate/core.js:37:14 in tryCallOne
- node_modules/promise/setimmediate/core.js:123:25 in
- … 8 more stack frames from framework internals
My code to create the object follows the documentation:
coordinate: new firebase.firestore.GeoPoint(
this.state.location.latitude,
this.state.location.longitude
),
My file to initialize firebase:
import * as firebase from 'firebase';
import 'firebase/firestore';
import 'firebase/storage';
import {
API_KEY,
AUTH_DOMAIN,
DATABASE_URL,
PROJECT_ID,
MESSAGE_SENDER_ID,
APP_ID,
STORAGE_BUCKET
} from 'react-native-dotenv'
const firebaseConfig = {
apiKey: API_KEY,
authDomain: AUTH_DOMAIN,
databaseURL: DATABASE_URL,
projectId: PROJECT_ID,
storageBucket: STORAGE_BUCKET,
messagingSenderId: MESSAGE_SENDER_ID,
appId: APP_ID
}
// Initialize Firebase
let Firebase = firebase.initializeApp(firebaseConfig)
export default Firebase
I can’t figure out what I am doing wrong. I’m able to use firestore and successfully store data to firestore. Any help would be greatly appreciated.