Git Product home page Git Product logo

invertase / react-native-firebase Goto Github PK

View Code? Open in Web Editor NEW
11.4K 165.0 2.2K 55.1 MB

๐Ÿ”ฅ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.

Home Page: https://rnfirebase.io

License: Other

JavaScript 60.16% Ruby 1.38% Java 16.24% Objective-C 14.74% Shell 0.38% TypeScript 6.43% Starlark 0.05% CSS 0.03% Objective-C++ 0.50% Kotlin 0.08%
firebase analytics android ios database push-notifications react-native fcm react-native-app react

react-native-firebase's Issues

Uploading file on Android

Hi guys,

The file upload works fine on iOS but on android, storage() send me the error "An unknown error has occurred" with no more informations

Any ideas ?

Best

Romain

Android installation documentation leads to ERROR "Google play services valid installation not found"

Here's an image of the error: Gyazo Screencapture

I've double checked the installation documentation several times, but just in-case I'll list my changes in the gradle files

Changes in android/app/build.gradle

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-firebase')
}
...
apply plugin: 'com.google.gms.google-services' // Very bottom of file

Changes in android/build.gradle

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }

Changes in settings/gradle

include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')

Changes in MainApplication.java

import io.invertase.firebase.RNFirebasePackage;
...
return Arrays.<ReactPackage>asList(
    new MainReactPackage(),
    new RNFirebasePackage()
);

google-services.json is stored in android/app and in the Android SDK tools I have the following installed:

  • Google Play APK Expansion library
  • Google Play Billing Library
  • Google Play Licensing Library
  • Google Play services

firebase.ios.js and firebase.android.js

Are these two files just hangovers from firestack, or do they serve a purpose? They're breaking things like flow, and code editor intelligence such as vs-code "IntelliSense". Happy to PR to remove them if you don't have plans to do anything with them (they currently have the same content).

Remote config

Are you already working on the remote config? Otherwise I would start a fork and PR it.

Storage not working

image

Trying to upload a file as shown in the doc.
Same code was working with firestack#v3 branch.

Can't run on android

Hi guys

The lib is working like a charm on iOS (and thanks a lot for such an amazing job) ; However, I can't get it working on Android.

capture d ecran 2017-04-11 a 11 24 10

Here are my graddle config ;
app.graddle :
capture d ecran 2017-04-11 a 11 21 48
capture d ecran 2017-04-11 a 11 22 03
capture d ecran 2017-04-11 a 11 22 15

Also, my android device config :
capture d ecran 2017-04-11 a 11 21 27

I digged into the web and I think it might be a play-services dependices error or something like that, but I can't figure it out.

config :
"firebase": "^3.7.5",
"react": "^15.4.2",
"react-native": "^0.42.2",
"react-native-firebase": "^1.0.0-alpha12",

Any ideas ?

Thanks

Romain

Connection State return number value, not boolean

Hi,

Currently, I'm using .info/connected to detect app connection state, as

firebase.database().ref('.info/connected').on('value', snapshot => {
    const connectionState = snapshot.val()
})

And I expect connectionState should return boolean value (true of false), as this Firebase doc.

But it doesn't, my connectionState value always return false at the first time, then return 1 if app has connection and 0 if not. Is it a correct behavior?

Ps: I'm still fine with those value, just want to confirm this behavior.

Facebook Login not working on IOS Simulator?

Im trying to get the Facebook login to work on IOS simulator (works on a android device :)

the login from Facebook side works as it giving me the access token. I think the problem is with the firebase.auth().signInWithCredential(credential) promise is not being resolved.

loginFacebook(){
    LoginManager
        .logInWithReadPermissions(['public_profile', 'email'])
        .then((result) => {
          if (result.isCancelled) {
            return Promise.resolve('cancelled');
          }
          console.log(`Login success with permissions: ${result.grantedPermissions.toString()}`);
          // get the access token
          return AccessToken.getCurrentAccessToken();
        })
        .then(data => {
          // create a new firebase credential with the token
          const credential = firebase.auth.FacebookAuthProvider.credential(data.accessToken);

          // login with credential
          return firebase.auth().signInWithCredential(credential);
        })
        .then((currentUser) => { 
         console.log("not being resolved"); // problem is here
          if (currentUser === 'cancelled') {
            console.log('Login cancelled');
          } else {
            // now signed in
            console.warn(JSON.stringify(currentUser.toJSON()));
          }
        })
        .catch((error) => {
          console.log(`Login fail with error: ${error}`);
        });
}

