Skip to content

Code up a Figma Design in React Native

In this guide, we’ll use React Native to recreate the design for a single todo item from Figma.

The first step in recreating a design is to consider the design itself.

With a partner, look carefully at the design below:

Design for incomplete todo item

With this structure in mind, let’s take a look at how we might build the component in React Native code.

  1. Open the project in your code editor and run the app with the command below:

    Terminal window
    npm run dev
  2. Decide if you want to see the app on your phone or in the browser by following the instructions in your terminal.

  3. Open app/index.tsx and replace all the code inside with the following:

    app/index.tsx
    import { View, Text } from "react-native";
    export default function HomeScreen() {
    return (
    <View className="flex flex-1 py-32 bg-background">
    <Text className="text-white text-center">Hello, world!</Text>
    </View>
    );
    }

    This gives us a simple View component with a Text component inside it:

    Todo screen 1

  4. Remind yourself how we said the component structure might look:

    View and Text components in Figma

    To recreate this, I’m going to:

    • delete the β€˜Hello, world!’ placeholder text
    • create a parent View component and give it an articfical height and border so that it matches the outlines above:
    app/index.tsx
    import { View, Text } from "react-native";
    export default function HomeScreen() {
    return (
    <View className="flex flex-1 py-32 bg-background">
    <Text className="text-white text-center">Hello, world!</Text>
    <View className="h-20 w-full border-2 border-cyan-400"></View>
    </View>
    );
    }

    Todo screen 2

  5. Next, I’ll add two View components inside the parent, and give these temporary borders that match the plan above:

    app/index.tsx
    import { Text, View } from "react-native";
    export default function HomeScreen() {
    return (
    <View className="flex flex-1 py-32 bg-background">
    <View className="flex flex-row h-20 w-full border-2 border-cyan-400">
    <View className="flex w-24 h-full border-2 border-pink-400"></View>
    <View className="flex flex-1 h-full border-2 border-green-400">
    </View>
    </View>
    </View>
    );
    }

    Todo screen 3

  6. Let’s add some text inside the green View component:

    app/index.tsx
    import { Text, View } from "react-native";
    export default function HomeScreen() {
    return (
    <View className="flex flex-1 py-32 bg-background">
    <View className="flex flex-row h-20 w-full border-2 border-cyan-400">
    <View className="flex w-24 h-full border-2 border-pink-400">
    <Text className="text-foreground">Feed the cat</Text>
    </View>
    </View>
    </View>
    );
    }

    Todo screen 4