Skip to content

v3.0.1

Compare
Choose a tag to compare
@Salakar Salakar released this 07 Oct 00:03

v3.0.1 CHANGE LOG

Setup

react-native link is now supported, which means the following:

  • [ios] You can choose not to have React, Yoga, react-native-firebase, etc installed as pods. You do still need to have the Firebase SDKs installed as Pods as recommended by Google.
  • [android] A couple of the manual steps are now automated for you

Check out the new installation guides:

Utils

We've added a new module to contain everything non-firebase specific, things that relate to the library (such as configuration) or using firebase on react native and misc debug helpers.

Accessing the new module can be done via firebase.utils().X or firebase.utils.X for statics.

Play Services

  • [android] Google Play Services checks and utils added. By default an error or warning that looks like these will now display if your android device has a Play Services issue. You can configure this using the api/methods below. @Salakar
  • firebase.utils().playServicesAvailability returns an object of type GoogleApiAvailabilityType @Salakar
  • setter firebase.utils().errorOnMissingPlayServices set to true or false. Defaults to true, with this enabled a red box Play Services error will appear if the device you're developing your android app on has failed the Play Services checks. You should set this to false in your prod app and handle Play Services checks yourself using the provided apis on utils(). @Salakar
  • setter firebase.utils().promptOnMissingPlayServices set to true or false. Defaults to true, with this enabled if a Play Services issue is detected it will automatically attempt to prompt you on screen to update the Play Services app (i.e update dialog with update button) or whatever the possible resolution is. Set to false to disable. @Salakar
  • various methods to handle manual Play Services checks for your end users: promptForPlayServices(), resolutionForPlayServices(), makePlayServicesAvailable() @Salakar

The old docs for Google Play Services api's can be found here - they generally still stand except for the api now being as above.

See https://github.com/invertase/react-native-firebase/blob/master/lib/modules/utils/index.js for any other undocumented methods.

iOS

Database

Firestore

Misc

  • added missing new app function typings - @bm-software 62ab50e
  • lots of documentation updates, won't go into the details, mostly improvements on the install process / react native link support etc - @chrisbianca @Ehesp @Salakar

A note on docs

We're aware there's a lot of missing docs on the current site and this something we're actively working on improving. We have a brand new work in progress site, it has guides, full api references and more, let us know your thoughts (on discord): https://invertase-default.firebaseapp.com/docs/v3.0.*/getting-started - this is a temporary url. If you'd like to get involved and contribute to the site then please let us know (also on discord).


v3 change log added below for completeness.


v3.0.0 CHANGE LOG.

This release is mainly aimed at adding firebase 'core' functionality, adding phone auth functionality and also a first pass at Cloud Firestore support. There's also been further adjustments to bring the modules in line with the web sdk api. Additionally there's been a lot of internal code improvements aimed at performance and improving QoL for module development.

Whilst every effort has been taken to document all breaking changes there may still be a chance that some undocumented breaking changes have snuck in as this was probably one of the largest releases to date code wise. 🙈 If you come across one then please let us know, we can document it.

Migration guide

See: http://invertase.link/v2-v3

Core

