Design+Code logo

Quick links

Suggested search

Diving Deeper into React Native

The first part touched a lot on the UI, animations and light aspect of data, using libraries like Styled Components, Expo, Redux, Apollo and Contentful. As always, courses on Design+Code are all about the workflow and building your app from zero, from the perspective of a designer. The goal is to get you familiar with the platform and the tools, and allow you to collaborate better with engineers.

1.1

First, we'll create some gesture interactions within the app and transition nicely to a full card. Since animated assets can save so much implementation time, I believe that it's crucial to learn how to use Lottie files. We'll also learn how create a beautiful sign up and login experience using forms and Firebase authentication. Finally, it'll be time to publish our app to the Android and iOS app stores.

Updating Expo

1.2

npm install -g expo-cli

Existing Project

If you haven't installed the latest version of the project, you can do so by going to your Downloads folder and run this code in Terminal.

git clone https://github.com/MengTo/react-native-for-designers.git
cd react-native-for-designers
npm install
expo start

Install Git on Windows

Download Git for Windows and double-click on installer file. For every step, click next until completion. Make sure to restart VSCode, go to Integrated terminal (Control + ~) and test this command. This will show a list of commands that you can run with git.

git
git clone https://github.com/MengTo/react-native-for-designers.git
cd react-native-for-designers
npm install
expo start

VSCode Extensions

The extensions are the same as Part 1. There is just one tiny change, it's the Material Theme Icons extension that is now separate from Material Theme. You have to install that separately.

1.3

Turn off Parameter Hints (optional)

But first, when you type code in VSCode, the hints can get pretty annoying. To turn off those pesky auto-suggestions, go to Settings, search for parameter and turn off Parameter Hints.

1.4

Changing Home Screen

When you work with specific screens, you might want to temporarily change your first screen to ProjectsScreen.js. Like this, every time you refresh, it will go directly to the desired screen. To make this change, go to TabNavigator.js and put the ProjectsStack first in the list.

// Line 76
const TabNavigator = createBottomTabNavigator({
  ProjectsStack, // First screen
  HomeStack,
  CoursesStack
});

Basic Card

Let's start by changing the background color in ProjectsScreen.js.

const Container = styled.View`
  background: #f0f3f5;
`;

Let's set up a basic Stateful component for each card. Create a Project.js in the components folder.

import React from "react";
import styled from "styled-components";

class Project extends React.Component {
  render() {
    return (
      <Container />
    );
  }
}

export default Project;

const Container = styled.View`
  width: 315px;
  height: 460px;
  border-radius: 14px;
  background-color: blue;
`;

In ProjectsScreen.js, let's include the newly created component.

// Inside Container
<Project />

Importing Gestures

In order to start using gestures, we need to import the PanResponder and Animated components from React Native.

// ProjectsScreen.js
import { PanResponder, Animated } from "react-native";

Pan State

We'll need to set an Animated state called pan. We're using the ValueXY because it will contact both the x and y positions.

state = {
  pan: new Animated.ValueXY()
};

Declaring and Enabling Gestures

In order to use gestures, we'll need to configure it from PanResponder. Here, we're declaring a new _panResponder and we're enabling the capture of the swipe gestures by setting onMoveShouldSetPanResponder to true in componentWillMount.

componentWillMount() {
  this._panResponder = PanResponder.create({
    onMoveShouldSetPanResponder: () => true,
  });
}

Gesture Events

For swipe gestures, we have access to a bunch of events. Typically, there are 3 main ones:

  1. When the user starts swiping (onPanResponderGrant). Here, we can use this event to start a background animation, or a color change.
  2. When the user is swiping (onPanResponderMove). This is useful for moving the card during drag since we get direct values to apply to the card.
  3. When the user releases (onPanResponderRelease). We'll be using this event to return the card to its initial position after release. We can also do things like drop the card depending on positioning.

    onPanResponderGrant: (e, gestureState) => {
    // We'll take care of this later.
    },

    This will make the card move as you swipe. Since we're using Animated values, we have to Animated to change the states. In this case, we're changing the x and y position.

    onPanResponderMove: Animated.event([
    null,
    { dx: this.state.pan.x, dy: this.state.pan.y }
    ])

When released, you want your card to come back to its initial position. We're using Animated.spring to give a nice bounce effect.

onPanResponderRelease: () => {
  Animated.spring(this.state.pan, { toValue: { x: 0, y: 0 } }).start();
}

Apply Animated Wrapper

We need to apply the Animated properties to our Card, so we'll wrap it inside an Animated.View where we can add the style properties. Also, we're applying all the arguments from _panResponder that we declared earlier. The triple dots signifies that it's a list of parameters applied to the components.

