lmcq / firebase-firestorm

Firebase Firestorm is an ORM for Firestore which can be used with Typescript.
MIT License
252 stars 19 forks source link

Does this work with react native? #22

Open jesster2k10 opened 4 years ago

jesster2k10 commented 4 years ago

Hey, i’m looking to use this library’s it’s the rnfirebase.io library, i’m not sure if this works with it tho. I really hope so because this is exactly the type of library i’m looking for!

SpaghettiC0des commented 4 years ago

It does not work, I'm trying it now.

  1. There's a warning on the initialize method type. So I need to patch it using patch-package.
diff --git a/node_modules/firebase-firestorm/lib/store.d.ts b/node_modules/firebase-firestorm/lib/store.d.ts
index 426b4f1..1ab573c 100644
--- a/node_modules/firebase-firestorm/lib/store.d.ts
+++ b/node_modules/firebase-firestorm/lib/store.d.ts
@@ -1,11 +1,12 @@
 import * as firebase from 'firebase/app';
 import { IFireormConfig, IStore, IRepository } from './types';
+import { FirebaseFirestoreTypes } from '@react-native-firebase/firestore';
 /**
  * Initializes firestorm with an instance of firestore.
  * @param firestore A firestore instance.
  * @param config Configuration options for firestorm.
  */
-export declare const initialize: (firestore: firebase.firestore.Firestore, config?: IFireormConfig | undefined) => void;
+export declare const initialize: (firestore: FirebaseFirestoreTypes.Module, config?: IFireormConfig | undefined) => void;
 /**
  * Resets the store
  */
  1. Experimental decorator error

I've installed @babel/plugin-proposal-decorators

Then on babel.config.js

"plugins": [
        ["@babel/plugin-proposal-decorators", { "legacy": true }]
]