diff --git a/README.md b/README.md index a694c1fc..c4297a24 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,52 @@ -# React Native Firebase - -RNFirebase makes using the latest [Firebase](http://firebase.com) with React Native straight-forward. - -``` -npm i react-native-firebase --save -``` +# React Native Firebase [![Gitter](https://badges.gitter.im/invertase/react-native-firebase.svg)](https://gitter.im/invertase/react-native-firebase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![npm version](https://img.shields.io/npm/v/react-native-firebase.svg)](https://www.npmjs.com/package/react-native-firebase) [![License](https://img.shields.io/npm/l/react-native-firebase.svg)](/LICENSE) +**RNFirebase** makes using [Firebase](http://firebase.com) with React Native simple. +
+ +### Install +``` +npm i react-native-firebase --save +``` + +#### Platform specific setup guides: +[![ios](https://a.fsdn.com/sd/topics/ios_64.png)](docs/installation.ios.md) [![android](https://a.fsdn.com/sd/topics/android_64.png)](docs/installation.android.md) + +
+ +### Why + RNFirebase is a _light-weight_ layer sitting on-top of the native Firebase libraries for both iOS and Android which mirrors the Firebase Web SDK as closely as possible. -## RNFirebase vs Firebase Web SDK +Although the [Firebase Web SDK](https://www.npmjs.com/package/firebase) library will work with React Native, it is mainly built for the web. -Although the [Firebase Web SDK](https://www.npmjs.com/package/firebase) library will work with React Native, it is built for the web. +RNFirebase provides a JavaScript bridge to the native Firebase SDKs for both iOS and Android. Firebase will run on the native thread, allowing the rest of your app to run on the [JS thread](https://facebook.github.io/react-native/docs/performance.html#javascript-frame-rate). The Firebase Web SDK also runs on the JS thread, therefore potentially affecting the frame rate causing jank with animations, touch events etc. All in all, RNFirebase provides much faster performance (~2x) over the web SDK. -RNFirebase provides a JavaScript bridge to the native Firebase SDKs for both iOS and Android. The Firebase processes will run on the native thread, allowing the rest of your app to run on the [JS thread](https://facebook.github.io/react-native/docs/performance.html#javascript-frame-rate). The Firebase Web SDK also runs on the JS thread, therefore potentially affecting the frame rate causing jank with animations, touch events etc. All in, RNFirebase provides much faster performance (~2x) over the web SDK. +The native SDKs also allow us to hook into device sdk's which are not possible with the web SDK, for example crash reporting, offline realtime database support, analyics and more! -The native SDKs also allow us to hook into device events which are not possible with the web SDK, for example crash reporting, offline realtime database support, analyics and more! +
-## Test app +### Test app To help ensure changes and features work across both iOS & Android, we've developed an app specifically to test `react-native-firebase` against the [`firebase` web SDK](https://www.npmjs.com/package/firebase). Please see the [`react-native-firebase-tests`](https://github.com/invertase/react-native-firebase-tests) repository for more information. -## Examples app +
+ +### Examples app There's currently a work in progress [examples app](https://github.com/invertase/react-native-firebase-examples) which aims to demonstrate various real world use-case scenarios with React Native & Firebase. We welcome any new examples or updates to existing ones. -## Documentation +
+ +### Documentation RNFirebase aims to replicate the Firebase Web SDK as closely as possible. Because of this, the documentation focuses around the installation, differences & best practices of this library. Please see the [Firebase Web SDK](https://firebase.google.com/docs/reference/js/) documentation for Firebase functionality. > If you find any discrepancies between the two libraries, please raise an issue or PR. -* Installation - * [iOS](docs/installation.ios.md) - * [Android](docs/installation.android.md) * [Firebase Setup](docs/firebase-setup.md) * API * [Authentication](docs/api/authentication.md) @@ -46,12 +56,18 @@ RNFirebase aims to replicate the Firebase Web SDK as closely as possible. Becaus * [Messaging](docs/api/cloud-messaging.md) * [Crash](docs/api/crash.md) -## Contributing +
+ +### Contributing We welcome any contribution to the repository. Please ensure your changes to the JavaScript code follow the styling guides controlled by ESlint. Changes to native code should be kept clean and follow the standard of existing code. Changes to existing code should ensure all relevant tests on the test app pass. Any new features should have new tests created and ensure all existing tests pass. -## License +**Project board:** https://github.com/invertase/react-native-firebase/projects + +
+ +### License - MIT diff --git a/React-Native-Firebase.svg b/React-Native-Firebase.svg new file mode 100644 index 00000000..685431f9 --- /dev/null +++ b/React-Native-Firebase.svg @@ -0,0 +1 @@ +Slice 1 \ No newline at end of file diff --git a/docs/installation.ios.md b/docs/installation.ios.md index 5386dd41..0bf6122b 100644 --- a/docs/installation.ios.md +++ b/docs/installation.ios.md @@ -1,10 +1,10 @@ -#iOS Installation +# iOS Installation -If you don't want to use cocoapods, you don't need to use it! Just make sure you link the Firebase libraries in your project manually. For more information, check out the relevant Firebase docs at [https://firebase.google.com/docs/ios/setup#frameworks](https://firebase.google.com/docs/ios/setup#frameworks). +Setup the Firebase ios frameworks first; check out the relevant Firebase docs [here](https://firebase.google.com/docs/ios/setup#frameworks) or see section `d` below. ## cocoapods -Unfortunately, due to AppStore restrictions, we currently do _not_ package Firebase libraries in with Firebase. However, the good news is we've automated the process (with many thanks to the Auth0 team for inspiration) of setting up with cocoapods. This will happen automatically upon linking the package with `react-native-cli`. +We've automated the process of setting up with cocoapods. This will happen automatically upon linking the package with `react-native-cli`. **Remember to use the `ios/[YOUR APP NAME].xcworkspace` instead of the `ios/[YOUR APP NAME].xcproj` file from now on**. @@ -29,12 +29,11 @@ cd ios && pod update --verbose If you prefer not to use `react-native link`, we can manually link the package together with the following steps, after `npm install`: **A.** In XCode, right click on `Libraries` and find the `Add Files to [project name]`. - -![Add library to project](http://d.pr/i/2gEH.png) +![Firebase.xcodeproj add to files](https://cloud.githubusercontent.com/assets/5347038/24249673/0fccdbec-0fcc-11e7-83eb-c058f8898525.png) **B.** Add the `node_modules/react-native-firebase/ios/Firebase.xcodeproj` -![Firebase.xcodeproj in Libraries listing](http://d.pr/i/19ktP.png) +![Firebase.xcodeproj in Libraries listing](https://cloud.githubusercontent.com/assets/21329063/24249440/9494e19c-0fd3-11e7-95c0-c2baa85092e8.png) **C.** Ensure that the `Build Settings` of the `RNFirebase.xcodeproj` project is ticked to _All_ and it's `Header Search Paths` include both of the following paths _and_ are set to _recursive_: @@ -42,7 +41,7 @@ If you prefer not to use `react-native link`, we can manually link the package t 2. `$(SRCROOT)/../node_modules/react-native/React` 3. `${PROJECT_DIR}/../../../ios/Pods` -![Recursive paths](http://d.pr/i/1hAr1.png) +![Recursive paths](https://cloud.githubusercontent.com/assets/21329063/24250349/da91284c-0fd6-11e7-8328-6008e462039e.png) **D.** Setting up cocoapods @@ -51,17 +50,17 @@ Since we're dependent upon cocoapods (or at least the Firebase libraries being a Using cocoapods is the easiest way to get started with this linking. Add or update a `Podfile` at `ios/Podfile` in your app with the following: ```ruby -source 'https://github.com/CocoaPods/Specs.git' -[ - 'Firebase/Core', - 'Firebase/Auth', - 'Firebase/Storage', - 'Firebase/Database', - 'Firebase/RemoteConfig', - 'Firebase/Messaging' -].each do |lib| - pod lib -end +# Required by RNFirebase +pod 'Firebase/Auth' +pod 'Firebase/Analytics' +pod 'Firebase/AppIndexing' +pod 'Firebase/Core' +pod 'Firebase/Crash' +pod 'Firebase/Database' +pod 'Firebase/DynamicLinks' +pod 'Firebase/Messaging' +pod 'Firebase/RemoteConfig' +pod 'Firebase/Storage' ``` Then you can run `(cd ios && pod install)` to get the pods opened. If you do use this route, remember to use the `.xcworkspace` file.