Im using react-native 0.43.2.

Email verification only updates after clearing cache/app data

When creating an account and sending an email verification, after verifying the email address I can only get the emailVerified prop from onAuthStateChanged to return true after clearing the app data and logging in again.

Only tested on Android at the moment.

Event Listener on value when using orderByChild()

Hi guys,
Thanks for such package. I appreciate your effort on it.

I am trying to fetch a certain data from my firebase realtime database. I am running very simple query which is under orderByChild().

   queryByMonth(startDate,endDate) {
		this.userRef.orderByChild('timestamp').startAt(startDate).endAt(endDate)
		.on("value", (snap) => {
			console.warn(snap.val())
			if (snap.val()) {
				this.setState({
				dataSource: this.state.dataSource.cloneWithRows(snap.val())
			});
		} else {
				this.setState({
				dataSource: this.state.dataSource.cloneWithRows([])
			});
		}
	});
     }
  • The issue here is, for Ex:
  • First query:
    Starting day is '1490976000000' which is : 01 April 2017,
    Ending day is '1493567999000' which is : 30 April 2017,
    Expected result : (only records that is between 01 April & 30 April). 2 Records
    This event get triggered and I am getting the correct result.

  • Second query:
    Starting day is '1490976000000' which is : 01 April 2017,
    Ending day is '1496159999000' which is : 30 May 2017,
    Expected result : (only records that is between 01 April & 30 May). 3 Records
    This event get triggered and I am getting the correct result.

  • Third query:
    Starting day is '1490976000000' which is : 01 April 2017,
    Ending day is '1493567999000' which is : 30 April 2017,
    Expected result : (only records that is between 01 April & 30 April). 2 Records
    This event WILL NOT trigger and I do not get snapshot. Thats means data still 3 records but I expected 2 records as the first query result.

NOTE: If I selected less or equal to 29 April 2017 for the ending date of the third query, the event get triggered and i will get the correct result which is 2 records!!

Any Idea?

Documentation Overhaul

Documentation needs simplifying across all areas.

  • Only the differences from the web SDK need to be mentioned in the docs.
  • Examples/best practices should be moved out into their own area.
  • Setup for iOS & Android is out-dated.
  • Contributing guidelines

Native module cannot be null

Hi I'm receiving a red screen with the error 'Native module cannot be null'

RN 0.42.0
react 15.4.2
v1.0.0-alpha12

Installed the library via the react native link script.

Login with Facebook Not Working

This conversation has moved from React Native Firestack issue #121

version: 1.0.0-alpha9

@Salakar The following enters neither the then or catch callbacks:

const credential = firebase.auth().FacebookAuthProvider.credential(data.accessToken);
// firebase.auth().FacebookAuthProvider will soon be moved to 
// firebase.auth.FacebookAuthProvider to match the firebase web sdk
firebase.auth().signInWithCredential(credential)
  .then(currentUser => {
  // now signed in
   console.warn(JSON.stringify(currentUser.toJSON()));
  })
  .catch(error => console.error(error));

onDisconnect().set() on iOS

Hi,

first of all, great job with react-native-firebase. I move here from the WebSDK and it works like a charm.

Except one Issue.

onDisconnect().set() is not working on iOS. It results in an missing function for promisify error.

I think the problem is, that in lib/modules/database/disconnect.js line 30 the function to call is onDisconnectSet, but in ios/RNFirebase/RNFirebaseDatabase.m line 617 the function is named onDisconenctSetObject or line 628 onDisconnectSetString. The function onDisconnectSet is missing.

Unable to initialize

I'm trying to initialize Firebase from JS as following:

  1. I configured this module on a clean project
  2. In index.android.js added the line import RNFirebase from 'react-native-firebase'
  3. In index.android.js i added the following before render():
    componentWillMount() {
    firebase.initizlizeApp({
    apiKey: 'apikey',
    authDomain: 'authdomain',
    databaseURL: 'dburl',
    storageBucket: 'bucket',
    messagingSenderId: 'senderid'
    });
    }
  4. i also tried to do it different as in the example:
    componentWillMount() {
    const firebase = new RNFirebase();
    const configurationOptions = {
    debug: true,
    googleAppID: 'appid',
    APIKey: 'appkey',
    databaseURL: 'dburl',
    storageBucket: 'bucket',
    androidClientID: 'clientid',
    GCMSenderID: 'senderid'
    };
    const firebase = new RNFirebase(configurationOptions);
    }

