UNPKG

@react-firebase/firestore

Version:

Efficiently Render & mutate Firestore data in your react(or react-native) app.

51 lines (50 loc) 1.81 kB
import { DocumentSnapshot } from "@google-cloud/firestore"; export declare type OrNull<T> = T | null; export declare type PrimitiveType = number | boolean | string; export declare type FirestoreQuery = { path: OrNull<string>; where?: OrNull<{ field: string; operator: "<" | "<=" | "==" | ">" | ">=" | "array-contains"; value: any; }>; orderBy?: OrNull<{ field: string; type?: "desc" | "asc"; }[]>; limit?: OrNull<number>; startAt?: OrNull<PrimitiveType | PrimitiveType[] | DocumentSnapshot>; endAt?: OrNull<PrimitiveType | DocumentSnapshot>; startAfter?: OrNull<PrimitiveType | DocumentSnapshot>; endBefore?: OrNull<PrimitiveType | DocumentSnapshot>; }; export declare type FirestoreNodeValue = {} | number | boolean | string | null; export declare type FirestoreProviderState = { firebase: any; firestore: firebase.firestore.Firestore; dataTree: { [path: string]: { isLoading: boolean; value: FirestoreNodeValue[]; unsub: () => void; }; }; listenTo: (query: FirestoreQuery, documentOrCollection: "document" | "collection") => void; stopListeningTo: (path: string) => void; }; export declare type FirestoreContextConsumerWithLifeCycleProps = {} & FirestoreProviderState & FirestoreQuery; export declare type FirestoreNodeValueContainer = { val: () => FirestoreNodeValue; }; export interface InitializeAppArgs { authDomain: string; apiKey: string; databaseURL: string; firebase: any; projectId: string; messagingSenderId?: string; storageBucket?: string; appId?: string; measurementId?: string; } export declare type FirestoreProviderProps = InitializeAppArgs;