<Animated.View
  style={{
    transform: [
      { translateX: this.state.pan.x },
      { translateY: this.state.pan.y }
    ]
  }}
  {...this._panResponder.panHandlers}
>
  // <Project />
</Animated.View>

Project Styling

Let's apply the rest of the styling for our Card in Project.js, along with props. This will allow us to have unique props for each card.

import React from "react";
import styled from "styled-components";

class Project extends React.Component {
  render() {
    return (
      <Container>
        <Cover>
          <Image source={this.props.image} />
          <Title>{this.props.title}</Title>
          <Author>by {this.props.author}</Author>
        </Cover>
        <Text>{this.props.text}</Text>
      </Container>
    );
  }
}

export default Project;

const Container = styled.View`
  width: 315px;
  height: 460px;
  border-radius: 14px;
  background-color: white;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
`;

const Cover = styled.View`
  height: 290px;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  overflow: hidden;
`;

const Image = styled.Image`
  width: 100%;
  height: 290px;
`;

const Title = styled.Text`
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 24px;
  font-weight: bold;
  color: white;
  width: 300px;
`;

const Author = styled.Text`
  position: absolute;
  bottom: 20px;
  left: 20px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
`;

const Text = styled.Text`
  font-size: 17px;
  margin: 20px;
  line-height: 24px;
  color: #3c4560;
`;

Import Project

Now that the Project component is done, let's import that to the ProjectsScreen.js. We're passing a bunch of props to the first card since that's the only one we're dealing with at the moment.

import Project from "../components/Project";
<Project
  title="Price Tag"
  image={require("../assets/background5.jpg")}
  author="Liu Yi"
  text="Thanks to Design+Code, I improved my design skill and learned to do animations for my app Price Tag, a top news app in China."
/>

READ NEXT

Advanced Gestures

Templates and source code

Download source files

Download the videos and assets to refer and learn offline without interuption.

check

Design template

check

Source code for all sections

check

Video files, ePub and subtitles

Videos

ePub

Assets

Subtitles

Meet the instructor

We all try to be consistent with our way of teaching step-by-step, providing source files and prioritizing design in our courses.

Meng To

I design, code and write

Meng To is the author of Design+Code. Meng started off his career as a self-taught designer from Montreal and eventually traveled around the world for 2 years as his US VISA was denied. During his travels, he wrote a book which now has 35,000 readers.

icon

39 courses - 184 hours

course logo

Build SwiftUI apps for iOS 18 with Cursor and Xcode

In this course, we'll explore the exciting new features of SwiftUI 6 and Xcode 16 for building iOS 18 apps. From mesh gradients and text animations to ripple effects, you'll learn how to create polished, highly custom apps using the latest workflows. We'll also dive into using Cursor and Claude AI for AI-driven coding, helping you start strong and customize your apps.

5 hrs

course logo

Create your Dream Apps with Cursor and Claude AI

Learn to build your dream web apps from the ground up using Cursor, Claude AI, and a suite of powerful AI tools. This course covers everything you need, including React for frontend development, Firebase for backend integration, and Stripe for handling payments. You’ll also dive into advanced AI tools like Claude Artifacts, Galileo AI, v0.dev for UI, Ideogram for design generation, and Cursor Composer for full-scale development.

6 hrs

course logo

Build a React Site from Figma to Codux

In this course, you'll learn to build a website from scratch using Codux, starting with a Figma template. You’ll master responsive design, collaborate with developers on a real React project, export CSS from Figma using Locofy, set up breakpoints with media queries, add CSS animations, improve SEO, create multiple pages with React Router, and publish your site. By following best practices, you’ll bridge design and development, improve your web design skills.

2 hrs

course logo

Create 3D UI for iOS and visionOS in Spline

Comprehensive 3D Design Course: From Basics to Advanced Techniques for iOS and visionOS using SwiftUI

3 hrs

course logo

Master No-Code Web Design with Framer

In this free Framer course, you'll learn to create modern, user-friendly interfaces. Start with dark mode and glass designs, then move from Figma to Framer, using vectors and auto layout for responsive websites. Add animations, interactive buttons, and custom components with code. Finally, you'll craft a design system suitable for teamwork or solo projects, all in a straightforward and practical approach.

4 hrs

course logo

Build SwiftUI Apps for iOS 17

In this course, we’ll be exploring the fresh and exciting features of SwiftUI 5! As we craft a variety of iOS apps from the ground up, we'll delve deep into the treasure trove that is SwiftUI's user interface, interactions, and animations.

4 hrs

