Fork me on GitHub
#cljsrn
<
2021-03-01
>
naomarik08:03:47

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

👍 9
raspasov12:03:38

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.

kennytilton13:03:54

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?

zendevil.eth13:03:27

I’m using the following library like so:

zendevil.eth13:03:49

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

zendevil.eth13:03:17

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

zendevil.eth13:03:28

But I’m getting the following error:

zendevil.eth13:03:49

How to fix this?

zendevil.eth15:03:03

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

raspasov15:03:10

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

zendevil.eth15:03:23

@U050KSS8M with :as it prints

{"default": null}

zendevil.eth15:03:13

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?

raspasov15:03:11

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

raspasov15:03:13

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

raspasov15:03:11

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

raspasov15:03:40

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.eth15:03:58

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

zendevil.eth15:03:20

Do I have to do a manual link?

raspasov15:03:00

Usually not.

raspasov15:03:18

If you’re on a recent React Native version.

zendevil.eth15:03:09

that’s right I am on a recent version

zendevil.eth15:03:11

react-native: 0.63.4

raspasov15:03:52

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

zendevil.eth15:03:59

yes I rebuilt from xcode

raspasov15:03:05

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

raspasov15:03:23

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

zendevil.eth15:03:11

yes I tried without the apostrophes but still getting null

zendevil.eth15:03:45

how to clean xcode cache?

zendevil.eth15:03:19

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

zendevil.eth15:03:41

I also restarted shadow-cljs server process

thheller16:03:02

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

thheller16:03:22

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

thheller17:03:20

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