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, you will need to make the following changes:
modular API
Modular 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'));
},
});
namespace API
No changes required for older namespace API.
