Migrating to v24
Migrate to React Native Firebase v24.
Firestore
Version 24 introduces withConverter functionality from Firebase JS SDK. Due to the differences in types between references and queries in namespace vs modular API, and the namespaced APIs deprecation cycle being effectively complete with the API set for removal, we have adopted the modular API typing in general for firestore APIs.
Reference and query types have been updated to support input of two generic types (AppModelType, DbModelType).
Additionally, to match the JS SDK, they are now exported separately at the root, instead of through FirebaseFirestoreTypes.
Most commonly these types will be affected: CollectionReference, DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot, Query.
// Previously
import { doc, getFirestore, onSnapshot, FirebaseFirestoreTypes } from '@react-native-firebase/firestore';
onSnapshot(doc(getFirestore(), 'foo', 'foo'), {
next: (snapshot: FirebaseFirestoreTypes.DocumentSnapshot) => {
console.log(snapshot.get('foo'));
},
});
// Now
import { doc, getFirestore, onSnapshot, DocumentSnapshot } from '@react-native-firebase/firestore';
onSnapshot(doc(getFirestore(), 'foo', 'foo'), {
next: (snapshot: DocumentSnapshot) => {
console.log(snapshot.get('foo'));
},
});
