Fork me on GitHub
#clojurescript
<
2021-01-06
>
raspasov00:01:53

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

zendevil.eth01:01:02

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

zendevil.eth01:01:21

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

zendevil.eth01:01:34

However, I’m getting the following error:

zendevil.eth01:01:02

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

zendevil.eth01:01:06

how to fix this error?

zendevil.eth01:01:56

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

p-himik09:01:41

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-himik09:01:16

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

p-himik09:01:49

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-himik09:01:01

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.eth11:01:59

View is the standard react-native View

zendevil.eth11:01:10

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

zendevil.eth11:01:26

undefined is not an object

zendevil.eth11:01:44

evaluating Object.keys(routeConfigs)

zendevil.eth11:01:18

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.eth11:01:56

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

p-himik11:01:58

> 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-himik11:01:22

Just in case - how did you import createBottomTabNavigator?

zendevil.eth12:01:52

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

zendevil.eth12:01:34

In js the function call works

zendevil.eth12:01:04

then why doesn’t it in cljs?

p-himik12:01:15

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.eth01:01:34

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

AJ Jaro22:01:14

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)

AJ Jaro22:01:14

@U38J3881W Maybe you can provide some insight here?

Olical15:01:56

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?

Olical15:01:00

I'm sorry I can't help more 😞

Olical15:01:21

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