whatisgithub

What is react-native-shared-hero?

maitrungduc1410/react-native-shared-hero — explained in plain English

Analysis updated 2026-05-18

26SwiftAudience · developerComplexity · 3/5Setup · moderate

In one sentence

A React Native library that animates shared elements flying smoothly between screens using native iOS and Android code.

Mindmap

mindmap
  root((react-native-shared-hero))
    What it does
      Hero transitions
      Native thread animation
      Gesture syncing
    Tech stack
      React Native
      Swift
      Kotlin
    Use cases
      Image list to detail
      Modal transitions
      Tab transitions
    Audience
      Mobile app developers
      React Native teams

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Animate an image expanding from a list into a detail screen

USE CASE 2

Add hero transitions to native modals and form sheets

USE CASE 3

Sync a flying element's position with swipe-back gestures in real time

USE CASE 4

Choose between snapshot crossfade or morph transition styles

What is it built with?

React NativeSwiftKotlin

How does it compare?

maitrungduc1410/react-native-shared-herorryam/relatokitappeight/app8-ios-sdk
Stars262625
LanguageSwiftSwiftSwift
Setup difficultymoderatemoderatemoderate
Complexity3/52/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires React Native's New Architecture (Fabric), does not work with the older Paper architecture, and Expo users need a development build.

The README does not specify license terms for reuse of the code.

So what is it?

react-native-shared-hero is a library for React Native apps that animates a shared element as it flies between two different screens. This effect, often called a hero transition, is when you tap an image in a list and that image appears to expand and glide into its position on the detail screen. The library handles the animation entirely in native code, using Swift on iOS and Kotlin on Android, so the movement runs on the device's native thread rather than through JavaScript, keeping it smooth under load. The library works with any navigation setup. Instead of tying itself to a specific router, it matches elements on the source and destination screens by a shared id you assign in your code. When a screen change happens, the library detects matching ids, takes a snapshot of the element, and flies it in a window-level overlay that sits above everything else, including modals and sheets, until it settles in the new position. It supports a range of use cases beyond a simple image expanding into a detail view. You can use it with native modals, form sheets, tab transitions, virtualized lists, and plain state toggles within a single screen. Two animation styles are available: snapshot mode, which clones the element and crossfades between the original and destination views, and morph mode, which also animates corner radius and background color for a smoother container-style transition. On iOS, the library tracks the left-edge swipe-back gesture and the sheet swipe-down dismiss gesture frame by frame, syncing the flying element's position with the ongoing gesture in real time. Animation timing can be configured as a physical spring or a duration-based curve with easing presets, and motion paths can be linear or arc-shaped. The library requires React Native's New Architecture (Fabric) to be enabled. It does not work with the older Paper architecture. Expo users need a development build rather than Expo Go, since the library contains custom native code on both platforms.

Copy-paste prompts

Prompt 1
Show me how to add a shared id to two React Native screens for a hero transition
Prompt 2
Explain the difference between snapshot mode and morph mode in this library
Prompt 3
Help me enable React Native's New Architecture so this library works
Prompt 4
How do I configure a spring-based animation timing for a hero transition here?

Frequently asked questions

What is react-native-shared-hero?

A React Native library that animates shared elements flying smoothly between screens using native iOS and Android code.

What language is react-native-shared-hero written in?

Mainly Swift. The stack also includes React Native, Swift, Kotlin.

What license does react-native-shared-hero use?

The README does not specify license terms for reuse of the code.

How hard is react-native-shared-hero to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is react-native-shared-hero for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.