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

[Question] How to set dynamic id? #280

Closed itsnyx closed 1 year ago

itsnyx commented 1 year ago

Hello,

my use case is same as the demo on the main readme.md.

I have list of small cards (image inside them ) when you tap on them it will navigate to the detail page which images are now in full screen mode , and in the detail page i have a scrollable flat list of the cards that were in the main page , so you also can scroll in the detail page, but the problem is when i start with image number 1 and in the detail page i go to image 2 and the i navigate back to the main screen the animation dosent occur , how can i fix this issue ?

this is what i want to achieve .

https://github.com/IjzerenHein/react-navigation-shared-element/blob/main/rnse-ios.gif

itsnyx commented 1 year ago

for anyone who wants to reach same effect you need to change the parameter which passed in the navigation and to do so you need to add below code to your functions when user swipes for other element for me its initalIndex param that i increment according to index changes! navigation.setParams({ initalIndex: index + 1, });