course logo

Build Beautiful Apps with GPT-4 and Midjourney

Design and develop apps using GPT-4 and Midjourney with prompts for SwiftUI, React, CSS, app concepts, icons, and copywriting

4 hrs

course logo

Build SwiftUI apps for iOS 16

Create animated and interactive apps using new iOS 16 techniques using SwiftUI 4 and Xcode 14

5 hrs

course logo

Build a 3D Site Without Code with Framer

Design and publish a responsive site with 3D animation without writing a single line of code

3 hrs

course logo

Create 3D Site with Spline and React

Design and code a landing page with an interactive 3D asset using Spline and CodeSandbox

1 hrs

course logo

Build an Animated App with Rive and SwiftUI

Design and code an iOS app with Rive animated assets, icon animations, custom layouts and interactions

3 hrs

course logo

Build a SwiftUI app for iOS 15 Part 3

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

Build a SwiftUI app for iOS 15 Part 2

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

3 hrs

course logo

Build a SwiftUI app for iOS 15

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

React Livestreams

Learn how we can use React Hooks to build web apps using libraries, tools, apis and frameworks

4 hrs

course logo

Design Founder Livestreams

A journey on how we built DesignCode covering product design, management, analytics, revenue and a good dose of learning from our successes and failures

2 hrs

course logo

SwiftUI Advanced Handbook

An extensive series of tutorials covering advanced topics related to SwiftUI, with a main focus on backend and logic to take your SwiftUI skills to the next level

4 hrs

course logo

iOS Design Handbook

A complete guide to designing for iOS 14 with videos, examples and design files

2 hrs

course logo

SwiftUI Handbook

A comprehensive series of tutorials covering Xcode, SwiftUI and all the layout and development techniques

7 hrs

course logo

Build a web app with React Hooks

Learn how we built the new Design+Code site with React Hooks using Gatsby, Netlify, and advanced CSS techniques with Styled Components.

4 hrs

course logo

UI Design Handbook

A comprehensive guide to the best tips and tricks for UI design. Free tutorials for learning user interface design.

2 hrs

course logo

Figma Handbook

A comprehensive guide to the best tips and tricks in Figma

6 hrs

course logo

SwiftUI for iOS 14

Build a multi-platform app from scratch using the new techniques in iOS 14. We'll use the Sidebar and Lazy Grids to make the layout adaptive for iOS, iPadOS, macOS Big Sur and we'll learn the new Matched Geometry Effect to create beautiful transitions between screens without the complexity. This course is beginner-friendly and is taught step-by-step in a video format.

3 hrs

course logo

SwiftUI Livestreams

This is a compilation of the SwiftUI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

19 hrs

course logo

UI Design Livestreams

This is a compilation of the UI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

26 hrs

course logo

UI Design for Developers

In this course we'll learn how to use design systems, set up break points, typography, spacing, navigation, size rules for adapting to the iPad, mobile and web versions, and different techniques that translate well from design to code.

3 hrs

course logo

Build an app with SwiftUI Part 3

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build an app with SwiftUI Part 2

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build a full site in Webflow

Webflow is a design tool that can build production-ready experiences without code. You can implement CSS-driven adaptive layouts, build complex interactions and deploy all in one tool. Webflow also comes with a built-in content management system (CMS) and Ecommerce for creating a purchase experience without the need of third-party tools.

3 hrs

course logo

Advanced Prototyping in ProtoPie

ProtoPie is a cross-platform prototyping tool that creates prototypes nearly as powerful as those made with code, with half of the efforts, and zero code. It's perfect for designers who want to quickly experiment with advanced interactions using variables, conditions, sensors and more.

3 hrs

course logo

Build an app with SwiftUI Part 1

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

React Native for Designers Part 2

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

3 hrs

course logo

React Native for Designers

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

5 hrs

course logo

Design System in Figma

Learn how to use and design a collaborative and powerful design system in Figma. Design Systems provide a shared library of reusable components and guidelines and that will let you build products much faster

3 hrs

course logo

React for Designers

Learn how to build a modern site using React and the most efficient libraries to get your site/product online. Get familiar with Grid CSS, animations, interactions, dynamic data with Contentful and deploying your site with Netlify.

3 hrs

course logo

Swift Advanced

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

9 hrs

course logo

Learn Swift

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

4 hrs

course logo

Learn Sketch

Learn Sketch a design tool entirely vector-based and focused on user interface design

5 hrs

course logo

Learn iOS 11 Design

Learn colors, typography and layout for iOS 8

1 hrs

Test your knowledge of React Native. Complete the course and get perfect results for this test to get your certificate.