react-navigation-shared-element icon indicating copy to clipboard operation
react-navigation-shared-element copied to clipboard

Correctly navigate to/from screens of the same name.

Open iamdavidmartin opened this issue 3 years ago • 1 comments

In createSharedElementScene.tsx, changed function to use route.key instead of route.name when checking to see if the current route is active. Previously, all screens that had the same name in the stack think that they are active when the navigation event fires. This correctly finds the one screen that is active to perform the correct transition.

In SharedElementRendererData, when updating share elements, use variable to correctly send the screen's 'sharedElements' function the showing state. This fixes a bug where, if a user went backwards to a screen of the same name, the "showing" parameter in the 'sharedElements' function would be true when it should be false.

Please take a look at the example I added. These fixes now allow for properly navigating back and forthwith a screen of the same name.

Here's the issue I created that this PR addresses.

https://github.com/IjzerenHein/react-navigation-shared-element/issues/220

iamdavidmartin avatar Jan 11 '22 21:01 iamdavidmartin

@IjzerenHein this seems interesting 👀I think it deserves a review Hein!

haibert avatar Jan 25 '22 02:01 haibert