Fork me on GitHub
#cljsrn
<
2017-06-05
>
charafau13:06:44

hello everyone, Iā€™m new to clojurescript with react native, is there some recommended tutorial?

vikeri14:06:17

@charafau Check out http://cljsrn.org/ for a bunch of resources

kurt-o-sys18:06:54

I'm (trying to) develop an app and I'm adding images. In my code:

(defn action-button [img action-fn]
  (touchable-highlight {:onPress action-fn}
                       (image {:source (js/require img)
                               :style  {:width 35 :height 35}})))

(def event-action (partial action-button "./images/events.png"))
(def beer-action (partial action-button "./images/drinks.png"))
(def question-action (partial action-button "./images/questions.png"))
(def chat-action (partial action-button "./images/chat.png"))
This works when I run the app in dev mode (`lein figwheel android`). However, when I build an apk (after lein prod-build), the app crashes during startup. In logcat, I'm mainly worried about:
06-05 20:44:21.618 12670 12700 E ReactNativeJS: Requiring unknown module "./images/events.png".
06-05 20:44:21.629 12670 12700 E ReactNativeJS: Requiring unknown module "./images/drinks.png".
06-05 20:44:21.633 12670 12728 I cr_LibraryLoader: Time to load native libraries: 7 ms (timestamps 9363-9370)
06-05 20:44:21.637 12670 12700 E ReactNativeJS: Requiring unknown module "./images/questions.png".
06-05 20:44:21.644 12670 12700 E ReactNativeJS: Requiring unknown module "./images/chat.png".
Could this be the problem? Or could it be something else? (And d'you need a full logcat šŸ™‚?)

kurt-o-sys19:06:56

or: how to add non-static images to a cljsrn app?

carocad20:06:37

@kurt-o-sys I have had that problem as well. Unfortunately I haven't found the solution yet but a clean install seems to solve it. (Full clean, gradle + react + Lein)

kurt-o-sys07:06:45

carocad: it seems (logically) to be related to: https://github.com/facebook/react-native/issues/2481 (https://facebook.github.io/react-native/docs/images.html#images-from-hybrid-app-s-resources) (image {src "..."}) seems to handle only static files. Having my code above does (probably?) not add a 'static' image. Also, and that didn't change yet, the resources seem to be loaded 15 times(!).

lepistane22:06:22

hi guys i am looking for resources on how to develop apps with clj/cljs and i found cljsrn site i was wondering do i have to know react native to be able to develop apps? are there any prerequisites before i start? are these the most basic apps that i can use as a starting point? https://github.com/drapanjanas/re-natal#example-apps

nikki23:06:56

@lepistane by this do you mean familiarity with developing React Native apps using just JavaScript?

nikki23:06:18

because familiarity with developing React Native apps using ClojureScript is what you will learn by doing "cljsrn"

nikki23:06:55

if the former -- i would say yeah it helps a lot because the state of cljsrn right now is pretty early -- it's pretty good but also pretty early and definitely you will have to down for adventure šŸ™‚