Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MarcHbb opened this issue Apr 5, 2023 · 4 comments
Open

Comments

@MarcHbb
Copy link

MarcHbb commented Apr 5, 2023

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
@unknwngera
Copy link

same issue

@unknwngera
Copy link

unknwngera commented May 27, 2023

@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
Copy link

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

@mazurGit
Copy link

mazurGit commented Apr 24, 2024

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants