This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-17
Channels
- # admin-announcements (4)
- # boot (93)
- # cider (4)
- # cljsrn (61)
- # clojure (137)
- # clojure-austin (2)
- # clojure-brasil (2)
- # clojure-dev (11)
- # clojure-dusseldorf (10)
- # clojure-greece (245)
- # clojure-russia (37)
- # clojure-spec (60)
- # clojure-taiwan (1)
- # clojure-uk (24)
- # clojurescript (36)
- # cursive (18)
- # datomic (20)
- # emacs (20)
- # funcool (1)
- # hoplon (29)
- # jobs (1)
- # keechma (1)
- # lein-figwheel (1)
- # leiningen (1)
- # off-topic (3)
- # om (10)
- # om-next (1)
- # onyx (60)
- # other-languages (14)
- # planck (26)
- # random (3)
- # re-frame (21)
- # ring (2)
- # spacemacs (8)
- # specter (56)
- # spirituality-ethics (2)
- # uncomplicate (1)
- # untangled (68)
- # yada (3)
Guys, does anyone use environment variables with RN? Smth for dev and prod mode in code?
And another question, is it possible to use plists for configs?
@savelichalex: Yes, I use Google Closure variables as per: https://github.com/drapanjanas/re-natal/issues/46#issuecomment-219284294 No idea about plists. Was looking into it a while back but never decided on anything.
@vikeri: thanks!
@savelichalex: :thumbsup: It is not ideal however, I have a script that overwrites the figwheel-bridge.js
@vikeri: Can you show it?
@vikeri: I’m just thinking how use it with bash variables)
@savelichalex: Alright, in project.clj
I think you can use (System/getenv ”BASH_VAR”)
@vikeri: Do you mean that do it in project.clj instead of overwrite figwheel-bridge.js?
@savelichalex: I don’t know where you are using what, if you want to use bash variables as a closure define you could just replace true
in the script above with $VAR?
@vikeri: hm, nice decision with $VAR, I like it:smile: thanks again)
Can we use this variables with macros?
I think so, but then you would use (System/getenv "BASH_VAR”)
I’m not sure that is the indended use of macros though 😛
It is only idea so far:smile:
@savelichalex: what I do is: 1. build step that adds a json file to the ios app bundle 2. read the json file in objectivec code 3. pass that as initial props to the cljs code
that allows me to specify settings by environment (the build script injects a different json file depending on the env)
@pesterhazy: Do you have an example?
@savelichalex: it's a bit hard to extract from our code right now
not very elegant either
my point is mostly that env variables are not the best solution
@pesterhazy: I’m just want to know more specific technical details on each step. I’m really don’t want to invent it by myself because i’m not an expert:slightly_smiling_face:
@pesterhazy: what do you mean by «ios app bundle»? this is js file?
that's basically the directory that holds all your app files (binary, images, offline js in production mode)
@pesterhazy: It seems that I have to deal with this) another noob question, how you pass that as props to cljs code?
@savelichalex: in AppDelegate.m:
self->rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Fy"
initialProperties:@{@"foo": foo,
@"deviceName": [[UIDevice currentDevice] name]
}
launchOptions:launchOptions];
@pesterhazy: foo
is json?
that's just an example; if you read a json file in objc, it'll give you a dictionary
you could pass that to the rootview
and this is app-root
component?
I guess
got it) thanks!
It’s time to create blog with all this notes about RN:smile:
oh yeah, agree
Jesus, really frustrating that there is not a single reference to my actual cljs-code in the error messages… @pesterhazy: are the error messages better in boot-react-native?
depends on the kinds of error messages
javascript stacktraces?
you can have the stacktrace printed out to the console so it does give you context
but sourcemaps don't work reliably with b-r-n yet afaik
Yes, but the only reference to cljs is to figwheel-bridge no cljs files are referenced.
I’m use console.log based error detection:smile:
yes, in bad cases console.log is needed
This is depend how you write program. With figwheel you always see result and then if error happened then just put log in last changes
one day I wrote a lot of code before run and debug was painful)
But just to clarify, runtime errors are not traceable to a cljs ns in boot-react-native either?
@vikeri: maybe repl help you with data structures? 😉
as I said, you get a normal stacktrace, which of course includes the namespaces
@savelichalex: Yes that is what I’ve been doing. But then copying the functions into the ns creates trouble. @pesterhazy: Ok then that is a very compelling argument to switch to boot-react-native…
be careful with current boot-react-native native though
it's broken for me
hehe 🙂
Hey guys,
I am using cljs-ajax to do ajax calls from react-native (On Android). Everything but the GET
calls are working perfectly – but calling GET
does not do any network operations (checked with wireshark) and calls the error handler with the following parameters: {:status 0 :status-text "Request failed" :failure :failed}
Minimal example:
;; This does not work
(ajax/GET ""
{:params {:foo :bar}
:error-handler #(js/alert %)})
;; This works perfectly
(ajax/PUT ""
{:params {:foo :bar}
:error-handler #(js/alert %)})
Do you have any hints why this happens and how to fix it?@anatoly: I recall I had the same issue. looked back to find details... not got much. I know it was android-only problem and i switched to using js/fetch
which worked fine
@jurgen_photek: Thank you – I will try it out.