1

Good day, I'm trying to use rxfire to combine multiple Firebase data sources, The code below should stream a list of "cities" from Realtime database and then retrieves their image from a Cloud Storage bucket. I'm following through the official docs but using realtime database. Im getting an error while using rxfire object method

import database from '@react-native-firebase/database';
import { object } from 'rxfire/database/';
import { combineLatest, map, switchMap } from "rxjs"; --> imports section

   export const fetchUserContacts = () => async (dispatch: (arg0: { type: any; payload: any; 
   }) => void) => {

        const ref = database().ref("cities");

        object(ref)  --> compilation error here
         .pipe(
         switchMap(cities => {
           return combineLatest(...cities.map(c => {
             const ref = ref(storage, `/cities/${c.id}.png`);
            return getDownloadURL(ref).pipe(map(imageURL => ({ imageURL, ...c })));
           }));
         })
       )
       .subscribe(cities => {
         cities.forEach(c => console.log(c.imageURL));
       });
  };

 

Compilation error that I'm getting

Argument of type 'Reference' is not assignable to parameter of type 'Query'. The types of 'ref.isEqual' are incompatible between these types. Type '(other: Query) => boolean' is not assignable to type '(other: Query | null) => boolean'. Types of parameters 'other' and 'other' are incompatible. Type 'Query | null' is not assignable to type 'Query'. Type 'null' is not assignable to type 'Query'.ts(2345) const ref: FirebaseDatabaseTypes.Reference

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

0 Answers0