I have the Firebase Emulator running locally. I am trying to connect Firebase Emulator with the iPhone app written in React Native.
Following is the code snippet:
import firestore from '@react-native-firebase/firestore'
const App = () => {
const db = firestore();
db.settings({host: 'localhost:8080', ssl: false});
const collectionRef = firestore().collection('test');
const userDocument = collectionRef
.doc()
.set({
name: 'John',
})
.catch(function (error) {
console.log('Errror:', error);
});
return (
<View>
<Text>Testing
</Text>
</View>
);
};
When I run the code I get the following error.
Error: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp()
But the Firebase documentation does not mention initializeApp.
I'm not sure what is missing, I appreciate your help. I'm new to React Native, and I'm sure others will have this question in the future.