But in both attemps i get the following error on the emulator:
Default FirebaseApp is not initialized in this process com.xxx. Make sure to call FirebaseApp.initializeApp(Context) first. getInstance null:-1 getInstance null:-1 <init> RNFirebaseAuth.java:50 createNativeModules RNFirebasePackage.java:38 processPackage NativeModuleRegistryBuilder.java:88 processPackage ReactInstanceManager.java:950 createReactContext ReactInstanceManager.java:891 access$600 ReactInstanceManager.java:104 doInBackground ReactInstanceManager.java:218 doInBackground ReactInstanceManager.java:197 call AsyncTask.java:304 run FutureTask.java:237 runWorker ThreadPoolExecutor.java:1133 run ThreadPoolExecutor.java:607 run Thread.java:761

Am i doing anything wrong?

Crashing error while startup on Android (io.invertase.firebase.auth.RNFirebaseAuth.init)

Hi guys! Thanks for your work!

Please put me in the right direction.. Im trying to integrate Firebase, but when i'm done with all initializations, built my app and trying to start it on my device, ive got a crashing error at
io.invertase.firebase.auth.RNFirebaseAuth.init:
screen shot 2017-04-10 at 6 05 11 pm

Appreciate if u could help me with this.

RN v0.41.0
react-native-firebase v1.0.0-alpha12

RNFirebaseAuth.getToken got 2 arguments, expected 3

Sometimes this error occurs when opening the app. I did not identify the cause. I suppose it is related to the expired token of the firebase, since it usually happens after a while that I get without opening the app.

RNFirebaseAuth.getToken got 2 arguments, expected 3

invoke
BaseJavaModule.java:318

invoke
JavaModuleWrapper.java:141

...

I'm using react-native 0.42 and react-native-firebase 1.0.0-alpha12.

messaging onMessage - iOS vs Android

Currently it would seem iOS only accepts the following to receive a remote message:

    firebase.messaging().onMessage((notification) => {

    });

Currently, Android also has on available, which doesn't work in iOS I think:

    firebase.messaging().on(firebase.messaging.EVENT_TYPE.Notification, (notification) => {

    });

Whats the correct way we should handle this cross platform?

Linking problem

Hi,
I'm trying to do like the installation instructions says.
First i did:
npm i react-native-firebase --save
then:
react-native link react-native-firebase

and i get the following message:

`'yarn' is not recognized as an internal or external command,
operable program or batch file.
Scanning 557 folders for symlinks in D:\fbcounter\node_modules (19ms)
rnpm-install ERR! It seems something went wrong while linking. Error: spawn UNKNOWN
Please file an issue here: https://github.com/facebook/react-native/issues

spawn UNKNOWN`

The default Firebase app has not yet been configured

Hey guys, working like a bomb on Android but I get this error on iOS. I did the react-native link react-native-firebase way but wondering if I missed anything on iOS. It seems like I followed the steps correctly.

2017-03-18 23:29:35.622 wishlizt[2927:191978] Setting up RNFirebase instance 2017-03-18 23:29:35.861 wishlizt[2927] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization. Read more: https://goo.gl/ctyzm8. 2017-03-18 23:29:35.865 wishlizt[2927] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization. Read more: https://goo.gl/ctyzm8.

Authentication with federated providers

The Authentication doc states that:

RNFirebase handles authentication for us out of the box, both with email/password-based authentication and through oauth providers (with a separate library to handle oauth providers).

I couldn't find, however, what separate library you recommend (or maybe include). Could you please clarify?

Listener callback only triggers for initial component instance

@Salakar I'm attempting to use the pattern you referenced in a previous issue.

The Problem

In my iOS app, it's possible to have multiple instances of a component mounted at the same time.

Think Instagram โ€“ when a user taps a photo in Instagram and then taps the photo owner's avatar, the user scene pushes in from the right.

