Fork me on GitHub
#reagent
<
2023-02-15
>
Galaux10:02:01

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!

Galaux10:02:44

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

juhoteperi10:02:34

I haven't needed :reload-strategy :full

2
juhoteperi10:02:53

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

Galaux10:02:09

Good to know …

Galaux10:02:49

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

juhoteperi10:02:50

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.

juhoteperi10:02:11

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

2
Galaux10:02:20

Which is supposed to do the same

Galaux10:02:44

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.

Galaux10:02:23

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

juhoteperi10:02:17

I don't use expo