Fork me on GitHub
#cljsrn
<
2021-08-21
>
kennytilton08:08:27

So, thanks to #helix and #clojurescript, MatrixRN is coming along OK. Only "OK" because FB engineers just seem to make things up as they go and I am starting to think I will have to handle every built-in component differently. Whining aside, my next milestone is async HTTP. Is https://github.com/r0man/cljs-http the way to go? Not seeing anything else other than interop with fetch. Thx! 🙏

kennytilton20:08:11

Got a dummy interop Q here: what on Earth is #object[String]? Using the cljs-http example: (http/get "https://api.github.com/users" {:with-credentials? false :query-params {"since" 135}}) I pull the users as suggested with: (map :login (:body response)) Looks great, except when I offer the first as the title of a Button (have not figured out Text yet, of all things), ReactNative complains: "Invariant Violation: The title prop of a Button must be a string" So I print out the type and sure enough it is #object[String]. js->clj does not help. str works, but I do not get why: (type (str etc)) also returns #object[String]! Weirdly, if I (map str (map :login etc)) as soon as I get the response, I still have to call str when passing the first username as the title! So...what on Earth is #object[String]?! The Google is silent, tho with tons of hits on translating key-value kinda objects. btw, I can use goog.object to get all the keys: length, 1,2,3... 🙂 object[String] aside, I am exploring having cljs-http convert the response (if I can figure out that incantation). But that would be an ugly way out.

kennytilton01:08:15

So the response body values are all ValSeq's, and the right way to convert to a string RN will like is --wait for it -- str!