If she then goes on to tap the same photo in the user's list of photos, a clone of the first scene will also push in the from right.

In my app, all scenes need to mount, establish the Firebase listener, get a snapshot of the initial data and listen for changes after that.

Everything works great for the first component mounted. In any subsequent components, however, the listeners don't immediately trigger the callback.

I suppose makes sense considering the docs:

Firebase data is retrieved by attaching an asynchronous listener to a firebase.database.Reference. The listener is triggered once for the initial state of the data and again anytime the data changes.

It's as though Firebase sees each subsequent listener as the same listener and thus doesn't trigger.

Data Structure

In my code, I'm following Firebase's recommended data fan-out approach which seeks to create "data that scales."

I've included the following JSON, so the complexity of the code that follows will be more clear.

{
  "displayName" : "Andrew Henderson",
  "host" : {
    "-KgC-c0WvT0P1R-aDmVo" : true,
    "-KgC0D94Cxs05GX8qWBc" : true,
    "-KgC0s7f9lwweeDm3oeg" : true,
    "-KgC0ypAODARXxvbva5F" : true
  },
  "puid" : "-Kg6pefxyFtyfPVe-aIo",
  "timestamp" : 1490485162946,
  "uid" : "H63dvD6TvJRZnpPwf9o0FejqmEf2"
}

Code

In my component, I set up a reference to a user's posts which returns the host object.

I then create a reference to all of the individual posts using those keys and receive the values for the full posts.

constructor(props) {

  super(props);

  const { uid } = props;

  // Set firebase refs
  this.postsRef = firebase.database().ref('posts');
  this.hostsRef = firebase.database()
    .ref(`users/${uid}/host`)
    .orderByChild('startTime');

  this.hostedPostRefs = {};

  // Keep a raw copy of this user's posts
  this.hostedPosts = {};

  // ListView DataSource instance
  this.hostedPostsDataSource = new ListView.DataSource({
    rowHasChanged: (r1, r2) => r1._key !== r2._key,
  });

  // Initial State
  this.state = {
    loading: true,
    hostedPostsDataSource: this.hostedPostsDataSource.cloneWithRows(this.hostedPosts),
  };
}

componentDidMount() {
  this.hostsRef.on('value', this._onHostsReceived)
}

componentWillUnmount() {
  this.hostsRef.off();
  forEach(this.hostedPostRefs, hostedPostRef => {
    hostedPostRef.off()
  })
}

_onHostsReceived = (snapshot) => {
  snapshot.forEach(this._requestPost)
};

_requestPost = (snapshot) => {

  const { key } = snapshot;

  if (!this.hostedPostRefs[key]) {
    this.hostedPostRefs[key] = this.postsRef.child(key);
    this.hostedPostRefs[key].on('child_changed event', this._onPostReceived)
  }
};

_onPostReceived = (snapshot) => {
  this.hostedPosts[snapshot.key] = snapshot.val();
  this.setState({
    hostedPostsDataSource: this.hostedPostsDataSource.cloneWithRows(this.hostedPosts)
  });
};

Firebase Invites

Just curious what you think of this library and if you thought of adding that part of this?

Thanks !

Server onDisconnect event

I'm trying create a presence system using react-native-firebase but it seems the onDisconnect callback is never called.

var userid = 33;
var amOnline = firebase.database().ref('.info/connected');
var userRef = firebase.database().ref('presence/' + userid );
amOnline.on('value', function(snapshot) {
if (snapshot.val()) {
userRef.onDisconnect().remove();
userRef.set(true);
}
});

it's not this available to be used or am I making some confusing?

Application crashing on startup after integrating module (Android)

I'm using react-native-firebase just fine in some of my projects, however I'm trying to integrate it into an existing project and I'm having an excessive amount of trouble. I've made sure that all of my gradle files are setup properly, and I've also cross-referenced from my other projects that are using react-native-firebase.

The application immediately crashes on launch, before it even gets a chance to load. I don't get a Redbox from react-native, the application just crashes to home with "app has stopped working"

Here's the log from logcat

--------- beginning of main
--------- beginning of system
--------- beginning of crash

Most the time when trying to clean the project I get the following error from gradle

Execution failed for task ':app:clean'.
> Unable to delete directory: C:\Programming\demo-app\android\app\build\generated\res\google-services\debug

