Fork me on GitHub

:man-raising-hand: @thheller I'm probably doing something stupid but I can't seem to import this expo module. I think I'm doing it correctly according to shadow-cljs import directions. But it doesn't seem to work.

(ns time-align-mobile.handlers
    ["expo-file-system" :as FileSystem :refer [documentDirectory]]

;; Then after loading the namespace into the repl

cljs.user> (ns time-align-mobile.handlers)
time-align-mobile.handlers> (identity FileSystem)

time-align-mobile.handlers> documentDirectory
;; output cleared

time-align-mobile.handlers> (.-documentDirectory FileSystem)
;; output cleared

time-align-mobile.handlers> FileSystem/documentDirectory
;; output cleared

time-align-mobile.handlers> (.documentDirectory FileSystem)
;; output cleared

;; all result in an error like this

repl/invoke error, [TypeError: undefined is not an object (evaluating 'shadow.js.shim.module$expo_file_system.documentDirectory')]


@jgoodhcg I think your issue might just be doing (ns ...) instead of (in-ns ...) from the REPL

thanks2 4

(it also might not, but if it’s actually shadow-cljs, I won’t know the answer)


Yeah, doing ns clears out any aliases you might have set up. More exposition on that here

thanks2 4

@jgoodhcg all the requires in react-native are filled in by metro which means they can't be done dynamically at the REPL. It only works when the namespace is loaded regularly and then switched to via in-ns

thanks2 4