Skip to content

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

Open

Description

@MarcHbb

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

Bug.MP4

Activity

  1. unknwngera commented on May 27, 2023

    @unknwngera

    same issue

  2. unknwngera commented on May 27, 2023

    @unknwngera

    @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`]
            }}
          />
    
  3. GhostWalker562 commented on Dec 8, 2023

    @GhostWalker562

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

  4. mazurGit commented on Apr 24, 2024

    @mazurGit

    @GhostWalker562 try this :

    export const getSharedElement = (
      route: SharedElementCompatRoute,
      otherRoute: SharedElementCompatRoute,
    ) => {
      if (
        [ScreensWithoutSharedElement].includes(otherRoute.name  )
      ) {
        return ["none"]
      }
     }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions