Skip to content

Surangaup/firebase-react-native-sample

 
 

Repository files navigation

Firebase React Native App

Logo

7/6/16 - Updated to 3.1.0 of the Firebase SDK

With the new 3.1.0 SDK, Firebase Database and Firebase Auth, now work with React Native. Rather than use new Firebase(url) like with the old SDK, you now configure firebase with firebase.initializeApp(config), and use the new firebase.database().ref() method.

const React = require("react-native");
const firebase = require("firebase");

// Initialize Firebase
const firebaseConfig = {
  apiKey: "<YOUR-API-KEY>",
  authDomain: "<YOUR-AUTH-DOMAIN>",
  databaseURL: "<YOUR-DATABASE-URL>",
  storageBucket: "",
};
firebase.initializeApp(firebaseConfig);

// Create a reference with .ref() instead of new Firebase(url)
const rootRef = firebase.database().ref();
const itemsRef = rootRef.child('items');

About

Using React Native with Firebase

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 47.5%
  • Objective-C 31.7%
  • Python 11.8%
  • Java 9.0%