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.

Consider exposing Animated.Value with transition progress (for shared element transitions)

See original GitHub issue

It’d be great if the native stack navigator supported shared element transitions. One way of implementing that, without react-native-screens needing to know anything about shared element transitions, is by exposing an Animated.Value with the progress of the current transition running.

I explored a little how one might implement this.

In here, if you switched from [UIView animateWithDuration] to UIViewPropertyAnimator, you can get fractionComplete:

https://github.com/kmagiera/react-native-screens/blob/ed997ef4ecd4cc99383386cb016bc8d79bf70279/ios/RNSScreenStack.m#L354-L375

This is an example of using UIViewPropertyAnimator with a custom view controller transition: https://stackoverflow.com/questions/27638806/transitioncoordinator-return-nil-for-custom-container-view-controller-in-ios8

From there, you would have a CADisplayLink which sets the value for the animated node with the fractionComplete from the UIViewPropertyAnimator instance.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:32
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
WoLewickicommented, Apr 15, 2021

I added a first look at exposing progress of transition between screens on both platforms in https://github.com/software-mansion/react-native-screens/pull/890. I would be thankful if you could test it and share your thoughts.

9reactions
mrousavycommented, Jun 12, 2020

@Jarred-Sumner Any updates on this? 👀

cc @kmagiera

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a shared element transition with react ...
In this lesson we're going to be building a Shared Element Transition in React Native using react-navigation, ...
Read more >
Navigate between fragments using animations
A shared element transition determines how a view that is shared between two fragments moves between them. For example, an image displayed in...
Read more >
How to use Shared Element Transition with React Navigation v5
It receives a property value called current. progress that represents the animated node progress value of the current screen.
Read more >
Delightful UI Animations With Shared ... - Smashing Magazine
With page-transition-tag CSS property, we can easily tell the browser to watch for the element in both outgoing and incoming images, keep track ......
Read more >
Smooth and simple transitions with the View Transitions API
This feature was previously called "Shared Element Transitions", and is sometimes referred to as "page transitions". The View Transition API ...
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