Merge branch 'master' of https://github.com/invertase/react-native-firebase
This commit is contained in:
commit
d8693f5e39
54
README.md
54
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<img align="left" src="http://i.imgur.com/01XQL0x.png">
|
||||
|
||||
[![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.
|
||||
<hr>
|
||||
|
||||
### 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)
|
||||
|
||||
<hr>
|
||||
|
||||
### 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!
|
||||
<hr>
|
||||
|
||||
## 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
|
||||
<hr>
|
||||
|
||||
### 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
|
||||
<hr>
|
||||
|
||||
### 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
|
||||
<hr>
|
||||
|
||||
### 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
|
||||
|
||||
<hr>
|
||||
|
||||
### License
|
||||
|
||||
- MIT
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg width="183" height="197" viewBox="0 0 183 197" xmlns="http://www.w3.org/2000/svg"><title>Slice 1</title><g fill="none" fill-rule="evenodd"><path fill="#F4A93F" d="M80.95 76l19.202 33.45-24.243-.872z"/><path fill="#F4A83E" d="M90.16 82.4l14.234 27.05-29.091-.872z"/><path fill="#E88634" d="M87.489 87.038L99.94 109.45l-24.334-.243z"/><path fill="#F8CA51" d="M100.546 84.758l3.848 24.692L75 109.153z"/><path fill="#F8CA51" d="M90.16 117l14.555-7.847L75 108.875z"/><path d="M1.008 98C1.643 118.712 41.69 135 91 135v-8.002C51.309 126.8 9.675 114.642 9.008 98h-8z" fill="#E88634"/><path d="M135.523 21.782C117.27 11.976 83.14 38.515 58.484 81.218l6.93 4.001c20.016-34.275 51.364-64.252 66.11-56.508l4-6.929z" fill="#F9CB52"/><path d="M1.008 98C1.643 77.288 41.69 61 91 61v8.002C51.309 69.2 9.675 81.358 9.008 98h-8z" fill="#E88634"/><path d="M46.043 20c-17.62 10.906-11.702 53.732 12.953 96.436l6.93-4.002C46.251 77.963 35.964 35.827 50.043 26.93l-4-6.929z" fill="#F4A73E"/><path d="M46.043 176.436C28.423 165.53 34.34 122.703 58.996 80l6.93 4.001c-19.675 34.472-29.962 76.608-15.883 85.506l-4 6.929z" fill="#F9CB52"/><path d="M45 20.5c18.255-9.806 52.384 16.732 77.04 59.436l-6.931 4C95.093 49.662 63.746 19.687 49 27.43L45 20.5z" fill="#F4A73E"/><path d="M181 98c-.635-20.712-40.683-37-89.992-37v8.002C130.698 69.2 172.333 81.358 173 98h8z" fill="#E88634"/><path d="M45.241 176.501c.107.065.214.129.322.191 18.143 10.475 52.623-16.146 77.476-59.192l-6.892-4.067c-20.175 34.58-51.9 64.808-66.502 56.378a10.11 10.11 0 0 1-.437-.267L45.24 176.5z" fill="#F9CB52"/><path d="M136.036 175.938C117.78 185.738 83.653 159.2 59 116.5l-.26-.45 6.836-4.16c19.984 34.503 51.585 64.863 66.431 57.134l4.029 6.914z" fill="#F4A73E"/><path d="M181 97c.005.166.008.333.008.5 0 20.95-40.295 37.5-90 37.5v-8.002c40.012-.198 82-12.554 82-29.403 0-.2-.006-.398-.018-.595H181z" fill="#E88634"/><path d="M135.005 176.43c17.609-10.915 11.688-53.734-12.962-96.43l-.44-.76-7.022 3.835.047.082c19.952 34.558 30.52 77.214 16.45 86.298l3.927 6.975z" fill="#F4A73E"/><path d="M135.48 21.282c17.62 10.906 11.702 53.733-12.953 96.436l-6.93-4.001c19.676-34.472 29.962-76.608 15.883-85.506l4-6.929z" fill="#F9CB52"/></g></svg>
|
After Width: | Height: | Size: 2.1 KiB |
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue