cljsrn

xfyre 2025-09-01T03:20:42.487709Z

Hooks related question (I'm using Reagent 1.1.1, so in theory it should be fine). I'm using something very similar to the example from documentation, and rendering fails with Assert failed: Invalid tag: '' Any pointers what might be wrong? RN 0.81.1, shadow-cljs

xfyre 2025-10-10T18:32:47.368089Z

So following up on this, I still couldn't get :f> to work in React Native - it fails with invalid tag '' error. Irrespective of the component level in the hierarchy. I was able, however, to use documented "Pre 1.0 workaround" from reagent docs. This way I could make hooks work.

2025-09-02T01:46:26.936639Z

Just create the first component as a regular one. And create a separate wrapper for your f:> It's a bit complicated to debut by just looking at this. But reagent completely supports funcional components in react native. Alternatively you can enable f comps by default by adjusting the existing compiler.

xfyre 2025-09-02T01:49:26.519709Z

Sorry, I'm not sure I'm following. Root component should be a regular one, and then I can use f:> for a child component, that's the idea?

2025-09-02T02:03:28.015859Z

Yeah, that's what I meant. But also try enabling functional components by default in the built-in reagent complier. It's way easier since modern react uses a lot of hooks. Take a look at Status repo, it's a great example of a complex app built

xfyre 2025-09-02T02:34:56.386089Z

Thank you!

xfyre 2025-09-01T04:26:19.907449Z

It seems like Reagent doesn't recognize :f> modifier in RN environment

2025-09-01T04:44:08.342479Z

Reagent recognizes it. I think you should give more context about the error

2025-09-01T04:46:17.374499Z

https://github.com/status-im/status-mobile big app in Cljs + RN +Reagent (dead, but I worked there, also forked a component library based on it, reagent was never a problem).

2025-09-01T04:50:26.079259Z

Recently released an app with RN 0.81.1 and Reagent. I'd say you are using a non-existing tag, e.g. :div doesn't exists on RN. I'm also building a regent extended compiler (widely used in my apps, but need to improve the readme and docs a lot) In case you are interested: https://github.com/ulisesmac/reagent-extended-compiler It basically allows you to extend the built-in components, so you can use:

[:rn/view {}
 [:rn/flat-list {}
...]]

xfyre 2025-09-01T05:03:04.049689Z

I'm trying to replicate default App.tsx setup with SafeAreaProvider. Very basic setup:

(defn- safe-area-content []
  (let [safe-area-insets (rv/use-safe-area-insets)]
    (fn []
      [rv/view {:safeAreaInsets safe-area-insets}
       [rv/gesture-handler-root
        {:style {:flex 1}}
        [appnav/central-app-switch-v5]
        ]
       ]
      )
    )
  )

(defn- safe-area-root []
  (let [is-dark-mode? (= (rv/use-color-scheme) "dark")]
    (fn []
      [rv/safe-area-provider
       [rv/status-bar {:barStyle (if is-dark-mode? "light-content" "dark-content")}]
       [:f> safe-area-content]
       ]
      )
    )
  )

(defn- app-root []
  (r/create-class
    {:display-name        "app-root"
     :reagent-render      (fn app-root-render []
                            [:f> safe-area-root]
                            )
     :component-did-mount #(do
                             (dispatch [:check-stored-session])
                             (n/setup-notification-listeners)
                             )
     }
    )
  )

xfyre 2025-09-01T05:03:40.560429Z

Using :f> results in the failure described above

xfyre 2025-09-01T05:04:24.018709Z

It looks like Reagent can't render :f> in absence of DOM

xfyre 2025-09-01T05:04:56.013229Z

I have to use :f> because I need native hooks

xfyre 2025-09-01T05:05:15.596359Z

[without it there'a another failure about attempt to use hooks outside of functional components]