Back to Blog
January 4, 20268 min readHow to Recreate

How to Recreate a Modern Travel App from Video to React Native with Replay: Full Tutorial

R
Replay Team
Developer Advocates

TL;DR: This tutorial demonstrates how to use Replay to reconstruct a complete React Native travel application from a screen recording, leveraging its behavior-driven reconstruction capabilities.

From Video to React Native: Recreating a Travel App with Replay#

The promise of code generation tools has always been faster development cycles. But most tools stumble when faced with the complexity of real-world user flows. Screenshot-to-code tools are limited by static images, failing to capture the dynamic nature of user interaction. Replay offers a paradigm shift: behavior-driven reconstruction. By analyzing video of a user interacting with an application, Replay understands the intent behind the UI, enabling accurate and functional code generation.

This tutorial will walk you through recreating a modern travel application using Replay, starting from a simple video recording of the app in action. We'll explore the key features of Replay and demonstrate how they can be used to generate a complete, working React Native application.

Understanding Behavior-Driven Reconstruction#

Traditional code generation often relies on static representations of the UI, like screenshots. This approach misses crucial information about user behavior, such as transitions, animations, and dynamic data updates. Replay addresses this limitation by analyzing video recordings.

Replay's "Behavior-Driven Reconstruction" engine uses Gemini to understand user flows and translate them into functional code. It doesn't just see pixels; it understands what the user is trying to accomplish. This allows Replay to generate code that accurately reflects the application's intended behavior.

FeatureScreenshot-to-CodeReplay
InputStatic ScreenshotsVideo Recordings
Behavior AnalysisLimitedComprehensive
Dynamic UIDifficultSeamless
AccuracyLowerHigher
Code FunctionalityBasicAdvanced

Setting Up Your Environment#

Before we begin, ensure you have the following installed:

  • Node.js (version 16 or higher)
  • npm or yarn
  • Expo CLI (
    text
    npm install -g expo-cli
    )
  • A video recording of the travel app you want to recreate. This should showcase the key features and user flows.

Step 1: Preparing the Video#

Record a video of yourself using the travel app you want to recreate. The video should clearly show:

  • Navigation between screens
  • Form input and submission
  • Display of data (e.g., search results, booking details)
  • Any animations or transitions

💡 Pro Tip: Keep the video concise and focused on the essential features you want to replicate. A shorter, well-defined video will yield better results.

Step 2: Uploading to Replay#

  1. Go to Replay's website and create an account.
  2. Upload the video recording you created. Replay will begin processing the video. This may take a few minutes depending on the video's length.

Step 3: Configuring Replay Settings#

Once the video is processed, you can configure the following settings:

  • Target Framework: Select "React Native".
  • Output Style: Choose your preferred styling method (e.g., Styled Components, CSS Modules).
  • Supabase Integration: If your app uses a database, configure the Supabase integration to connect to your database.

📝 Note: Replay's Supabase integration allows you to automatically generate data fetching and manipulation code based on your database schema and the user interactions in the video.

Step 4: Generating the Code#

Click the "Generate Code" button. Replay will analyze the video and generate the React Native code for your travel app. This includes:

  • Component definitions
  • Navigation structure
  • Data fetching logic
  • UI styling

Analyzing the Generated Code#

After the code generation process is complete, you'll be presented with a directory containing your React Native project. Let's examine some key aspects of the generated code.

Project Structure#

Replay will typically generate a project structure similar to this:

text
travel-app/ ├── App.js ├── components/ │ ├── HomeScreen.js │ ├── SearchResultsScreen.js │ ├── BookingDetailsScreen.js │ └── ... ├── styles/ │ ├── globalStyles.js │ └── ... ├── api/ │ └── supabase.js └── ...
  • text
    App.js
    : The main entry point of the application, responsible for setting up navigation.
  • text
    components/
    : Contains the individual React Native components for each screen and UI element.
  • text
    styles/
    : Holds the styling definitions for the components.
  • text
    api/
    : Contains code for interacting with the Supabase database (if configured).

Example Component Code#

Here's an example of a generated component,

text
HomeScreen.js
:

