How to Create a 2D Game Using React Native Skia

Mar 28, 2023

How to Create a 2D Game Using React Native Skia

This blog details the process of building a variation of the well-known two-dimensional game, Flappy Bird, using a novel framework named React Native Skia.

Author

Ponikar Darshan Janardan
Ponikar Darshan JanardanSoftware Engineer - I

This blog post explains how to create a version of the popular 2D game, Flappy Bird, using a new library called React Native Skia. We also discuss game assets and logic to help readers understand how to create a similar game. The game uses the Skia engine to draw all graphics and the Zustand micro-state management library to simplify game state management.

The blog also discusses using React Native, React Native Skia, and Zustand ๏ปฟmicro-state management library to create a 2D game. Additionally, it breaks down how to make the code more modular and efficient using declarative coding patterns.

โญ The game is available to play on both Android and iOS devices.

Creating the Game

To create the game, we first needed to create the necessary game assets, such as the bird, pipes, and numbers. To do that, we used open-source libraries available online for free to obtain assets.

Open source libraries for Game assets

We need to use Zustand to develop the game and store its status. The engine performs various functions, including controlling the game's behavior, generating pipes, implementing scoring, and keeping the bird airborne.

We then defined the game's state โ€” "ready for input," "head starting game," "running game," and "game over."

To simplify and manage the code, we used declarative coding patterns. Then by identifying patterns in the code, we created simpler ways of handling complex tasks, resulting in more organized and maintainable code.

React Native Skia: Why Is It a Good Choice for Building the Game?

React Native Skia is an excellent option for building games because it combines the advantages of both React Native and the Skia graphics engine.

With React Native, developers can save time and effort using a single codebase to create mobile apps for multiple platforms, including iOS and Android. Meanwhile, Skia is a highly capable and flexible graphics engine that delivers high-quality 2D graphics rendering.

By utilizing React Native Skia to develop games, developers can benefit from both technologies and create games that are fast, responsive, and visually stunning. The Skia graphics engine can render high-quality graphics, animations, and effects, while React Native provides a versatile and user-friendly framework for building user interfaces and managing user input.

React Native Skia is also incredibly adaptable, allowing developers to create customized gaming experiences that cater to their needs and preferences.

Declarative Coding Patterns

There are two types of coding patterns: reusable and declarative. Reusable patterns involve copying and pasting logic used in multiple places, while declarative patterns involve creating an abstraction layer over complex logic.

We can also create a declarative hook called "useGameEffect" that takes care of the game state and defines what will happen when the game is in a running, resume, pause or game over state.

The setInterval function schedules a callback based on a timer in this code. If the game is paused or over, the interval will be cleared by "useGameEffect.โ€ Using this hook means we don't have to manage a game state or loops separately in our code.

Improving Performance

Optimizing performance is essential in game development. We can avoid lagging on low-end Android devices by generating obstacles from the right-hand side and removing off-screen obstacles. Declarative coding patterns can simplify our code, making it more efficient and easier to maintain.

Final Thoughts

React Native Skia, Zustand, and other micro-state management libraries enable us to create fun and engaging games that work on both Android and iOS devices. By using declarative coding patterns, we can simplify our code, making it more efficient and easier to maintain. We can use these techniques to create exciting and engaging games with React.

Subscribe to Our Newsletter

More from the engineering frontline.

Dive deep into our research and insights on design, development, and the impact of various trends to businesses.
Insight
Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15
Sep 10, 2026

Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15

This blog explains how to build a production-ready canvas editor with Konva.js, React, and Next.js, covering architecture, performance, and key engineering decisions.

Insight
What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust
Sep 8, 2026

What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust

This blog explores the architecture, security, performance, and documentation lessons from migrating a legacy PHP/Laravel banking platform to NestJS.

Insight
Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs
Sep 7, 2026

Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs

This blog explains how to build responsive video thumbnail scrubbing in the browser for local files and HLS streams, covering frame extraction, caching, and performance trade-offs.

Insight
The Agent Can See Your App. How Often Can It Look?
Sep 4, 2026

The Agent Can See Your App. How Often Can It Look?

AI coding agents can now interact with mobile apps, but their effectiveness depends on iteration speed. This blog explores how React Native architecture influences feedback loops and AI-driven developer productivity.

Insight
Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists
Sep 1, 2026

Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists

Learn how to turn design JSON into interactive, video-enabled cards using overlays, smart media controls, caching, and virtualization without slowing down high-cardinality feeds.

Insight
The Bug That Doesn't Show Up in Code Review: Why Your Flutter Web App Reloads on Safari
Aug 19, 2026

The Bug That Doesn't Show Up in Code Review: Why Your Flutter Web App Reloads on Safari

A real-world look at how oversized images can trigger Safari reloads and iOS crashes in Flutter apps and how smarter image decoding prevents them.

Insight
From Prompting to Process: What Changed When Flutter Shipped Agent Skills
Aug 19, 2026

From Prompting to Process: What Changed When Flutter Shipped Agent Skills

This blog explores how Flutter Agent Skills improve AI-assisted development by combining official framework workflows with project-specific guidance for more consistent development.

The Right Conversation Can

Save You Six Months.

Book a call