This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-11
Channels
- # announcements (16)
- # aws (4)
- # babashka (30)
- # beginners (58)
- # bristol-clojurians (4)
- # cider (9)
- # clj-kondo (2)
- # clojure (229)
- # clojure-europe (25)
- # clojure-gamedev (1)
- # clojure-italy (4)
- # clojure-nl (13)
- # clojure-sanfrancisco (1)
- # clojure-uk (97)
- # clojured (7)
- # clojurescript (27)
- # code-reviews (2)
- # cursive (30)
- # data-science (39)
- # datomic (14)
- # emacs (12)
- # events (2)
- # fulcro (6)
- # graalvm (8)
- # graphql (14)
- # jackdaw (10)
- # jobs (2)
- # lambdaisland (5)
- # malli (4)
- # off-topic (28)
- # protorepl (13)
- # quil (7)
- # re-frame (2)
- # reagent (1)
- # reitit (3)
- # remote-jobs (5)
- # ring-swagger (1)
- # shadow-cljs (72)
- # sql (4)
- # tools-deps (182)
- # uncomplicate (4)
- # vim (9)
- # xtdb (19)
Anyone have a shadow-cljs react-native template without expo?
I tried booting up https://github.com/fbielejec/shadow-cljs-react-native but on my Android VM it immediately gives the red React-Native error with Unknown
at the top (from NativeRunnable.java, not very helpful)
@quest not a template but this is the last example I made using only react-native https://github.com/thheller/reagent-react-native
@thheller Thank you. I appreciate your uncanny ability to have an answer for everything. I bumped the react+native/reagent/shadow-cljs & added APK release instructions, opened PR https://github.com/thheller/reagent-react-native/pull/4
@quest are you sure its safe to update the dependencies like that without touching the react-native dir (the generated files)?
I assume they were regenerated after npm install
, but I can't say for certain. The build still works after updates on my box
if it's a straightforward safe path I could run the react-native init AwesomeProject
and update the PR after I'm up tomorrow
Any time. I'm going to swap in re-frame into the template tomorrow, will release an example repo for that too.
Little bit of context: I've been working on an app from the Expo re-frame template, but hit a point where I needed to access an Android API directly. You can do this with an ejected Expo app, but you lose many of the advantages of Expo.
And your app exists in a sad intermediate "not react-native vanilla" and "not expo" state, so you lose all of the simplicity of Expo and accuracy of documentation for vanilla react-native.
Got a json parse exception on run shadow.cljs.build-report app target/build-report.html
Illegal character ((CTRL-CHAR, code 0)): only regular white space (\r, \n, \t) is allowed between tokens
file: .shadow-cljs/builds/app-release-snapshot/release/shadow-js/module$node_modules$object_assign$index.js
look at node_modules/object_assign/index.js
with hex editor, does it contain any zero bytes?
e.g. (I can imagine) running npm install and some other tools stepping one each other toes when updating the files
there is probably something fishy in your setup which could cause clobbering those files
didn’t you run any background process dealing with npm modules, e.g. npm install from terminal and concruently yarn install via IDE, or something like that
could be a network error as well, and npm happily wrote incomplete file during update, hard to say
cljsjs provide extern files for react, while shadow-cljs uses npm, should i do something extra for google closure to work properly?
is it even normal to have 120+ kb of react, i've heard it's not very keen on dead code elimination
not sure what you are asking? react-dom stays pretty much the same size it has on npm. so yes 120+kb is normal
I was trying to get re-frisk-remote
working for a react-native app that I build using a shadow-cljs with deps managed in a deps.edn
file. Since there is no leiningen involved I’m not sure how to start the the web (i.e. lein re-frisk
). So I guess I make my own ‘plugin’ for tools.deps
to get an equivalent server running? Probably the wrong channel to ask, though.
It’s a debugging tool for re-frame
based applications. re-frame is based around a single central app-db and re-frisk/re-frisk-remote can be used to trace and inspect the content of this db. The leinigen plugin spins up a web-server on the dev machine to provide the UI for traceing/inspecting the remote db. https://github.com/flexsurfer/re-frisk
Currently the inspect feature of shadow-cljs comes in handy and I can tap>
re-frame’s app database. I will try to find some time to make the server component of re-frisk-remote standalone so I can use it with shadow-cljs and tools.deps.
@mazin there is also https://gitlab.com/synqrinus/syn-antd, can just require the components what one needs.
Can i goog-define
some constant in some namespace ns.a
and use it in another ns.b
? This doesn't seem to work if I require the ns.a
from ns.b
@g7s as far as CLJS in concerned (goog-define THING "foo")
is the same as (def THING "foo")
. so you'd refer to it like any other def using a/DEBUG
(assuming (:require [ns.a :as a])
)
is it possible to have shadow-cljs pickup a certain file based on its "extension"?
i.e. in js you could configure webpack or metro to pick up .native
or .web
extensions
or do you have to create completely different namespaces for each platform?
no thats not supported. not sure why it should be though. what exactly do you want to do?
I wrote about how I deal with platform specific code some time ago, maybe that helps https://gist.github.com/thheller/fa044450a6470fdd1afdbcf3f37a65e3 ?
i'm creating a single, cross platform app with react-native and react-native-web
most of the code will be the same, but sometimes a certain file/feature will have to be different. so in js i could differentiate it simply by differretn file extensions, i.e. feature.web.js
feature.ios.js
and a single import statement into the app import feature from 'feature'
yeah, different files, but one import statement - so you can create a single app rather than a native app and a web app, with shared modules
so you can configure :build-options {:ns-aliases {some.app.feature some.app.feature-web}}
so whenever anything tries to access some.app.feature
it would end up using some.app.feature-web
instead
ie (:require [some.app.feature :as x])
would actually be (:require [some.app.feature-web :as x])
that will definitely work, thank you would it be possible to configure a convention globally?
in webpack for example, you have a list of extensions that are picked up, i.e., extensions: ['.web.js,' '.js']
ns-aliasing should be the absolute last resort and pretty much only used if you don't have control over the code you need to alias
writing interfaces with different implementations is a common software pattern. use it.
thank you for recommendation, will read gist again and reconsider. but, from what I can tell, in both cases you're creating different implementations* based on same interface, it's just about the ease of being able to import them into single app (you let the bundler handle importing them based on some convention)
yeah dunno I've never build a real react-native/web hybrid so no clue how well that actually works
@thheller So I just ran into a bit of footgun for the second time and I am not sure if shadow can help with this or what your advice is BUT here is the scenario: I am setting up segment to do tracking which requires you to use their analytics.js script from the window
and then without putting it together until just now I had a namespace called analytics
and then a file called segment
so analytics.segment