简体   繁体   中英

React Native and using npm modules

So this is the case: we developed a web application. Now we are developing an app in React Native with Firebase, for iOS and Android... Is there a way to make use of the npm private module that we developed for the web application? Do we need to initialise firebase/app as well in typescript? Or is it really needed to develop a seperate module for android and a separate module for iOS?

So in this npm private module there are standardized ways for our company to get and set data in firestore.

Regards, Peter

As far as I understand it, every package from npm is mapped or linked to one in the respective operating system, that is Android and iOS in your case.

Is there a way to make use of the npm private module that we developed for the web application? Or is it really needed to develop a seperate module for android and a separate module for iOS?

When there is no respective implementation for the operating system, that "translates" your npm package, it will not work.

Do we need to initialise firebase/app as well in typescript?

Yes indeed, also in react native you need to initialise firebase app.

So in this npm private module there are standardised ways for our company to get and set data in firestore.

I cannot say why you did this in a custom way, if you use the "normal" firestore methods then maybe there is still a way to reuse some code? But that is hard to say from the outside.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM