Elavarasan R

Elavarasan R

  • 228
  • 10.9k
  • 418.5k

React Native: Can not wrrite data to firestore

Dec 31 2020 1:46 AM
I have created a simple react native screen. I want to store data to firestore I have tried [https://rnfirebase.io/firestore/usage#adding-documents] but no luck its does not show anything after clicking on the button. anyone can help me out?

Here my config file


    import firebase from '@firebase/app';
    import firestore from '@firebase/firestore';
    import "@firebase/database";
    var firebaseConfig = {
        apiKey: "AIzaSyBILojF4bmQ3DzX6PmhKghch16KpZNKjSo",
        authDomain: "newdemo-cf857.firebaseapp.com",
        projectId: "newdemo-cf857",
        storageBucket: "newdemo-cf857.appspot.com",
        messagingSenderId: "513964251080",
        appId: "1:513964251080:web:5f09f5fde2e7d5004152fd",
        measurementId: "G-WKW4XC0PCR"
    export default firebase;

Here the App.js

    import React, { Component } from 'react';
    import {StyleSheet,Text,View,TextInput,Button,TouchableHighlight,} from 'react-native';
    import firestore from '@react-native-firebase/firestore';
    import firebase from './database/firebaseDb';
    import "@firebase/database";
    export default class App extends Component {
        console.log("Level started")
            name: 'Ada Lovelace',
            age: 30,
        .then(() => {
          console.log('User added!');
       <TouchableHighlight style={[styles.buttonContainer, styles.loginButton]} onPress={ () => this.storeData()}>
              <Text style={styles.loginText}>Store</Text>

Expected: I want to write data to firestore.