This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-28
Channels
- # aleph (7)
- # babashka (13)
- # beginners (10)
- # biff (4)
- # calva (75)
- # cljs-dev (22)
- # clojure (55)
- # clojure-berlin (1)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-norway (35)
- # clojure-serbia (1)
- # clojure-uk (2)
- # clojurescript (46)
- # community-development (1)
- # core-async (23)
- # data-science (1)
- # datalevin (2)
- # datascript (10)
- # datomic (11)
- # fulcro (28)
- # helix (12)
- # hyperfiddle (26)
- # introduce-yourself (4)
- # malli (16)
- # off-topic (1)
- # pathom (4)
- # pedestal (1)
- # polylith (12)
- # quil (11)
- # releases (3)
- # scittle (24)
- # shadow-cljs (85)
- # specter (1)
- # sql (9)
- # xtdb (5)
I am using helix in an Expo project. React Navigation v6 reports the following warnings:
Got a component with the name 'yardwerkz$features$user_type$components$user_type_view$UserType_render' for the screen 'UserType'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.
for every Helix component. Is there a way to resolve this? Thanks in advance!iirc the first argument to defnc provides the display name of a component. it shouldn't have $ symbols in it, I think
I think this was the case a while ago, but now it isn’t. E.g.,
(defnc UnderConstructionRenderer
[props]
($ rn/SafeAreaView {:style {:flex 1 :justifyContent "center" :alignItems "center"}}
($ rne/Text {:h2 true} "Under Construction")))
My helix components all look similar.I really hate this check, it's totally unnecessary. Here's what I suggested before but the last person said it didn't work, you could try it though: https://clojurians.slack.com/archives/CRRJBCX7S/p1694105114390509?thread_ts=1694096188.205379&cid=CRRJBCX7S
I would open an issue with react-navigation to remove this warning or allow it to be turned off if I were you
Thank you @U4YGF4NGM. I will do that.
Frustratingly, it looks like react-navigation doesn't check the displayName
but rather the name
property. This is something that helix doesn't control, it's based on how your build outputs the JS. https://github.com/react-navigation/react-navigation/blob/d90ed7665be74c570ed2a6a4da612230fcf6a01c/packages/core/src/useNavigationBuilder.tsx#L222
There seems to be a way to provide a function returning an element as a child of the Screen. However, it needs to be memoized.
(let [render-my-component (use-callback [my-component] (fn renderMyComponent [props] ($ my-component {& props})))]
($ Screen render-my-component))
I have this:
(defn wrap-nav-screen [Component] (-> Component (h/memo)))
($ Screen {:name "Home" :component (wrap-nav-screen Home)})
It seems to be working, but I am not convinced yet.Thank you for your suggestion @U4YGF4NGM. My solution was incorrect.