Skip to main content

介绍

Welcome to the very start of your React Native journey! If you're looking for getting started instructions, they've moved to their own section. Continue reading for an introduction to the documentation, Native Components, React, and more!

许多不同类型的人都使用 React Native:从高级 iOS 开发者到 React 初学者,再到职业生涯中第一次开始编程的人。这些文档是为所有学习者编写的,无论他们的经验水平或背景如何。

¥Many different kinds of people use React Native: from advanced iOS developers to React beginners, to people getting started programming for the first time in their career. These docs were written for all learners, no matter their experience level or background.

如何使用这些文档

¥How to use these docs

你可以从这里开始,像读一本书一样线性地阅读这些文档;或者你可以阅读你需要的特定部分。已经熟悉 React 了?你可以跳过 那个部分,或者阅读它来复习一下。

¥You can start here and read through these docs linearly like a book; or you can read the specific sections you need. Already familiar with React? You can skip that section—or read it for a light refresher.

先决条件

¥Prerequisites

要使用 React Native,你需要了解 JavaScript 基础知识。如果你是 JavaScript 新手或需要复习,可以在 Mozilla 开发者网络上 深入研究浅学一下

¥To work with React Native, you will need to have an understanding of JavaScript fundamentals. If you’re new to JavaScript or need a refresher, you can dive in or brush up at Mozilla Developer Network.

虽然我们尽力假设事先不了解 React、Android 或 iOS 开发,但这些对于有抱负的 React Native 开发者来说都是有价值的学习主题。在合理的情况下,我们链接了更深入的资源和文章。

¥While we do our best to assume no prior knowledge of React, Android, or iOS development, these are valuable topics of study for the aspiring React Native developer. Where sensible, we have linked to resources and articles that go more in depth.

互动示例

¥Interactive examples

通过本介绍,你可以在浏览器中立即开始使用如下所示的交互式示例:

¥This introduction lets you get started immediately in your browser with interactive examples like this one:

上面是一个小样播放器。它是 Expo 创建的一个方便的工具,用于嵌入和运行 React Native 项目并分享它们在 Android 和 iOS 等平台中的渲染方式。该代码是实时且可编辑的,因此你可以直接在浏览器中使用它。继续尝试将上面的 "Try editing me!" 文本更改为 "你好世界!"

¥The above is a Snack Player. It’s a handy tool created by Expo to embed and run React Native projects and share how they render in platforms like Android and iOS. The code is live and editable, so you can play directly with it in your browser. Go ahead and try changing the "Try editing me!" text above to "Hello, world!"

或者,如果你想设置本地开发环境,请 你可以按照我们的指南在本地计算机上设置你的环境 并将代码示例粘贴到你的项目中。(如果你是 Web 开发者,你可能已经设置了用于移动浏览器测试的本地环境!)

¥Optionally, if you want to set up a local development environment, you can follow our guide to setting up your environment on your local machine and paste the code examples into your project. (If you are a web developer, you may already have a local environment set up for mobile browser testing!)

开发者注意事项

¥Developer Notes

来自许多不同开发背景的人们正在学习 React Native。你可能拥有一系列技术的经验,从网络到 Android 到 iOS 等等。我们尝试为来自不同背景的开发者编写内容。有时我们会提供特定于一个平台或另一个平台的解释,如下所示:

¥People from many different development backgrounds are learning React Native. You may have experience with a range of technologies, from web to Android to iOS and more. We try to write for developers from all backgrounds. Sometimes we provide explanations specific to one platform or another like so:

Web 开发者可能熟悉这个概念。

¥Web developers may be familiar with this concept.

格式化

¥Formatting

菜单路径以粗体书写,并使用插入符号来导航子菜单。示例:Android Studio > 首选项

¥Menu paths are written in bold and use carets to navigate submenus. Example: Android Studio > Preferences


现在你已经了解了本指南的工作原理,是时候了解 React Native 的基础了:原生组件

¥Now that you know how this guide works, it's time to get to know the foundation of React Native: Native Components.