I've converted the app into the most simple app that you can run on react-native, nothing but an empty view, but I still can't seem to get anywhere

import { React } from 'react'; 
import { AppRegistry, View } from 'react-native';

AppRegistry.registerComponent('demoapp', () => <View />);

I've cleared my node_modules and package cache, I've ran gradlew clean several times, I don't know what to do anymore.

Here's the full application log

04-11 12:31:09.662  5209  5232 E UncaughtException: java.lang.RuntimeException: An error occurred while executing doInBackground()
04-11 12:31:09.662  5209  5232 E UncaughtException:     at android.os.AsyncTask$3.done(AsyncTask.java:325)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.lang.Thread.run(Thread.java:761)
04-11 12:31:09.662  5209  5232 E UncaughtException: Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/GoogleMapOptions;
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.airbnb.android.react.maps.AirMapManager.<init>(AirMapManager.java:52)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.airbnb.android.react.maps.MapsPackage.createViewManagers(MapsPackage.java:39)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.ReactInstanceManager.createAllViewManagers(ReactInstanceManager.java:711)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:218)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.CoreModulesPackage.access$200(CoreModulesPackage.java:74)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:151)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:148)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:76)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:97)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:950)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:880)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:104)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:218)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:197)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at android.os.AsyncTask$2.call(AsyncTask.java:305)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-11 12:31:09.662  5209  5232 E UncaughtException:     ... 3 more
04-11 12:31:09.662  5209  5232 E UncaughtException: Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.GoogleMapOptions
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.lang.VMClassLoader.findLoadedClass(Native Method)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
04-11 12:31:09.662  5209  5232 E UncaughtException:     ... 19 more
04-11 12:31:09.662  5209  5232 E UncaughtException: Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable;
04-11 12:31:09.662  5209  5232 E UncaughtException:     ... 19 more
04-11 12:31:09.662  5209  5232 E UncaughtException: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable" on path: DexPathList[[zip file "/data/app/com.demoapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.demoapp-1/lib/x86, /system/fake-libs, /data/app/com.demoapp-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
04-11 12:31:09.662  5209  5232 E UncaughtException:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
04-11 12:31:09.662  5209  5232 E UncaughtException:     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
04-11 12:31:09.662  5209  5232 E UncaughtException:     ... 19 more
04-11 12:31:09.666  5209  5209 D         : HostConnection::get() New Host Connection established 0x9db5f800, tid 5209
04-11 12:31:09.669  5209  5229 I FA      : Tag Manager is not found and thus will not be used
04-11 12:31:09.676  5209  5209 W unknown:React: Caught exception after cancelling react context init
04-11 12:31:09.676  5209  5209 W unknown:React: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object com.facebook.react.ReactInstanceManager$Result.get()' on a null object reference
04-11 12:31:09.676  5209  5209 W unknown:React:         at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.onCancelled(ReactInstanceManager.java:247)
04-11 12:31:09.676  5209  5209 W unknown:React:         at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.onCancelled(ReactInstanceManager.java:197)
04-11 12:31:09.676  5209  5209 W unknown:React:         at android.os.AsyncTask.finish(AsyncTask.java:665)
04-11 12:31:09.676  5209  5209 W unknown:React:         at android.os.AsyncTask.-wrap1(AsyncTask.java)
04-11 12:31:09.676  5209  5209 W unknown:React:         at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
04-11 12:31:09.676  5209  5209 W unknown:React:         at android.os.Handler.dispatchMessage(Handler.java:102)
04-11 12:31:09.676  5209  5209 W unknown:React:         at android.os.Looper.loop(Looper.java:154)
04-11 12:31:09.676  5209  5209 W unknown:React:         at android.app.ActivityThread.main(ActivityThread.java:6119)
04-11 12:31:09.676  5209  5209 W unknown:React:         at java.lang.reflect.Method.invoke(Native Method)
04-11 12:31:09.676  5209  5209 W unknown:React:         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
04-11 12:31:09.676  5209  5209 W unknown:React:         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
04-11 12:31:09.711  1326  1536 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
04-11 12:31:09.712  5209  5248 D         : HostConnection::get() New Host Connection established 0xab308e40, tid 5248
04-11 12:31:09.713  5209  5248 I OpenGLRenderer: Initialized EGL, version 1.4
04-11 12:31:09.713  5209  5248 D OpenGLRenderer: Swap behavior 1
04-11 12:31:09.714  5209  5248 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
04-11 12:31:09.714  5209  5248 D OpenGLRenderer: Swap behavior 0
04-11 12:31:09.726  1326  1536 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
04-11 12:31:09.761  1326  1536 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
04-11 12:31:09.859  1599  1620 I ActivityManager: Displayed com.demoapp/.MainActivity: +470ms
04-11 12:31:09.890  5209  5232 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
04-11 12:31:09.890  5209  5232 E AndroidRuntime: Process: com.demoapp, PID: 5209
04-11 12:31:09.890  5209  5232 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at android.os.AsyncTask$3.done(AsyncTask.java:325)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:761)
04-11 12:31:09.890  5209  5232 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/GoogleMapOptions;
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.airbnb.android.react.maps.AirMapManager.<init>(AirMapManager.java:52)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.airbnb.android.react.maps.MapsPackage.createViewManagers(MapsPackage.java:39)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.createAllViewManagers(ReactInstanceManager.java:711)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:218)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.CoreModulesPackage.access$200(CoreModulesPackage.java:74)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:151)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:148)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:76)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:97)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:950)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:880)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:104)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:218)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:197)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at android.os.AsyncTask$2.call(AsyncTask.java:305)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        ... 3 more
04-11 12:31:09.890  5209  5232 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.GoogleMapOptions
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.lang.VMClassLoader.findLoadedClass(Native Method)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        ... 19 more
04-11 12:31:09.890  5209  5232 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable;
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        ... 19 more
04-11 12:31:09.890  5209  5232 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable" on path: DexPathList[[zip file "/data/app/com.demoapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.demoapp-1/lib/x86, /system/fake-libs, /data/app/com.demoapp-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
04-11 12:31:09.890  5209  5232 E AndroidRuntime:        ... 19 more
04-11 12:31:09.893  1599  1919 W ActivityManager:   Force finishing activity com.demoapp/.MainActivity

