Fork me on GitHub
#reagent
<
2020-01-13
>
knubie21:01:50

Anyone using reagent with react native? For loops in the hiccup seem to break the Text component.

p-himik21:01:06

Can you give an example? Maybe it's not related to reagent native.

knubie21:01:48

This throws some error like “Cannot convert symbol to string” (sorry don’t have the exact error ATM).

knubie21:01:25

This seems to work, though.

knubie21:01:51

I think the same thing happens with any list

knubie21:01:44

thanks for that. I’ll see if reactify-component works

p-himik21:01:05

No-no, you just have to add the correct :key metadata.

p-himik21:01:12

You shouldn't need anything else.

p-himik21:01:57

That is, if you have something truly unique to identify each text. If not, the approach with into is just fine. Or you can use mapv:

[;> rn/View
  (mapv (fn [text] [:> rn/Text text]) texts)]

knubie23:01:08

I see. Getting the same error even with the key meta data, though

p-himik07:01:31

Are you sure it's unique for each text?

knubie20:01:01

Should be, I’m using the index as the key

p-himik21:01:40

Just in case, you may want to read this then: https://reactjs.org/docs/lists-and-keys.html#keys

p-himik21:01:08

As of your particular issue - I would just try to debug it and see what's going on. You should be able to debug CLJS in a browser just fine.