Home > Mobile >  firestore Geopoints why could not call a class as a function error
firestore Geopoints why could not call a class as a function error

Time:10-28

I am using import @react-native-firebase/firestore Lib I want to insert into firestore database a location type geopoints the problem is that keeps firing error saying

Cannot call a class as a function

here's how I am calling the function and location is my firestore field :

location : firestore.GeoPoint(lat, long)

I have also tried to import separately firebase from :

import firebase from '@react-native-firebase/app'

and then :

location : firebase.firestore.GeoPoint(lat, long)

I still geting the same error , I have also tried with :

firebase.firestore.GeoPoint.latitude = lat ; 
...

it did not work , could you please help

CodePudding user response:

The error message says that firestore.GeoPoint is a class, and you are trying to call it as a function.

To create an instance of firestore.GeoPoint, do:

location : new firestore.GeoPoint(lat, long)
         //            
  • Related