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.

🦸🏻‍♂️ Hero/Shared Element Animation for Native Stack Navigator

See original GitHub issue

Intro

Hi!

I’m currently using react-navigation-shared-element to create shared element transitions between screens, which uses the StackNavigator from react-navigation under the hood (so not the native one from react-native-screens, there’s an issue for this here) and therefore suffers from bad performance. (It is an awesome library though!)

Approach

So I’m trying to come up with performant alternatives. I have thought about creating a Native Module/library which wraps the Hero library and an Android alternative, so you can declare React Components like this:

<Hero id="image1">
  <Image source={source} ... />
</Hero>

… wrap those in a Native Stack Navigator and let the library automatically create Shared Element / Hero Transitions for you on each navigation (props.navigation.navigate(...)).

      

So why am I opening this issue?

I wanted to ask first before I try to dig around the source code and eventually waste a lot of time:

  1. How is the Native Stack Navigator implemented, does it essentially create multiple View Controllers between routes?
  2. If it does, do I have access to those View Controllers? (That wouldn’t be the biggest problem, since I can use parentResponder in a View to go up the View tree anyway)
  3. Do you have any advice I should look out for?

If it does not create multiple View Controllers, then I guess there would be no way of getting the Hero library to work, since that requires navigation between multiple View Controllers.

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:26
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
nandorojocommented, Dec 1, 2020

I appreciate the detailed and quick response. I’m pretty deep into using React Navigation (and managed Expo), so this solution unfortunately won’t work for me.

The video on your Twitter looks awesome though, congrats! Glad you were able to solve it for your app.

For now, I’ll keep trying to figure this one out. I’d love to use it with native stack if possible.

4reactions
hirbodcommented, Sep 28, 2021

I donated $200 😛

Here is the branch with the current progress: https://github.com/IjzerenHein/react-navigation-shared-element/tree/native-stack

Quote from @IjzerenHein : “As far as progress, I’ve made a start but have not yet been able to spend any more time on it as I’m in the process of moving and also due to other work obligations. I’m expecting to resume work within the next 2 weeks.”

This was a week ago, so he hopefully will continue in a week or so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Shared Element Transition - YouTube
In this clip, we build a simple shared transition using react- native - shared - element ...
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 >
Shared element transitions | Voters - React Navigation - Canny
Config hero animations in screen options. Aron. Can we just config shared elements aka hero animations in. ScreenOptions ? For now, react-navigation ......
Read more >
Community-developed Navigators and Libraries
Fluid Transitions is a library that provides Shared Element Transitions during ... Since react-navigation's header is designed as Animated component, ...
Read more >
Extra Hot Great: This Week In TV - Audioboom
Maris on Substack ... We each share the TV location we'd most like to visit on holiday, ... Lead Topic: 🦸🏻‍♂️ The Greatest...
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