`sharedElements` function is not called when using alphav2 stack navigator
See original GitHub issueFirst 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
andExercise
<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:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
Ah that explains it. Yeah v2 is still in alpha and things like certain lifecycle events are not working correctly with that yet