React Native — Build Native Mobile Apps with React
React Native is the leading framework for building native iOS and Android apps using React. Write once in JavaScript/TypeScript, get truly native mobile apps — not webviews — with shared business logic and platform-specific UI when needed.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install f7fe0477-3712-11f1-9bc6-00163e2b0d79 --target codex先 dry-run,确认写入项后再运行此命令。
What it is
React Native is a framework for building native mobile applications using React. Unlike hybrid frameworks that wrap web content in a webview, React Native translates React components into native iOS (UIKit) and Android platform views. You write shared business logic in JavaScript or TypeScript while retaining access to platform-specific APIs.
React Native is used by Meta (Facebook, Instagram, Messenger), Microsoft (Office, Outlook), Shopify, Discord, and Bloomberg. It is the most widely adopted cross-platform mobile framework.
How it saves time or tokens
React Native eliminates the need to maintain separate iOS and Android codebases. One team writes shared logic once, reducing code duplication by 70-90% on typical projects. Hot reloading lets developers see changes instantly without recompiling. The new architecture (Fabric renderer plus TurboModules) provides direct synchronous access to native APIs, closing the performance gap with fully native apps.
How to use
- Create a new project using Expo (recommended) or the bare React Native CLI.
- Run the development server and open the app on a simulator or physical device.
- Write React components that map to native views.
# Expo (recommended)
npx create-expo-app@latest my-app
cd my-app && npx expo start
# Bare React Native
npx @react-native-community/cli init MyApp
cd MyApp
npx react-native run-ios
Example
A minimal React Native component rendering native text and a button:
import React from 'react';
import { View, Text, Button, Alert } from 'react-native';
export default function App() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ fontSize: 24 }}>Hello, React Native</Text>
<Button
title='Press me'
onPress={() => Alert.alert('Button pressed')}
/>
</View>
);
}
This renders a truly native UILabel on iOS and a TextView on Android, not a webview.
Related on TokRepo
- AI Tools for Coding — AI-powered development tools for mobile and web projects
- AI Tools for Design — Design tools that complement mobile app development
Common pitfalls
- Navigation libraries (React Navigation, Expo Router) each have tradeoffs. Choosing the wrong one mid-project is expensive to reverse.
- Native modules that bridge platform code require Xcode and Android Studio knowledge. Pure JS developers may struggle with linking and debugging native crashes.
- The old bridge architecture is being replaced by the new architecture (Fabric, TurboModules). Libraries that have not migrated may cause compatibility issues.
常见问题
React Native is truly native. It renders platform-specific UI components (UIKit on iOS, Android Views on Android). There is no webview involved. JavaScript drives the native rendering engine through a bridge or the newer JSI (JavaScript Interface) layer.
Expo is recommended for most new projects. It handles build configuration, over-the-air updates, and provides a managed workflow. Use bare React Native only if you need custom native modules that Expo does not support, which is increasingly rare with Expo Modules.
The new architecture consists of Fabric (a new rendering system) and TurboModules (a new native module system). Both use JSI for direct synchronous communication between JavaScript and native code, replacing the old asynchronous bridge. This reduces latency and improves performance.
Yes, partially. Business logic, state management, and API layers can be shared. UI components differ because React Native uses native primitives (View, Text) instead of HTML elements (div, span). Libraries like React Native Web bridge this gap for some use cases.
For most applications, React Native performance is indistinguishable from fully native. The new architecture closes remaining gaps for animation-heavy and computationally intensive use cases. Apps like Instagram and Discord demonstrate production-grade performance at scale.
引用来源 (3)
- React Native GitHub— React Native with 126,000+ GitHub stars
- React Native Docs— New Architecture with Fabric and TurboModules
- Expo Documentation— Expo managed workflow for React Native
讨论
相关资产
.NET MAUI — Build Native Cross-Platform Apps with C# and XAML
The .NET Multi-platform App UI framework for building native mobile and desktop apps for Android, iOS, macOS, and Windows from a single C# and XAML codebase.
Expo — Universal Native Apps for iOS, Android & Web
Expo is an open-source framework and platform for making universal React Native apps. Ship to iOS, Android, and web from one codebase — OTA updates, managed workflow, EAS Build cloud service, and 100+ prebuilt native modules.
Dioxus — Full-Stack App Framework for Web, Desktop, and Mobile
Dioxus is a full-stack app framework for Rust with a React-like API. Build web (WASM), desktop (native WebView), mobile (iOS/Android), TUI, and server-rendered apps from one codebase. Hooks, components, server functions, and hot reloading.
Ionic — Cross-Platform Mobile App Framework with Web Standards
Build native iOS, Android, and Progressive Web Apps using one codebase with standard HTML, CSS, and JavaScript or TypeScript. Ionic provides a rich library of mobile-optimized UI components and integrates with Angular, React, or Vue.