This release introduces full firebase core support. This means multiple firebase apps are now supported both in JS and native android/ios code (initialise additional apps on either end to have the app available in both automatically).

  • #f03c15 [breaking] new RNFirebase() is no longer supported. See below for information about app initialisation.
  • #f03c15 [deprecation] initializeApp() for apps that are already initialised natively (i.e. the default app initialised via google-services plist/json) will now log a deprecation warning.
    • As these apps are already initialised natively there's no need to call initializeApp in your JS code. For now, calling it will just return the app that's already internally initialised - in a future version this will throw an already initialized exception.
    • Accessing apps can now be done the same way as the web sdk, simply call firebase.app() to get the default app, or with the name of specific app as the first arg, e.g. const meow = firebase.app('catsApp'); to get a specific app.
  • FirebaseApp.extendApp(props: Object) support added.
  • RNFirebase no longer requires a singleton exported instance of your app to work (though you can still do this if you'd like). You can now just import RNFirebase in any module and straight away access all the initialised apps. e.g. :
import firebase from 'react-native-firebase';

// get started immediately with the default app for example
firebase.database().ref('kittens').once('value', (snapshot) => {
     console.log('kittenslol', snapshot.val());
});

// or get some other app
const dogsApp = firebase.apps('doge');

// then it's either:

// 1)
dogsApp.database().ref('puppies').once('value', (snapshot) => {
     console.log('muchwow', snapshot.val());
});

// 2) or this one
firebase.database(dogsApp).ref('puppies').once('value', (snapshot) => {
     console.log('muchwow', snapshot.val());
});

See the docs for the following (coming soon):

  • initialising additional apps via js
    • why js app initialisation is not supported for the default app
    • app.onReady(): Promise and why it's needed for JS initialised apps.
  • which firebase modules support multiple apps
  • delete app caveats - e.g cannot delete default apps, cannot delete apps on android, cannot get app config clientId on ios - see issue comments on firebase repo: firebase/firebase-ios-sdk#140 (comment)
  • firebase.SDK_VERSION
  • firebase.DEFAULT_APP_NAME

Auth

  • auth() now supports passing an instance of App as the first argument
  • Phone authentication via verifyPhoneNumber. See #119
  • #f03c15 [breaking] Third party providers now user providerId rather than provider as per the Web SDK. If you are manually creating your credentials, you will need to update the field name.

Firestore

Database

  • database() now supports passing an instance of App as the first argument
  • once now supports context as per the web sdk
  • remove now supports onComplete callbacks (and promises) as per the web sdk
  • update now supports onComplete callbacks (and promises) as per the web sdk
  • setWithPriority now supports onComplete callbacks (and promises) as per the web sdk
  • setPriority now supports onComplete callbacks (and promises) as per the web sdk
  • set now supports onComplete callbacks (and promises) as per the web sdk
  • keepSynced now correctly takes into account query modifiers natively, was ignoring these before
  • improved native transaction implementations to have better error handling and timeout checks (mainly for whilst running in dev)
    • [websdk-diff] the web sdk transaction errors return one worded errors that don't make much sense and have no error codes or description like all the other database errors do. RNFirebase internally maps these into the database error codes we're accustomed to, for example the one worder above comes back as The transaction was overridden by a subsequent set. (database/overridden-by-set) instead.
  • [ios] implemented missing onDisconnectUpdate method. See #272.
  • #f03c15 [breaking] error messages and codes internally re-written to match the web sdk
  • #f03c15 [breaking] ref.isEqual now checks the query modifiers as well as the ref path (was just path before). With the release of multi apps/core support this check now also includes whether the refs are for the same app.
  • #f03c15 [breaking] on/off behaviour changes. Previous off behaviour was incorrect. A SyncTree/Repo implementation was added to provide the correct behaviour you'd expect in the web sdk. Whilst this is a breaking change it shouldn't be much of an issue if you've previously setup your on/off handling correctly. See #160 for specifics of this change.
  • [internal] re-wrote native android & ios methods to now use RN promise implementation - was callbacks before with a callback to promise wrapper in JS
  • [js] ThenableReference support implemented, for now this is just for .push(). See #147.

Storage

  • storage() now supports passing an instance of App as the first argument
  • [ios] putFile now sets the remote file content/type automatically for images and videos (Android TODO)
  • #f03c15 [breaking] UploadTaskSnapshot -> downloadUrl renamed to downloadURL to match web sdk

Misc

  • We're now using Apache License 2.0 to license this library.
  • [internal] re-wrote event emitter / subscriptions logic to be more performant and to support multiple database/app instances. This is for events such as storage task events, database transaction/realtime events and authentication state changes.
  • QoL change: added more descriptive errors on incorrect setup of native modules, e.g:
    image
  • QoL change: added Groovy script to RNFirebase build.gradle to automatically detect duplicate dex build failures:
    image

Known Issues

As these aren't major issues we've decided that they shouldn't hold back the release of v3,

  • Currently no way to enable RNFirebase debug logging.
  • [android] no play store/play services version checks and associated methods.