'How to handle Cloud FireStore Triggers when migrating to react-native-firebase 6.x.x?

In my React Native project I'm migrating react-native-firebase from version 5 to version 6 using this guide. In the Specific Module Installation section it says to import the functions module using @react-native-firebase/functions and then to import them with import functions from '@react-native-firebase/functions';. However, when I try to update this code:

import * as functions from 'firebase-functions';
import { FeedModel } from '../../../models/feed.model';

export const onFeedCreate = functions.firestore
  .document('promos/{uid}')
  .onCreate( async (
    snapshot,
    context
  ) => {
    const promo = snapshot.data() as FeedModel;
    console.log(promo);
  });

by replacing the first line with @react-native-firebase/functions';, then the term firestore on the third line is underlined in red and says Property 'firestore' does not exist on type 'FirebaseModuleWithStaticsAndApp<Module, Statics>'.

How should I change my imports in order to run this function?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source