Fork me on GitHub
#cljsrn
<
2023-02-16
>
dazld13:02:26

I noticed a couple of people mentioning that they wrap components to get around a warning in react-navigation, something about an invalid component name. I’m not sure it’s in the docs, but after digging around in reagent’s code, I found that reagent will take a display-name meta attribute as an override for the name of the component, meaning we can specify SomethingValid` and avoid having to wrap components, or ignore warnings. Here’s an example:

(r/reactify-component (with-meta (fn name [{:keys [^js route]}]
                                   [component {:route (bean/->clj route)}])
                                 {:display-name display-name}))
hope this helps someone 🙌

🎉 6
hadils17:02:52

Thank you @U3ZUC5M0R! This is very helpful.

👍 2
UlisesMAC19:02:03

This should be pinned! 😆 I had to ignore those warnings (using logbox), thanks for sharing this!

🙌 2
dazld13:02:33

on another topic - I can’t figure out yet, how to make the navigator not lose state on reload - I’m using shadow. How do you all handle this?

2
dazld15:02:04

answering my own question.. missed the doc page which describes in detail how to do this 🙂 https://reactnavigation.org/docs/state-persistence

dima18:02:16

hey, you already answered it, but i add link to similar question asked in this channel before https://clojurians.slack.com/archives/C0E1SN0NM/p1652439790706039?thread_ts=1652431961.516389&amp;cid=C0E1SN0NM

🙌 2