Hmm, with shadow-cljs, if I have at the namespace level a :require for platform-specific library, say for Apple, like
(:require ["expo-apple-authentication" :as AppleAuthentication]
how would skip this on Android?You can require outside of a ns form, and wrap everything in ifs
Iβm surprised that library wouldnβt just be a no-op on Android though?
Yeah the require seems no-op, using it then not so no-op π And thanks! I also learned out-of-band from Deraen that js/require outside ns form is enough π Had a fear that this would be more complex π I think I still don't understand enough the bundler magic in JS land π
@viesti checkout this section
https://shadow-cljs.github.io/docs/UsersGuide.html#_conditional_reading
you probably want to do a #?(:cljs-osx ....)
interesting, clause also hallucinated me a
#?(:ios [your.ios.module :as platform]
:android [your.android.module :as platform])
so didn't believe it π
the stuff in shadow-cljs docs seems build :target specific, but here I would have a single target still :target :react-native , it's just that some of the javascript code inside the same target, use features that are exposes to the javascript virtual machine at specific platforms (android, ios)can't you create two react native targets? never did it with android+ios I used to do that with browser+android
maybe, but not sure how to make reloading changes happen so that both android and ios device+simulator get the changes loaded, from a single rn bundler
did you do react native web? Or was the web with a :browser target?
web with browser target
#(:cljs-web [:div ...] :cljs-android [TextBox ...])
right, what I'm looking for is much like what React Native in JS would be like, single Metro bundler running and both platforms served. I don't know if it is possible to run two Metro bundlers at same time, for both targets, or to have it pick up two different bundles at same time.
but interesting to hear about :browser and :react-native targets from same shadow-cljs build, there actually is, at some point, a web frontend here too
@viesti You can definitely run multiple Metro bundlers.
I have a setup for a project that has both an app and a share extension
This is with Krell, so itβll be slightly different with shadow-cljs, but once you are outputting multiple JS files from shadow (say, index.ios.js and index.android.js), you can run the Metro bundler with --entry-file index.ios.js and --bundle-output ios/bundle.js (or whatever)
@viesti our workflow was:
I worked doing the web-interface, with rough :div's, but doing the events and state things
Afterwards, a react native guy that didn't knew much about clojure, just added the :cljs-android part of the UI components
the workflow worked and I think we were very efficient in delivering the project.
all problems around state/events were debugged on the web, and simply work on react native.
(the web-interface was not part of the product)
Interesting, what did you use for state management?
#fulcro
Nice! Haven't dabbled in Fulcro myself yet π
Fulcro & pathom are awesome! unfortunately, I feel like they are a bit "all in" on tech
yeah, that has been stopping me I think, I think I haven't allocated the time to study go "all in", would like in a project, grow bit by bit