clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
raspasov 2021-01-06T00:54:33.173Z

@claudius.nicolae I guess hacky but there’s this https://github.com/ptaoussanis/encore/blob/master/src/taoensso/encore.cljc#L307

raspasov 2021-01-06T00:55:53.173600Z

@claudius.nicolae That’s exactly the same as the one you’ve posted in the link, nevermind

zendevil 2021-01-06T01:45:02.174100Z

I am using the react navigation library to create a Bottom Navigator as follows, and I’m using reagent with react-native

zendevil 2021-01-06T01:45:21.174400Z

(defn root-comp []
  (let [Tab (createBottomTabNavigator)]
    [:> Tab.Navigator
     [:> Tab.Screen {:name "Home" :component [:> View]}]]
    )])

zendevil 2021-01-06T01:45:34.174800Z

However, I’m getting the following error:

zendevil 2021-01-06T01:46:02.175400Z

undefined is not an object (evaluating ‘Object.keys(routeConfigs)’)

zendevil 2021-01-06T01:46:06.175600Z

how to fix this error?

zendevil 2021-01-06T01:50:56.176400Z

I’ve also tried replacing Tab.Navigator with (. Tab -Navigator) and so forth but am getting the same error

p-himik 2021-01-06T09:23:41.177200Z

Seems like routeConfigs is undefined, whatever and wherever it is. Try enabling breaking on every exception and see where it breaks while browsing through the call stack.

p-himik 2021-01-06T09:24:16.177400Z

Also, this is definitely wrong: :component [:> View]

p-himik 2021-01-06T09:25:49.177600Z

Tab.Screen expects a React component but you're passing it a Hiccup vector. Even if it were expecting a React element, you would still have to convert the Hiccup vector into a React element with reagent.core/as-element. In this case, what you need to do depends on what View is.

p-himik 2021-01-06T09:28:01.177800Z

One more thing - the Tab.Navigator syntax is not strictly correct. It works but not because it should but rather because of historical reasons IIRC. Ideally, it should be (.-Navigator Tab) where Tab is defined with the ^js tag.

zendevil 2021-01-06T11:09:59.178400Z

View is the standard react-native View

zendevil 2021-01-06T11:17:10.178600Z

just evaluating the (createBottomTabNavigator) is giving the following error:

zendevil 2021-01-06T11:17:26.178800Z

undefined is not an object

zendevil 2021-01-06T11:17:44.179Z

evaluating Object.keys(routeConfigs)

zendevil 2021-01-06T11:33:18.179200Z

changing component to the following:

(defn root-comp []
  (let [Tab createBottomTabNavigator]
    [:> (. Tab -Navigator)
     [:> (. Tab -Screen) {:name "Home" :component (r/as-element [:> View])}]
     #_[:> (. Tab -Screen) {:name "Investments" :component [:> View]}]]
    )
  #_[:> SafeAreaView
   [:> View
   [google-signin-comp]
    [:> Text "Signed in " (if @(subscribe [:signed-in]) "Signed In" "Not Signed In")]
    ]])
gives the following error:

zendevil 2021-01-06T11:33:56.179400Z

Element type is invalid: expected a string (for built-in components) or a class/function but got:undefined

p-himik 2021-01-06T11:34:58.179600Z

> just evaluating the (createBottomTabNavigator) is giving the following error Means it's something inside the library. I don't see anything in your code that would cause it.

p-himik 2021-01-06T11:35:22.179800Z

Just in case - how did you import createBottomTabNavigator?

zendevil 2021-01-06T12:12:52.180Z

[“react-navigation-tabs” :refer (createBottomTabNavigator)]

zendevil 2021-01-06T12:13:34.180200Z

In js the function call works

zendevil 2021-01-06T12:14:04.180700Z

then why doesn’t it in cljs?

p-himik 2021-01-06T12:47:15.180900Z

Sorry, no idea - I don't work with React Native so I cannot really check. But the documentation says that you should import it from @react-navigation/bottom-tabs, not from react-navigation-tabs. Maybe there's no difference, no idea.

zendevil 2021-01-07T01:59:34.187500Z

two different sections in the documentation import from each, so both should work. However, using bottom tabs gives me the error that the app isn’t registered

2021-01-06T04:16:04.176800Z

• I have actually read that and it is clear enough 🙂 • It's just that, Helix and other libraries tries to achieve the same - on the surface • But on digging further one can get an idea how they differentiate • AFAIS, Helix is tiny/minimal library

AJ Jaro 2021-01-06T22:49:14.186Z

Is anyone running https://github.com/Olical/cljs-test-runner? I have been getting this error message when I run it and I haven’t been able to figure it out. > Error: Cannot find module ‘xmlhttprequest’ > Require stack: > - /Users/aj/Documents/lumanu/ic/cljs-test-runner-out/ajax/xml_http_request.js > - /Users/aj/Documents/lumanu/ic/cljs-test-runner-out/goog/bootstrap/nodejs.js > - /Users/aj/Documents/lumanu/ic/cljs-test-runner-out/cljs_test_runner.gen.js >   at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15) >   at Function.Module._load (internal/modules/cjs/loader.js:898:27) >   at Module.require (internal/modules/cjs/loader.js:1089:19) >   at require (internal/modules/cjs/helpers.js:73:18) >   at /Users/aj/Documents/lumanu/ic/cljs-test-runner-out/ajax/xml_http_request.cljs:35:25 >   at Object.<anonymous> (/Users/aj/Documents/lumanu/ic/cljs-test-runner-out/ajax/xml_http_request.js:32:3) >   at Module._compile (internal/modules/cjs/loader.js:1200:30) >   at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10) >   at Module.load (internal/modules/cjs/loader.js:1049:32) >   at Function.Module._load (internal/modules/cjs/loader.js:937:14)

Olical 2021-01-07T15:51:56.202700Z

Hmm I've never seen this before I'm afraid, I'd guess it's to do with your clojurescript version or setup more than anything?

Olical 2021-01-07T15:52:00.202900Z

I'm sorry I can't help more 😞

Olical 2021-01-07T15:52:21.203100Z

I don't ever try to use xmlhttprequest, so I think it's something slightly lower level than cljs-test-runner?

AJ Jaro 2021-01-06T22:50:14.186200Z

@olical Maybe you can provide some insight here?