reagent

Galaux 2023-02-15T10:05:01.279969Z

Hi everyone, I'm switching my project from shadow-cljs+react-web to shadow-cjs+react-native+expo and I'm surprised to see that code changes to nested components don't get reflected on the UI. Said another way, consider the following reagent components hierarchy (https://github.com/galaux/reagent-expo-nested-components):

[root
 [one
  [two
   [three]]]] ;; ← `three` is a simple `[:> rn/Text "hello"]
` Changes in component three are not reflected in the UI. Changes to root, one or two are though. This is a stark difference with my previous react web setup where changes anywhere in the code were displayed right away. Notice that the project looks OK regarding https://code.thheller.com/blog/shadow-cljs/2019/08/25/hot-reload-in-clojurescript.html (notably the use of [root {:x (js/Date.now)}]). thheller mentioned using shadow-cljs' config :devtools {:reload-strategy :full} which seems to solve the problem. Also, https://stackoverflow.com/questions/74963979/why-does-updating-my-nested-reagent-component-not-update-it. Could this be an expected react-native behavior and every shadow-cljs+react-native team is using this :reload-strategy :full or am I missing something here? Any advice would be welcome :) Thanks!

Galaux 2023-02-15T10:06:44.964989Z

This would explain why one may need something like https://github.com/flexsurfer/rn-shadow-steroid ?

juhoteperi 2023-02-15T10:13:34.626109Z

I haven't needed :reload-strategy :full

👍🏻 1
juhoteperi 2023-02-15T10:15:53.115179Z

And I don't have {:x (js/Date.now)} either, but the project isn't on the latest RN yet

Galaux 2023-02-15T10:17:09.862459Z

Good to know …

Galaux 2023-02-15T10:17:49.664759Z

I could try downgrading the RN version to see if there's any difference.

juhoteperi 2023-02-15T10:17:50.843469Z

Are you using https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/react_native.cljs to register the RN root? I think forceUpdate SHOULD render the whole component tree.

juhoteperi 2023-02-15T10:19:11.788789Z

I wouldn't recommended using old RN versions, there is billion problems with the RN tooling when you go to older versions

👍🏻 1
Galaux 2023-02-15T10:20:18.811229Z

I'm not using shadow.react-native but shadow.expo https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/expo.cljs#L9

Galaux 2023-02-15T10:21:20.260299Z

Which is supposed to do the same

Galaux 2023-02-15T10:23:44.398369Z

But my problem doesn't look to be shadow-cljs related: when I open the generated app/index.js the JavaScript there is correct (up to date) … just not rendered in the UI.

Galaux 2023-02-15T10:28:23.191509Z

@juhoteperi how do you run expo? npx expo start?

juhoteperi 2023-02-15T10:32:17.190429Z

I don't use expo

Galaux 2023-02-15T10:33:45.604329Z

Ok !