1// Using npm
2npm install --save @react-native-firebase/app
3
4# create your firebase android project and follow the steps for implementations.
5# check: https://rnfirebase.io/#generating-android-credentials
6
7
8
9
1import { firebase } from "@firebase/app";
2//import modules
3import "@firebase/auth";
4
5const firebaseConfig = {
6 apiKey: "",
7 authDomain: "",
8 projectId: "",
9 storageBucket: "",
10 messagingSenderId: "",
11 appId: "",
12};
13
14//Delete that after realisation of authContext !!
15if (!firebase.apps.length) {
16 firebase.initializeApp(firebaseConfig);
17}
18
19
20//Auth with email and password
21//Put into export App
22const [isAuthenticated, setIsAuthenticated] = useState(false);
23
24 useEffect(() => {
25 firebase
26 .auth()
27 .signInWithEmailAndPassword("email@email.com", "password")
28 .then((user) => {
29 console.log(user);
30 setIsAuthenticated(true);
31 })
32 .catch((e) => {
33 console.log(e);
34 });
35 }, []);
1/* Answer to: "react native firebase" */
2
3/*
4 React Native Firebase is the officially recommended collection
5 of packages that brings React Native support for all Firebase
6 services on both Android and iOS apps.
7*/
1apply plugin: 'com.android.application'
2apply plugin: 'com.google.gms.google-services' // <- Add this line
3