Skip to content
Snippets Groups Projects
Commit 6547c89f authored by isaacwsolomon's avatar isaacwsolomon
Browse files

Connected to firebase database

parent ae214a12
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { addDoc, collection } from 'firebase/firestore';
import React, { useEffect } from 'react';
import { View, Text, Button } from 'react-native';
import { FIRESTORE_DB } from '../../firebaseConfig';
const List = ({navigation} : any) => {
useEffect(() => {}, []);
const addTodo = async () => {
console.log('ADD');
const doc = addDoc(collection(FIRESTORE_DB, 'todos'), { title: 'I am a test', done: false });
console.log('📝 ~ file: List.tsx:12 ~ addTodo ~ doc:', doc);
};
return (
<View>
<Text>List</Text>
<Button onPress={() => navigation.navigate('Details')} title="Open Details"/>
<Button onPress={() => addTodo()} title="Add Todo" />
</View>
);
};
}
export default List;
\ No newline at end of file
......@@ -22,4 +22,4 @@ const firebaseConfig = {
export const FIREBASE_APP = initializeApp(firebaseConfig);
export const FIRESTORE_DB = getFirestore(FIREBASE_APP);
export const FIREBASE_AUTH = getAuth(FIREBASE_APP);
\ No newline at end of file
//export const FIREBASE_AUTH = getAuth(FIREBASE_APP);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment