dmotz / natal-shell

A thin ClojureScript wrapper around the React Native API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prefer defining react var instead of assuming it on global namespace

carocad opened this issue · comments

Hey @dmotz,
I saw that in the code you use js/ReactNative to get the current instance of ReactNative. However that way the user is forced to put ReactNative in the global scope, which shoudnt be a requirement IMHO. That is specially problematic if a user require the macros of this library before setting that up.

I think there are some libraries that define the js/ReactNative as global but I dont think is the case for all cljs libs out there. I would propose something like reagent approach. Basically if the object is already defined globally then rely on that, otherwise require it.

Let me know your thoughts :)

Makes sense, will address in the next update.

thanks 👍