- Setting up the Environment
- Install node
- Install the
expo-clinpm install -g expo-cli - Initialize the project
Select first option under the Managed Workflow
expo init Firebase-Project --npmblankcd Firebase-Project npm start - Fix the
babel-preset-expoissue Runnpm install babel-preset-expo --save - Add the Firebase SDK
expo install firebase - Install the Firebase Command Line Tools
npm i -g firebase-tools - Login to Firebase account
firebase login - Create new Firebase project
firebase init- Select
◯ Database: Deploy Firebase Realtime Database Rules - Select
Create a new project - Specify a unique project id
react-native-firebase-<random 5 characters> - Name your project as
React-Native-Firebase - Use
database.rules.jsonas the file for database rules
- Select
- Add Firebase to the app
- Go to the firebase console
- Go to
React-Native-Firebase - Go to
Project Settings - Add a web application
- Give a nickname to the application
- Click on
Register app - Copy the Firebase Configuration script
var firebaseConfig = { apiKey: <API Key>, authDomain: "<Project ID>.firebaseapp.com", databaseURL: "https://<Project ID>.firebaseio.com", projectId: <Project ID>, storageBucket: "<Project ID>.appspot.com", messagingSenderId: <Messaging Sender ID>, appId: <App ID> }; // Initialize Firebase firebase.initializeApp(firebaseConfig);
- Install React Navigation
npm install @react-navigation/native @react-navigation/stack - Install dependencies with
expoexpo install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view - Import React Native Gesture Handler
Add the following import statement to App.js
import 'react-native-gesture-handler' - Import
NavigationContainerandcreateStackNavigatorAdd the following import statements to App.jsimport { NavigationContainer } from '@react-navigation/native' import { createStackNavigator } from '@react-navigation/stack' - Initialize Firebase Database
firebase init database - Deploy Firebase Rules
firebase deploy --only database