Fork me on GitHub
#clojurescript
<
2017-10-05
>
adamsff301:10:01

hi all, im just getting started w/clojure, interested in making a react native app. does anyone have any snippets/public code showing an example of successfully integrating Native-base (cross-platform RN components)?

metame05:10:31

you can also join us in #cljsrn if you haven't already

amar03:10:58

hi @ahorwitz http://cljsrn.org/ is worth checking out if you’ve not come across it already.

qqq03:10:29

@ahorwitz: I would separate "getting started w/ clojure + react" from "react native" -- clojurescript + reagent is amazing; react-native may bring unnecessary headaches early on

adamsff304:10:11

thanks @amar, thank you! actually just stumbled across that, that's how i found this slack 🙂

adamsff304:10:29

will give it a more thorough read. @qqq that's good to know; is it still a headache with something like exponent involved?

qqq04:10:30

@ahorwitz: 1. I never tried exponent. 2. The two things that turned me off from react native were: 2.1: debugging cljs is so much easier in browser 2.2: I needed something simple (camera access?) it required compiling some module for ios -- took up an afternoon, and after that, I quit react native

qqq04:10:46

also, hot code reloading, in my limited experience, worked much better in browser than over react native

qqq04:10:06

currently, for my mobile app, I'm just using plain html/js

adamsff304:10:19

ahh, that's good to know, thanks. supposedly exponent makes the hardware stuff easier, but i've never used it, guess we'll find out 🙂

adamsff304:10:29

i found an example with nativebase here https://github.com/jigkoxsee/exp-cljs-native-base/blob/master/src/cljs_native_base/core.cljs, im guessing if you're using reagent without react native you don't have to bother with r/reactify-component adapt-react-class etc. too

qqq04:10:08

cljs tooling with boot/lein figwheel/reload is amazing; and if you start with react native upfront, you may end up in a react-native tarpit and never realize how fun cljs dev could be

adamsff304:10:34

do you know of any goto resources for learning figwheel/lein?

qqq04:10:39

https://www.youtube.com/watch?v=G7Z_g2fnEDg // he also wrote devcard, which I don't use, but some people absolutely love

adamsff304:10:25

nice thank you!

bendlas12:10:33

in 1.9.946, apparently an assert got added about the form of :npm-deps: Assert failed: cljs.analyzer/foreign-dep? expected symbol got "@material/ripple" cljs supports string requires, because not all npm packages fit in clojure's symbol syntax. how is this supposed to fit with the dependency syntax?

bendlas13:10:35

... scratch that, seems this was an artifact of a leftover build dir ..

isak15:10:49

anyone know if there is a good reason clojurescript requires explicitly requiring namespaces for functions that you fully qualify? e.g., using (clojure.string/starts-with? ...) requires requiring [clojure.string]

thheller15:10:27

@isak so the compiler can properly ensure that clojure.string is loaded before you want to access it

thheller15:10:09

otherwise you might try to sneak in circular dependencies and such 😉

mfikes16:10:08

Perhaps a secondary reason, @isak, is that if you have a qualified symbol, the compiler wouldn’t know if the part before the / is a namespace, or simply an alias, otherwise.

thheller16:10:41

@mfikes fun fact: clojure thinks everything without a . is an alias

dpsutton16:10:05

clojure.repl/doc ?

dpsutton16:10:23

clojure thinks clojure.repl is an alias in this instance?

bronsa16:10:19

i don't understand the distinction here, when does clojure care whether you're using an alias or not?

thheller16:10:08

it does not? I have a one namespace (ns repl) which should be usuable from any namespace but isn’t

thheller16:10:45

oh .. nvm I’m just wrong

thheller16:10:12

it doesn’t matter if there is a dot, I just need to require it

mfikes19:10:31

Yeah, my point above is that the part of a symbol before the / is not necessarily a namespace (even if it has . characters in it). I think I'd like to say that Clojure doesn't have the concept of fully qualified symbols that can be used to unambiguously resolve a Var. Symbols are qualified, and symbol-to-Var resolution is accomplished using whatever is in the ns forms, including aliases.

Alex Miller (Clojure team)21:10:42

In Clojure, the important thing is not the ns form, but the state of the Namespace object in the Clojure runtime, particularly the one referred to by *ns*. That state is modified as a result of ns, but can also be modified lots of other ways (a bare require or alias, etc).

isak22:10:37

@alexmiller does using those other ways (e.g., bare require) come with any problems for clojurescript and advanced compilation? Also, is it possible to call a macro to modify *ns* ?

isak22:10:02

the reason I ask is that for some types of projects, it is nice to be able to maintain a set of requires/imports that can be reused across namespaces. Elixir allows this, and I haven't figured out how to do it (if possible) in clojurescript. Example: https://medium.com/@cjbell_/sharing-methods-between-phoenix-controllers-358ab6d36e22

thheller22:10:06

@isak there is no dynamic require in CLJS (outside the REPL). so if you do a (require ...) in a file you might as well put it into the ns

isak22:10:32

ah i see, so then it is not possible. thanks @thheller

thheller22:10:16

yeah we need static requires for closure to work