React Native
A framework for iOS and Android apps in React, with native views and native modules.
Mobile appsUsing since 2018 · Featured project: Hollywood Hair
- Category
- Mobile apps
- Using since
- 2018
- Featured project
- Hollywood Hair
In practice
I pick React Native when an app has to run on iOS and Android from one TypeScript codebase. At Blanket I delivered an insurance app for both platforms that way, as the only developer. When a ready library is missing, I add native code.
What is React Native?
React Native is a framework for building native Android and iOS apps with React. Components such as View, Text and Image map to native interface elements, so the app uses the same platform APIs as any other app. One codebase serves both platforms, and the system-specific parts are added separately where they are needed.
The library itself prescribes neither navigation nor access to device features, which is why a framework such as Expo usually goes on top of it. Native modules are described by a typed specification in TypeScript or Flow, from which Codegen creates the native interfaces.
- Language
- JavaScript and TypeScript
- Interface
- Native platform views
- Native modules
- A specification in TypeScript or Flow
- Recommended tool
- A framework, for example Expo
How I work with React Native
I start with a split: what in the app has to be native, and what can be shared between the two platforms. That decides how much code I write once and how much separately for iOS and Android. That way it is clear from the start which features will need separate work on each platform.
Shared code and navigation
I write screens and logic once in TypeScript and build navigation on React Navigation. On Blanket one app served iOS and Android.
Animations and gestures
I build smooth animations and gestures in Reanimated 3, as on Blanket. Plain navigation rarely makes an app feel native on its own.
Native modules and notifications
When libraries fall short, I write native code. On Blanket Notifee handled local and push notifications, and
expo-local-authenticationhandled biometric login.
When it fits, and when it doesn't
React Native makes sense when one app has to reach both platforms and share most of its code.
A good fit when
- An iOS and Android app that has to feel native.
- A team that already knows React and TypeScript.
- An app with sign-in, push notifications and biometrics.
- A small team that cannot maintain two separate native apps.
Not a fit when
- An app built mostly around one platform-specific API.
- A team with iOS and Android engineers and two codebases already.
- Simple content that is fine as a responsive website.
I skip Flutter because I have not used it in my projects, so I do not speak from experience. I pick React Native because the rest of my stack is React and TypeScript. That is an opinion, not a comparison from practice.
Pitfalls from real projects
Features that depend on the platform
From the Blanket project
At Blanket, next to the shared code, the app needed push notifications through Notifee and Firebase Cloud Messaging, and biometric login with Face ID and fingerprint recognition.
Connection state inside the app
From the Blanket project
At Blanket the app had to behave sensibly without a network too. AsyncStorage and NetInfo did that job, keeping data locally and watching the connection state.
Frequently asked questions
Planning an app for iOS and Android?
Tell me what the app has to do and on which devices. I will say whether React Native is enough, and what will have to be written natively. Add what data the app has to store and where it comes from.