I also get this error frequently when trying to build, which requires me to run a gradlew clean

:app:processDebugGoogleServices FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> Failed to create folder: C:\Programming\demo-app\android\app\build\generated\res\google-services\debug

iOS 9 compatibility

My app is built on IOS 9 and upgrading to iOS 10 is a last resort option.

having bugs with ios 9 particularly with UserNotifications

thank you

method does not override or implement a method from a supertype

I'm getting this error when trying to compile the project.

/Users/patrickbassut/Programming/beebo/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:36: error: RNFirebaseMessaging is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
public class RNFirebaseMessaging extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener {
       ^
/Users/patrickbassut/Programming/beebo/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:270: error: method does not override or implement a method from a supertype
  @Override
  ^
/Users/patrickbassut/Programming/beebo/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:275: error: method does not override or implement a method from a supertype
  @Override
  ^

Making project more granular? i.e. Analytics / Crash / Database etc ...

I've came across one case today where react-native-firebase fell short. I wanted to integrate https://github.com/tylermcginnis/re-base into the project and would need to use default firebase js sdk in that case. That lead me to think and ask this question. Would it make sense to make project more granular? i.e. Allow to use auth and database from javascript sdk and turn to react-native-firebase for missing features like Analytics / Crash reporting etc.. ?

One similar (less popular and not so well tested) solution I was able to find is: https://github.com/yutin1987/react-native-bridge-firebase maybe it can give some ideas. I think you guys are doing great job so far ๐Ÿ‘ giving us a bit more control like this is really welcome in my opinion.

Expo imagepicker & Storage

Hi,

I switched from react-native-image-picker (that worked good initially with storage of this library) to the ImagePicker of expo SDK and when the image is selected it returns the param origURL with the format of assets-library:// but the optimal is to use the uri that comes in the format of file://.

{
  "cancelled":false,
  "height":1611,
  "width":2148,
  "uri":"file:///data/user/0/host.exp.exponent/cache/cropped1814158652.jpg"
}

Checking the source code, other format different than assets-library:// is not recognised. ContentType was automatically detected using react-native-image-picker with 1.0.0-alpha11 or at least I didn't have to specify it before and it was set in storage correctly but right now is not. Im using the assets-library:// from origURL and specifying manually the contentType, it works perfect.

Many thanks

android storage got n arguments, expected n+1

been trying to download, upload, do any thing with storage and keep on getting errors for any method i use, seems like the js bridge is not sending all arguments to android.

the screen shot below is representative of putFile, downloadFile or any method I've tried.
although with different number of arguments got.

try {
firebase.storage().ref('/audio').downloadFile('PTT-20170307-WA0001.opus')
   .then(download => Alert.alert('done'))
   .catch(err => Alert.alert('err'))
} catch (e) {
console.log(e)
}

tryCatch catches the fallowing error

TypeError: Cannot read property 'then' of undefined
    at App.onDownload (index.android.bundle:46276)
    at Object.onPress (index.android.bundle:46291)
    at Object.touchableHandlePress (index.android.bundle:21187)
    at Object._performSideEffectsForTransition (index.android.bundle:15329)
    at Object._receiveSignal (index.android.bundle:15266)
    at Object.touchableHandleResponderRelease (index.android.bundle:15158)
    at Object.invokeGuardedCallback (index.android.bundle:10526)
    at executeDispatch (index.android.bundle:10405)
    at Object.executeDispatchesInOrder (index.android.bundle:10425)
    at executeDispatchesAndRelease (index.android.bundle:10062)

screenshot_20170404-173435

Offline persistence after app restart

Currently I had an issue about offline persistence (on iOS)
First I call an update request (while offline) like

firebase.database()
    .ref('my_ref')
    .set(myData)
    .then(() => {
      resolve('Synchronization success');
    })
    .catch(err => {
      reject('Synchronization fail');
    })

I'm sure that firebase had store myData locally (I can get value from my_ref) and after app gains connection again or soft restart (tap Home button -> tap App icon to reopen), myData is uploaded to remote. But when app is completely shut down (double tap Home button -> swipe App away) then reopen, Firebase doesn't upload myData

Is this a wrong behavior or am I missing something?

Flow version

Hello! Thanks for all your hard work on this. Great to see your fork graduate to a proper package!

The latest version of flow used by react-native is 0.40. Running this version against my codebase, I'm getting ~42 flow errors in react-native-firebase. I'd love to help you fix these, but I'm not sure which version of flow you're working to. It could be that if I upgraded to 0.42, there would be no react-native-firebase errors, but then I wouldn't be able to flow-check my code because react-native is pinned to [email protected].

Would it make sense to add [version] ^0.40.0 to this package's .flowconfig, to ensure that it matches with react-native? Then I can start submitting PRs ๐Ÿ™‚

Updating to newer versions

Whats the correct way to update react-native-firebase ? I usually yarn add react-native-firebase and then react-native link is this correct way to approach this?

Multiple dex files define Lcom/google/firebase/iid/zzb;

After adding this package i've got this error

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)

