Shared Element Transitions with Reanimated 🔄
Wednesday, March 8, 2023
demos
shared-transitions
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A navigation system with shared element transitions between screens.
What's This About?
This component implements a navigation stack with smooth shared element transitions between screens. When navigating between the home screen and details screen, elements that appear in both screens can animate smoothly from their position in one screen to their position in the other. The implementation uses React Navigation with custom animation configurations for seamless transitions.
Technical Implementation
The component uses:
React Navigation
Stack navigation
Shared elements
Custom animations
Screen transitions
Usage
// Navigation setup
const Stack = createNativeStackNavigator<RootStackParamsList>();
// Basic usage
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
animation: 'fade',
animationDuration: 300,
}}
>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Details" component={DetailsScreen} />
</Stack.Navigator>;
// Screen types
type RootStackParamsList = {
Home: undefined;
Details: {
// Screen params
};
};
// Navigation
navigation.navigate('Details', {
// Navigation params
});
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Shared Transitions
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback