IjzerenHein / react-navigation-shared-element

React Navigation bindings for react-native-shared-element 💫
https://github.com/IjzerenHein/react-native-shared-element
MIT License
1.27k stars 124 forks source link

Same image on page causes confusion #137

Open dan-fein opened 3 years ago

dan-fein commented 3 years ago

Hi all -

I have a list of "Thing"s and sometimes they appear multiple times on the same screen. They have the same ID (they're the same "Thing" so naturally using that ID like this: id={thing.${things[0].id}.image} causes the image to go to any of them. I'm wondering what you guys do for cases like this?

Do you advise for creating unique IDs and sharing those from screen to screen as props, so it's not tied to the Thing overall but rather this instance of a Thing?

Anything else to consider?

Thanks in advance!

darrylyoung commented 3 years ago

How did you end up getting around this issue, @danielfein? I just came across the same thing.

Update: I ended up just passing the id plus a random string and that helped with the duplicate issue.

IjzerenHein commented 3 years ago

So I think the most pungent question here is, what would you like to happen? As in, what would you like to see as in the visual transition on the screen? Once that is clear, I think it will be much clearer on how to reason about how to achieve it