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 123 forks source link

Issue when navigate to a screen while current screen has shared-element #277

Open MarcHbb opened 1 year ago

MarcHbb commented 1 year ago

Context :

I have my Feed screen, with a list of items that has image When I press on one item, it navigate to the detail screen with react-navigation-shared-element transition. When I want to navigate to the next screen in the stack, the image freeze while navigation transition is happening. See the video below

https://user-images.githubusercontent.com/15633836/230051165-2bda05e9-fb17-41ea-86ff-b2a0c100a1db.MP4

unknwngera commented 1 year ago

same issue

unknwngera commented 1 year ago

@MarcHbb solved this problem by passing the following code to all screens that can be reached from this screen (in Stack.Navigator):

        sharedElements={() => {
          return [`none`]
        }}

in my case its looks like this:

      <Stack.Screen
        name={'ContentShareScreen'}
        component={ContentShareScreen}
        options={{
          header: () => <NewHeader title={'Отправить'} canBack />,
        }}
        sharedElements={() => {
          return [`none`]
        }}
      />
GhostWalker562 commented 11 months ago

Navigating back, the shared element is disappears until the transition finishes. How did you solve this @unknwngera?

mazurGit commented 7 months ago

@GhostWalker562 try this :

export const getSharedElement = (
  route: SharedElementCompatRoute,
  otherRoute: SharedElementCompatRoute,
) => {
  if (
    [ScreensWithoutSharedElement].includes(otherRoute.name  )
  ) {
    return ["none"]
  }
 }