Skip to content

KattyaCuevas/react-native-firebase-workshop

Repository files navigation

React Native + Firebase workshop

Before start the workshop

  • Install yarn
$ brew install yarn
  • Clone this repo, and install the dependencies:
$ yarn
  • Install expo-cli globally
$ yarn global add expo-cli
$ yarn start
  • Scan the QR code to open the expo app.

Note: Your mobile device should be on the same network as your computer.

Instructions

The content of each exercise is inside the /exercises folder. To test each one, you should import the exercise you want to do in App.js. Also, the solution of each exercise is inside /solutions folder.

Develop the project from zero

Init the expo project

  • To create an application called PostApp in this case, you have to run:
$ expo init PostApp
  • Choose an empty template and name it PostApp.

Create a database in Firebase

Follow Firebase official guides

Or made this quick guide:

  • In the Firebase console, click Add project with the project name PostApp. The project ID and analytics account are optional.
  • Then, add a web app with the project name PostApp Web and copy the firebaseConfig variable.
  • Go to the Cloud Firestore tab, and click on the Create database button. Check Start in test mode. Select the default region and Done.
  • Create a new collection, called Posts with the following attributes:
title -> string
body -> string
createdAt -> timestamp
author -> string

Config your application to connect with firebase

  • Add firebase dependency:
$ yarn add firebase
  • Create a file with firebase configuration:
$ touch firebase.js
import * as firebase from "firebase";
import "firebase/firestore";

const firebaseConfig = {
  // YOUR CREDENTIALS HERE
};

if (firebase.apps.length === 0) {
  firebase.initializeApp(firebaseConfig);
}

export default firebase.firestore();

And now you could do the exercises written in this workshop.

About

Building Mobile Apps with React Native and Firebase

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published