Fork me on GitHub
#cljsrn
<
2016-03-08
>
seantempesta16:03:17

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)

seantempesta17:03:10

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.

seantempesta17:03:42

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

seantempesta17:03:38

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

drapanjanas19:03:54

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

adamfrey20:03:35

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

seantempesta21:03:42

@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?

seantempesta21:03:12

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

seantempesta21:03:37

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 %))