expo-firebase-functions
expo-firebase is still in RC and therefore subject to breaking changings. Be sure to run
yarn upgrade
andcd ios; pod install
when upgrading.
expo-firebase-functions
Installation
Now, you need to install the package from npm
registry.
npm install expo-firebase-functions
or yarn add expo-firebase-functions
iOS
Cocoapods
If you're using Cocoapods, add the dependency to your Podfile
:
pod 'EXFirebaseFunctions', path: '../node_modules/expo-firebase-functions/ios'
and run pod install
.
Android
-
Append the following lines to
android/settings.gradle
:include ':expo-firebase-functions'project(':expo-firebase-functions').projectDir = new File(rootProject.projectDir, '../node_modules/expo-firebase-functions/android')and if not already included
include ':expo-core'project(':expo-core').projectDir = new File(rootProject.projectDir, '../node_modules/expo-core/android')include ':expo-firebase-app'project(':expo-firebase-app').projectDir = new File(rootProject.projectDir, '../node_modules/expo-firebase-app/android') -
Insert the following lines inside the dependencies block in
android/app/build.gradle
:api project(':expo-firebase-functions')and if not already included
api project(':expo-core')api project(':expo-firebase-app') -
Include the module in your expo packages:
./android/app/src/main/java/host/exp/exponent/MainActivity.java
/** At the top of the file.* This is automatically imported with Android Studio, but if you are in any other editor you will need to manually import the module.*/// This should be here for all Expo Firebase features.// Later in the file...@Overridepublic List<Package> {// Here you can add your own packages.return Arrays.<Package>;}
Usage
;;; // API can be accessed with: firebase.functions(); Component async { // ... initialize firebase app const httpsCallable = firebase; try const data = await ; console; // hello world catch code message details console; // invalid-argument console; // Your error message goes here console; // bar } { return <View />; }