Firebase doesn't work with RN 0.22.0
Hello, I am getting
Attempt to invoke virtual method 'java.lang.Object android.util.SparseArray.get(int)' on a null object reference.
Package.json: "firebase": "^2.4.1", "react": "^0.14.7", "react-native": "^0.22.0"
I am getting the same error. I realise that I only get this error when I'm invoking:
this.ref = new Firebase("https://somevalidapp.firebaseio.com/");
This was working at v0.21 prior to v0.22 upgrade.
I have checked that ~v0.21 does not cause this. ^v0.22 indeed causes this.
same here
"firebase": "^2.4.1", "react": "^0.14.7", "react-native": "^0.22.0"
@jwngr - any thoughts on this?
No, but @mikelehen is probably a better person to ask.
Could either of you provide a minimal repro? Or is calling new Firebase anywhere in your code literally all you need to do make this happen?
Commening out new Firebase works alright. Adding it back in will throw the null object reference error.
Anybody have a stacktrace for the error handy by chance?
Not sure if it's related, but this is what happens when I just import firebase into my react native project using 0.22

@mikelehen Would it be possible for you to set up CI that tests against every commit made to React Native master? That way you could ping us quickly when there's a commit that breaks the Firebase integration, and since we'd have a single commit it should be easy to fix.
Alternatively, do you test the React Native RC releases as soon as they come out?
@mkonicek do you mean this?
I have exactly the same error on 0.22 like @phonghho. However, I setup a complete new project with 0.21 as well and the moment i import firebase, it throws the same error.
I have tested earlier versions of react-native. Surprisingly, the issue doesn't occur on 0.18 and 0.19, but since 0.20 I can repro the issue.
Possibly related to this Google Groups thread on issues with Firebase not being strict mode compatible...
This is related to babel-preset-react-native 1.5.3 enabling strict mode.
My workaround is:
echo node_modules/firebase/lib/firebase-web.js > .babelignore
(restart packager, etc)
@keeth Can you create a new issue regarding a custom config not overriding the default one?
As mentioned in https://github.com/facebook/react-native/issues/6566#issuecomment-200485343 , the correct way to fix this is by adding node_modules/firebase/ to your .babelignore.
We should eventually ship a pre-built version of React Native and avoid transforming files under node_modules so that we don't break third party code. cc @martinbigio
@facebook-github-bot answered
@satya164 yep, just filed #6611
Closing this issue as @satya164 says the question asked has been answered. Please help us by asking questions on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.
@satya164 - @keeth workaround doesn't work for me. Still broken.
You need to run the packager with --reset-cache after that. Otherwise it won't work.