Fork me on GitHub
#cljsrn
<
2019-04-11
>
manu14:04:52

Hi! I would like to use visual studio for clojurescript. Someone know what is the best configuration ? (if it exists) thx šŸ™‚

emil0r20:04:17

So Iā€™m trying out rn with shadow-cljs. Complete noob at rn and android development, so Iā€™m probably missing something. following the shadow-cljs config guide Iā€™ve set the build target to :react-native, :init-fn to hello.core/init and :output-dir to ā€œappā€. In addition Iā€™ve changed the android/app/build.gradle project.ext.react to point to ā€œapp/index.jsā€. When I then build with react-native run-android it compiles the original index.js file. I somehow managed to get it to point to the app/index.js previously (which was pretty broken as well), but now I canā€™t seem to get it to build from the correct index.js. Iā€™ve restarted adb a couple of times, tried to clear cache, rebuilt cljs, restarted the metro

emil0r20:04:28

Sort of run out of ideas of what it could be

thheller20:04:35

@emil0r did you see this repo? I also couldn't figure out how to make it not use the index.js in the root so I just made that import the app/index.js instead. https://github.com/thheller/reagent-react-native/blob/master/index.js#L15

thheller20:04:21

I didn't touch any of the android stuff and this seems to be working fine

emil0r20:04:18

OK. I tried that before and got it working, but the hot code reload didnā€™t seem to work

emil0r20:04:25

So I thought I needed that

thheller20:04:59

hot reload worked fine in the repo above so it should work

emil0r20:04:59

Not working in my setup. Probably bungled it somehow. Will clone your repo tomorrow and take a look at the diffs

emil0r20:04:31

Awesome work with shadow-cljs btw @thheller šŸ™‚

4
thheller20:04:09

make sure you have a function properly marked that should be called after code is loaded (eg. https://github.com/thheller/reagent-react-native/blob/master/src/main/test/app.cljs#L62)

thheller20:04:43

also the render-root logic takes core of the hot reload stuff since react-native is a bit picky about components and stuff

emil0r20:04:29

I copy pasted your app.cljs into mine and copied the image youā€™re loading for shadow. The app loads fine, and shadow-cljs compiles it when I changed the text to include an extra exclamation mark

emil0r20:04:11

But no hot reload

thheller20:04:07

uhm there is one problem where the logic to pick your local IP may be picking a wrong one

thheller20:04:43

make sure you see the Websocket connected message when your app loads the code

thheller20:04:52

react-native log or whatever the command was to see the log

thheller20:04:06

expo just shows it in the terminal directly but rn doesn't I think

thheller20:04:33

if you don't see that it might just fail to connect the websocket required for hot reload

emil0r20:04:59

Got it. I wasnā€™t using :devtools {:autoload true} in my config file

thheller20:04:00

if you run shadow-cljs watch app --verbose it'll log the IP it is using on start

thheller20:04:21

oh .. ok yeah. need to change that default šŸ˜‰

emil0r20:04:43

Thatā€™s where I copied the config for rn from

emil0r20:04:02

probably went about this the wrong way šŸ˜›

emil0r20:04:10

Copying from other config files

thheller20:04:50

right yeah the docs for :react-native are severly lacking at the moment

thheller20:04:59

hope to put in more details soon