跳至主内容
版本:0.82

开始使用 React Native

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

React Native 让熟悉 React 的开发者能够创建原生应用。 同时,原生开发者可以通过 React Native 编写一次通用功能,实现跨平台的一致性。

我们认为体验 React Native 的最佳方式是通过 框架(Framework)——一个包含所有必要 API 的工具箱,助您构建生产级应用。

您也可以不使用框架直接开发 React Native 应用,但我们发现大多数开发者能从 Expo 这类框架中获益。Expo 提供了基于文件的路由系统、高质量的通用库,以及无需管理原生文件即可修改原生代码的插件能力。

Can I use React Native without a Framework?

Yes. You can use React Native without a Framework. However, if you’re building a new app with React Native, we recommend using a Framework.

In short, you’ll be able to spend time writing your app instead of writing an entire Framework yourself in addition to your app.

The React Native community has spent years refining approaches to navigation, accessing native APIs, dealing with native dependencies, and more. Most apps need these core features. A React Native Framework provides them from the start of your app.

Without a Framework, you’ll either have to write your own solutions to implement core features, or you’ll have to piece together a collection of pre-existing libraries to create a skeleton of a Framework. This takes real work, both when starting your app, then later when maintaining it.

If your app has unusual constraints that are not served well by a Framework, or you prefer to solve these problems yourself, you can make a React Native app without a Framework using Android Studio, Xcode. If you’re interested in this path, learn how to set up your environment and how to get started without a framework.

使用 Expo 创建新项目

Platform support
Android
iOS
TV
Web

Expo 是生产级的 React Native 框架,提供简化开发的工具链,包括基于文件的路由、标准化原生模块库等强大功能。

Expo 框架免费开源,拥有活跃的 GitHubDiscord 社区。Expo 团队与 Meta 的 React Native 团队紧密合作,确保最新特性及时集成至 Expo SDK。

Expo 团队还提供 Expo Application Services (EAS)——一套可选的增强服务,在开发全流程中与框架形成互补。

在终端运行以下命令创建新项目:

shell
npx create-expo-app@latest

项目创建完成后,请查阅 Expo 入门指南的后续内容,开始应用开发。

Continue with Expo