TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Elavarasan R
163
11.4k
638.6k
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
**databse/firebaseDb.js**
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"
};
firebase.initializeApp(firebaseConfig);
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 {
storeData(){
console.log("Level started")
firebase.firestore()
.collection('Users')
.add({
name: 'Ada Lovelace',
age: 30,
})
.then(() => {
console.log('User added!');
});
}
render(){
return(
<View>
<TouchableHighlight style={[styles.buttonContainer, styles.loginButton]} onPress={ () => this.storeData()}>
<Text style={styles.loginText}>Store</Text>
</TouchableHighlight>
</View>
)
}
}
Expected: I want to write data to firestore.
Reply
Answers (
0
)
How to implemente mask behavior in xamarin
Button text is always show in uppercase xamarin forms