:app:transformClassesWithDexForDebug FAILED

app/build.gradle

dependencies {
    compile project(':react-native-firebase')
    compile project(':react-native-material-kit')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-camera')
    compile project(':react-native-fs')
    compile project(':react-native-push-notification')
}

Also I'm trying to exclude group: 'com.google.android.gms' -same error

RN: 0.43.3

Any ideas?

Thanks

orderByChild().equalTo() only returns one result

Here's my code

import Firebase from 'firebase'
// import Firebase from 'react-native-firebase'
import config from './firebaseConfig'

const firebase = Firebase.initializeApp(config)

const collectionsRef = firebase.database().ref('collections/v1-0')
collectionsRef.orderByChild('ownerId').equalTo(userId).once('value')

When I run the above, I get all 4 results stored in my firebase. However, when I comment out firebase and uncomment react-native-firebase, I only get 1 result.

Authentication examples throw 'is not a function' error in JS

Steps to follow:

  1. Install as per docs for Android.
  2. Create a file in JS to implement....
import RNfirebase from 'react-native-firebase';

const instance = RNfirebase.initializeApp({
    debug: __DEV__ ? '*' : false,
    errorOnMissingPlayServices: false,
    persistence: true,
});

export default instance;
  1. Attempt to cal any function in Auth, eg...
firebase.auth().onAuthStateChanged((user) => {
            if (user) {
                // User is signed in.
            }
        });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.