cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
naomarik 2021-03-01T08:14:47.062500Z

I'm amazed how much better RN dev has come in the last two years.

đź‘Ť 3
kennytilton 2021-03-09T13:52:54.092300Z

Prithee, what stack(s) are we all using for CLJS+RN? I am getting ready to dive back in. Glad to hear it is better! My last visit was 'bout four years ago?

raspasov 2021-03-01T12:41:38.063Z

It definitely has improved 🙂 My first project with CLJS + RN was back in 2016. I would say the Expo “bare” workflow is quite nice nowadays. That’s the main difference for me.

zendevil 2021-03-01T13:13:27.063600Z

I’m using the following library like so:

zendevil 2021-03-01T13:13:49.064300Z

(:require ["react-native-google-place-picker" :default RNGooglePlacePicker])

zendevil 2021-03-01T13:14:17.064600Z

(defn add-address [navigation]
  (.show RNGooglePlacePicker
         (fn [response]
           (prn "response is " response)
           )))

zendevil 2021-03-01T13:14:28.064900Z

But I’m getting the following error:

zendevil 2021-03-01T13:14:45.065Z

zendevil 2021-03-01T13:14:49.065400Z

How to fix this?

zendevil 2021-03-01T15:00:03.066300Z

basically doing (js/console.log RNGooglePlacePicker) prints null. What am I doing wrong?

raspasov 2021-03-01T15:02:36.066400Z

try

raspasov 2021-03-01T15:03:10.066600Z

(:require ["react-native-google-place-picker" :as lib])
(js/console.log lib)

zendevil 2021-03-01T15:08:23.066900Z

@raspasov with :as it prints

{"default": null}

zendevil 2021-03-01T15:09:13.067100Z

Since the documentation says do:

import RNGooglePlacePicker from 'react-native-google-place-picker';
according to the shadow-cljs user guide that would translate to :default, isn’t it?

raspasov 2021-03-01T15:14:11.067400Z

Hmm… Not sure, I am not familiar with shadow-cljs but I doubt it’s a problem from shadow per se. Things to try: • Did you link everything properly? • Always need to rebuild from xcode when adding a new library that requires native code • Clean your xcode caches, rebuild again • Restart your shadow/etc ClojureScript server processes

raspasov 2021-03-01T15:15:13.067600Z

{"default": null}
… is suspicious, something doesn’t seem to be imported/built properly.

raspasov 2021-03-01T15:16:11.067900Z

Also, always restart yarn/npm when adding a new lib.

raspasov 2021-03-01T15:17:40.068100Z

I am not 100% certain in the necessity of all steps, but I struggled for a few weeks initially with RN to get everything working around libs, so I do all of the above without questioning it much when adding a new lib.

zendevil 2021-03-01T15:21:58.068300Z

@raspasov the documentation says react-native link for automatic link

zendevil 2021-03-01T15:22:20.068600Z

Do I have to do a manual link?

raspasov 2021-03-01T15:23:00.068800Z

Usually not.

raspasov 2021-03-01T15:23:18.069Z

If you’re on a recent React Native version.

zendevil 2021-03-01T15:25:09.069200Z

that’s right I am on a recent version

zendevil 2021-03-01T15:25:11.069400Z

react-native: 0.63.4

raspasov 2021-03-01T15:25:52.069700Z

That should be ok then, if it reports all linked properly when you added the lib initially.

zendevil 2021-03-01T15:25:59.069900Z

yes I rebuilt from xcode

raspasov 2021-03-01T15:26:05.070100Z

Have you tried without the “” react-native-google-place-picker ?

raspasov 2021-03-01T15:26:23.070300Z

I believe “” are only needed if the lib starts with @

zendevil 2021-03-01T15:28:11.070500Z

yes I tried without the apostrophes but still getting null

zendevil 2021-03-01T15:28:45.070700Z

how to clean xcode cache?

zendevil 2021-03-01T15:38:19.070900Z

I clean it using Menu Bar -> Product -> Clean Build Folder

zendevil 2021-03-01T15:41:41.071200Z

I also restarted shadow-cljs server process

thheller 2021-03-01T16:59:02.071500Z

@ps please read the doc section specifically about the default exports. https://shadow-cljs.github.io/docs/UsersGuide.html#_about_default_exports

thheller 2021-03-01T16:59:22.071700Z

you do have the correct translation using :default but unfortunately that doesn't automatically mean that it is correct. so definitely try :as as well

thheller 2021-03-01T17:00:20.072Z

beyond that shadow-cljs does not process any dependencies for RN projects. so maybe you need to restart the metro stuff and reset its indexes