I am currently trying to connect Firebase to React Native and am following this guide : https://blog.jscrambler.com/create-a-react-native-image-recognition-app-with-google-vision-api/
The guide has me making a file called firebase.js which looks like this
import Environment from './environment'import * as firebase from 'firebase';firebase.initializeApp({ apiKey: Environment['FIREBASE_API_KEY'], authDomain: Environment['FIREBASE_AUTH_DOMAIN'], databaseURL: Environment['FIREBASE_DATABASE_URL'], projectId: Environment['FIREBASE_PROJECT_ID'], storageBucket: Environment['FIREBASE_STORAGE_BUCKET'], messagingSenderId: Environment['FIREBASE_MESSAGING_SENDER_ID']});export default firebase;
There is a line in uploadImageAsync which looks like this
const ref = firebase .storage() .ref() .child(uuid.v4());
For me, .storage is underlined and when I hover over it I get this error:
Property 'storage' does not exist on type 'typeof import("/Users/User/Documents/GitHub/MyApp/node_modules/firebase/index")'.ts(2339)
If I import firebase like so import firebase from 'firebase';
, the error disappears, but when imported as import firebase from './config/firebase';
, it comes back.
I assume I am not okay to simply import the first way, so how do I resolve this?
Note: The guide is in Javascript but I am using Typescript