Firebase authentication with realtime database. I have used stackNavigation,DrawerNavigator,SwitchNavigator, custom loader name SmartLoader and CustomDialog with action to demonstrate that how to use them.
First step will be to head over to Firebase and create a free account.After that, head over to Authentication and enable the Email/Password provider by clicking it and switching on the toggle.
Next step will be adding firebase to our project, I use yarn but you can use npm as well if you don’t have those.(i assume that you have already created the project using react-native init your_project_name)
yarn add firebase
Now we need to tell the firebase library: when you boot up, we need to connect to my firebase bucket of data, we do this by initializing the library with our WEB SETUP config and keys from our firebase console. (The button will be at the top right of your firebase console).
The config code should look something like this:
This is built for a web environment, so we’ll need to convert it to pure JS to work with RN and add it to a react-native app.js file.
// Initialize Firebase
var config = {
apiKey: "YourKey",
authDomain: "fir-authentication-Your Domain",
databaseURL: "Your db url",
projectId: "Your Project ID",
storageBucket: "Your bucket ",
messagingSenderId: " Your sender id "
};
Firebase.initializeApp(config);
add this import statement :
import Firebase from "firebase";
to your app.js
I will update more code explantation soon.