Fork me on GitHub

Anyone tried using Firebase in a CLJS react-native project? I’m able to require the library, but as soon as I try instantiating an instance of fb I start getting weird reference errors: #object[ReferenceError ReferenceError: kidlink_rn is not defined] (where kidlink-rn is the root namespace)


So I setup a vanilla react-native project, imported Firebase and everything works. The only difference I can see in the log messages is that the vanilla version of react native seems to be initializing something called SocketRocket. From my previous research, initially Firebase wasn’t working (not sending data) because of a WebSocket polyfill issue that has since been fixed.


Is there any chance that the Google closure libraries are overwriting the websocket polyfill?


Is there any way to see the javascript code generated by the react-native packager?


@seantempesta: I guess should be what is generated by packager


did anyone who was building a cljsrn in release mode with advanced compilation run into a problem like this:

com.facebook.react.modules.core.JavascriptException: Can't find variable: React


@drapanjanas: Thanks. Yeah, I’m not sure what’s going on. I can get Firebase to work in a vanilla react-native project and a vanilla reagent project. So it seems as if it’s not something that’s specifically react-native or clojurescript that’s causing Firebase problems. Is there anything in re-natal that might be affected websocket communication? It really seems like the connection is just hanging. Maybe a networking configuration change?


@adamfrey: Sorry man. Haven’t even attempted advanced compilation mode yet. simple_smile


To repro it, add [cljsjs/firebase "2.4.1-0”] to your lein dependencies, drop into the figwheel repl and run something like this:

(require ‘cljsjs.firebase)
(def fb (js/Firebase. "))
(.once fb "value" #(.log js/console %))