typescript
// HomeScreen.js import React from 'react'; import { View, Text, TextInput, Button, StyleSheet } from 'react-native'; const HomeScreen = () => { return ( <View style={styles.container}> <Text style={styles.title}>Explore Your Next Adventure</Text> <TextInput style={styles.input} placeholder="Where are you going?" /> <Button title="Search" onPress={() => {/* Handle search */}} /> </View> ); }; const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', padding: 20, }, title: { fontSize: 24, fontWeight: 'bold', marginBottom: 20, }, input: { width: '100%', height: 40, borderColor: 'gray', borderWidth: 1, marginBottom: 10, paddingHorizontal: 10, }, }); export default HomeScreen;

This code demonstrates how Replay generates functional React Native components with basic styling. The

text
TextInput
and
text
Button
components are ready to be wired up with actual search functionality.

Supabase Integration#

If you configured Supabase integration, Replay will generate code for interacting with your database. For example, the

text
api/supabase.js
file might contain functions for fetching travel destinations:

typescript
// api/supabase.js import { createClient } from '@supabase/supabase-js'; const supabaseUrl = 'YOUR_SUPABASE_URL'; const supabaseKey = 'YOUR_SUPABASE_ANON_KEY'; const supabase = createClient(supabaseUrl, supabaseKey); export const getDestinations = async () => { const { data, error } = await supabase .from('destinations') .select('*'); if (error) { console.error('Error fetching destinations:', error); return []; } return data; };

This code provides a ready-to-use function for fetching data from your Supabase database. You can then use this function in your components to display the data.

Customizing and Enhancing the Code#

The code generated by Replay provides a solid foundation for your travel app. However, you'll likely need to customize and enhance it to meet your specific requirements.

Step 1: Implement Data Fetching#

Connect the

text
getDestinations
function (or similar functions generated by Replay) to your components to display dynamic data. For example, in
text
HomeScreen.js
:

typescript
// HomeScreen.js import React, { useState, useEffect } from 'react'; import { View, Text, FlatList, StyleSheet } from 'react-native'; import { getDestinations } from '../api/supabase'; const HomeScreen = () => { const [destinations, useState([]); useEffect(() => { const fetchDestinations = async () => { const data = await getDestinations(); setDestinations(data); }; fetchDestinations(); }, []); return ( <View style={styles.container}> <Text style={styles.title}>Explore Your Next Adventure</Text> <FlatList data={destinations} keyExtractor={(item) => item.id.toString()} renderItem={({ item }) => ( <Text>{item.name}</Text> )} /> </View> ); }; // ... (styles)

This code fetches the destinations from the Supabase database and displays them in a

text
FlatList
.

Step 2: Add Navigation#

Implement navigation between screens using React Navigation or a similar library. For example, you can use the

text
useNavigation
hook to navigate from the
text
HomeScreen
to the
text
SearchResultsScreen
when the user submits a search query.

Step 3: Enhance Styling#

Customize the styling of your components to match your desired design. You can use the generated

text
styles
objects as a starting point and modify them as needed.

⚠️ Warning: While Replay generates functional code, the styling may require adjustments to fully match the original app's design.

Replay's Key Advantages#

  • Video-Based Input: Captures the dynamic nature of user interactions, leading to more accurate code generation.
  • Behavior Analysis: Understands user intent, resulting in functional and context-aware code.
  • Supabase Integration: Simplifies data fetching and manipulation by automatically generating database interaction code.
  • Multi-Page Generation: Recreates entire application flows, not just individual screens.
  • Style Injection: Offers flexibility in styling options, allowing you to choose your preferred method.

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited usage. Paid plans are available for increased usage and access to advanced features. Check the Replay pricing page for the latest details.

How is Replay different from v0.dev?#

While both Replay and v0.dev aim to generate code, Replay focuses on behavior-driven reconstruction from video recordings, capturing the dynamic aspects of user interaction. V0.dev relies on text prompts, which may require more iterative refinement to achieve the desired functionality. Replay excels at understanding and replicating existing application flows.

Can I use Replay with other backend services besides Supabase?#

Currently, Replay has direct integration with Supabase. Support for other backend services may be added in the future. You can still use Replay to generate the front-end code and then integrate it with your preferred backend service manually.


Ready to try behavior-driven code generation? Get started with Replay - transform any video into working code in seconds.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free