question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`sharedElements` function is not called when using alphav2 stack navigator

See original GitHub issue

First of all: Thank you for creating this amazing library

I played around for about an hour now but couldn’t get it to work. Things I’ve done:

  • Installed both libs
  • pod install (RN 0.60, React Navigation 4)
  • Recompiled app
  • added shared navigator (it’s nested in a Tab navigator maybe thats the problem?)
 Exercises: createSharedElementStackNavigator(createStackNavigator, {
     Exercises,
     Exercise
 }),
  • Added on both screens Exercises and Exercise
<SharedElement id="testing">
    <Text>{exercise.name}</Text>
</SharedElement>
  • And finally added the sharedElements static method (also tried in both files)
Exercises.sharedElements = () => {
  console.log("i am here");
  return "testing"
};

Sadly I don’t see anything changed. App runs as normal but no animations between the screens. Did I do anything wrong?

Thanks 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
IjzerenHeincommented, Sep 6, 2019

Well what I would do in your case, is try and repro it with the smallest app possible. In this case that would probably mean to add a switchNavigator to the RN60 demo and see whether that causes the problem. I don’t think so though cause I also have a switch and tab-navigator in my app, and it works for me. Perhaps also try deleting node_modules and your yarn.lock to ensure you’re really using the same deps. And also perform a yarn start --reset-cache

0reactions
IjzerenHeincommented, Sep 6, 2019

Ah that explains it. Yeah v2 is still in alpha and things like certain lifecycle events are not working correctly with that yet

Read more comments on GitHub >

github_iconTop Results From Across the Web

`sharedElements` function is not called when using alphav2 ...
Things I've done: Installed both libs; pod install (RN 0.60, React Navigation 4); Recompiled app; added shared navigator (it's nested in a Tab ......
Read more >
React native shared elements won't work with react navigation 4
I've tried to implement this according to the documentation, but it's not working. Please see the code: My Router: const HomeStack = ...
Read more >
Stack Navigator | React Navigation
Stack Navigator provides a way for your app to transition between screens where each new screen is placed on top of a stack....
Read more >
How to use Shared Element Transition with React Navigation v5
A Shared Element Transition determines how two different views share one or more elements to maintain the focus and experience.
Read more >
react-navigation-shared-element - npm
Create a stack-navigator using createSharedElementStackNavigator; Wrap your component with <SharedElement> and provide a unique id ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found