Skip to content

Commit 235f6bd

Browse files
committed
fix(cnwebsite): merge environment setup docs
1 parent 85e02ba commit 235f6bd

27 files changed

Lines changed: 221 additions & 1553 deletions

cndocs/_integration-with-existing-apps-ios.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {getTemplateBranchNameForCurrentVersion} from '@site/src/getTemplateBranc
2222

2323
## 准备工作
2424

25-
请按照[设置开发环境](set-up-your-environment)指南和[不使用框架的 React Native](getting-started-without-a-framework)指南来配置您的开发环境,以便构建 iOS 平台的 React Native 应用。
25+
请按照[设置开发环境](environment-setup)指南和[不使用框架的 React Native](getting-started-without-a-framework)指南来配置您的开发环境,以便构建 iOS 平台的 React Native 应用。
2626
本指南还假设您熟悉 iOS 开发的基础知识,如创建`UIViewController`和编辑`Podfile`文件。
2727

2828
### 1. 设置目录结构

cndocs/_integration-with-existing-apps-kotlin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {getTemplateBranchNameForCurrentVersion} from '@site/src/getTemplateBranc
2222

2323
## 开发环境准备
2424

25-
按照[开发环境搭建教程](set-up-your-environment)[不使用框架使用 React Native](getting-started-without-a-framework) 来配置你的 Android 开发环境。
25+
按照[开发环境搭建教程](environment-setup)[不使用框架使用 React Native](getting-started-without-a-framework) 来配置你的 Android 开发环境。
2626
本教程还假设你熟悉 Android 开发的基础知识,例如创建 Activity 和编辑 `AndroidManifest.xml` 文件。
2727

2828
### 1. 配置项目目录结构

cndocs/get-started-without-a-framework.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import PlatformSupport from '@site/src/theme/PlatformSupport';
1313

1414
如果[框架](/architecture/glossary#react-native-framework)无法很好地满足你的需求,或者你更倾向于自己编写框架,那么你可以在不使用框架的情况下创建 React Native 应用。
1515

16-
为此,你首先需要[搭建开发环境](set-up-your-environment)。环境准备就绪后,继续按以下步骤创建应用并开始开发。
16+
为此,你首先需要[搭建开发环境](environment-setup)。环境准备就绪后,继续按以下步骤创建应用并开始开发。
1717

1818
### 第 1 步:创建新项目
1919

cndocs/getting-started.md

Lines changed: 34 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,38 @@ title: 搭建开发环境
44
hide_table_of_contents: true
55
---
66

7-
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
7+
import Tabs from '@theme/Tabs';
8+
import TabItem from '@theme/TabItem';
9+
import constants from '@site/core/TabsConstants';
810

9-
import GuideLinuxAndroid from './\_getting-started-linux-android.md'; import GuideMacOSAndroid from './\_getting-started-macos-android.md'; import GuideWindowsAndroid from './\_getting-started-windows-android.md'; import GuideMacOSIOS from './\_getting-started-macos-ios.md';
11+
import GuideLinuxAndroid from './\_getting-started-linux-android.md';
12+
import GuideMacOSAndroid from './\_getting-started-macos-android.md';
13+
import GuideWindowsAndroid from './\_getting-started-windows-android.md';
14+
import GuideMacOSIOS from './\_getting-started-macos-ios.md';
1015

11-
欢迎使用 React Native!这篇文档会帮助你搭建基本的 React Native 开发环境
16+
本指南将帮助你搭建开发环境,以便使用 Android Studio 和 Xcode 运行你的项目。这样你就可以使用 Android 模拟器和 iOS 模拟器进行开发、在本地构建应用等
1217

13-
<Tabs groupId="guide" defaultValue={constants.defaultGuide} values={constants.guides}>
14-
<TabItem value="native">
18+
:::info
19+
本指南需要安装 Android Studio 或 Xcode。如果你已经安装了其中一个,通常几分钟内即可上手。如果尚未安装,预计需要大约一个小时来完成安装和配置。
1520

16-
根据你所使用的操作系统、针对的目标平台不同,具体步骤有所不同。如果想同时开发 iOS 和 Android 也没问题,你只需要先选一个平台开始,另一个平台的环境搭建只是稍有不同。
21+
<details>
22+
<summary>搭建环境是必须的吗?</summary>
1723

18-
如果`阅读完本文档`后还碰到很多环境搭建的问题,我们建议你还可以再看看[求助讨论区](https://github.com/reactnativecn/react-native-website/issues)。注意!视频教程或者其他网络上的博客和文章可能和本文档有所出入,请以最新版本的本文档所述为准!
24+
如果你使用的是[框架](/architecture/glossary#react-native-framework),则不需要搭建开发环境。使用 React Native 框架时,框架会自动为你构建原生应用,无需你手动安装 Android Studio 或 Xcode。
1925

20-
#### 开发平台
26+
如果你有特殊限制无法使用框架,或者你希望编写自己的框架,那么搭建本地环境是必需的。环境搭建完成后,请参阅[不使用框架开始开发](getting-started-without-a-framework)
2127

22-
<Tabs groupId="os" defaultValue={constants.defaultOs} values={constants.oses} className="pill-tabs">
28+
</details>
29+
:::
30+
31+
#### 开发操作系统
32+
33+
<Tabs groupId="os" queryString defaultValue={constants.defaultOs} values={constants.oses} className="pill-tabs">
2334
<TabItem value="macos">
2435

25-
#### 目标平台
36+
#### 目标操作系统
2637

27-
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
38+
<Tabs groupId="platform" queryString defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
2839
<TabItem value="android">
2940

3041
[//]: # 'macOS, Android'
@@ -44,9 +55,9 @@ import GuideLinuxAndroid from './\_getting-started-linux-android.md'; import Gui
4455
</TabItem>
4556
<TabItem value="windows">
4657

47-
#### 目标平台
58+
#### 目标操作系统
4859

49-
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
60+
<Tabs groupId="platform" queryString defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
5061
<TabItem value="android">
5162

5263
[//]: # 'Windows, Android'
@@ -58,19 +69,21 @@ import GuideLinuxAndroid from './\_getting-started-linux-android.md'; import Gui
5869

5970
[//]: # 'Windows, iOS'
6071

61-
## 暂不支持
72+
## 不支持
6273

63-
> 苹果公司目前只允许在 Mac 电脑上开发 iOS 应用。如果你没有 Mac 电脑,那么只能考虑使用`沙盒环境`,或者先开发 Android 应用了。
74+
:::info
75+
构建 iOS 原生代码项目需要 Mac。你可以使用 [Expo](https://expo.dev) 提供的 [Expo Go](https://expo.dev/go) 在你的 iOS 设备上开发应用。
76+
:::
6477

6578
</TabItem>
6679
</Tabs>
6780

6881
</TabItem>
6982
<TabItem value="linux">
7083

71-
#### 目标平台
84+
#### 目标操作系统
7285

73-
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
86+
<Tabs groupId="platform" queryString defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
7487
<TabItem value="android">
7588

7689
[//]: # 'Linux, Android'
@@ -82,109 +95,14 @@ import GuideLinuxAndroid from './\_getting-started-linux-android.md'; import Gui
8295

8396
[//]: # 'Linux, iOS'
8497

85-
## 暂不支持
86-
87-
> 苹果公司目前只允许在 Mac 电脑上开发 iOS 应用。如果你没有 Mac 电脑,那么只能考虑使用`沙盒环境`,或者先开发 Android 应用了。
88-
89-
</TabItem>
90-
</Tabs>
91-
92-
</TabItem>
93-
</Tabs>
94-
95-
</TabItem>
96-
<TabItem value="quickstart">
97-
98-
> 译注:沙盒环境大量依赖于国外网络环境,也不能直接安装第三方原生组件。不建议国内用户使用
99-
100-
Assuming that you have [Node 12 LTS](https://nodejs.org/en/download/) or greater installed, you can use npm to install the Expo CLI command line utility:
101-
102-
<Tabs groupId="package-manager" defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
103-
<TabItem value="npm">
104-
105-
```shell
106-
npm install -g expo-cli
107-
```
108-
109-
</TabItem>
110-
<TabItem value="yarn">
111-
112-
```shell
113-
yarn global add expo-cli
114-
```
115-
116-
</TabItem>
117-
</Tabs>
118-
119-
Then run the following commands to create a new React Native project called "AwesomeProject":
120-
121-
<Tabs groupId="package-manager" defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
122-
<TabItem value="npm">
123-
124-
```shell
125-
expo init AwesomeProject
126-
127-
cd AwesomeProject
128-
npm start # you can also use: expo start
129-
```
98+
## 不支持
13099

131-
</TabItem>
132-
<TabItem value="yarn">
133-
134-
```shell
135-
expo init AwesomeProject
136-
137-
cd AwesomeProject
138-
yarn start # you can also use: expo start
139-
```
100+
:::info
101+
构建 iOS 原生代码项目需要 Mac。你可以使用 [Expo](https://expo.dev) 提供的 [Expo Go](https://expo.dev/go) 在你的 iOS 设备上开发应用。
102+
:::
140103

141104
</TabItem>
142105
</Tabs>
143106

144-
This will start a development server for you.
145-
146-
<h2>Running your React Native application</h2>
147-
148-
Install the [Expo](https://expo.io) client app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo app to scan the QR code from your terminal to open your project. On iOS, use the built-in QR code scanner of the Camera app.
149-
150-
<h3>Modifying your app</h3>
151-
152-
Now that you have successfully run the app, let's modify it. Open `App.js` in your text editor of choice and edit some lines. The application should reload automatically once you save your changes.
153-
154-
<h3>That's it!</h3>
155-
156-
Congratulations! You've successfully run and modified your first React Native app.
157-
158-
<center><img src="https://cdn.jsdelivr.net/gh/reactnativecn/react-native-website@gh-pages/docs/assets/GettingStartedCongratulations.png" width="150"></img></center>
159-
160-
<h2>Now what?</h2>
161-
162-
Expo also has [docs](https://docs.expo.io) you can reference if you have questions specific to the tool. You can also ask for help at [Expo forums](https://forums.expo.io).
163-
164-
These tools help you get started quickly, but before committing to building your app with Expo CLI, [read about the limitations](https://docs.expo.io/versions/latest/introduction/why-not-expo/).
165-
166-
If you have a problem with Expo, before creating a new issue, please see if there's an existing issue about it:
167-
168-
- in the [Expo CLI issues](https://github.com/expo/expo-cli/issues) (for issues related to Expo CLI), or
169-
- in the [Expo issues](https://github.com/expo/expo/issues) (for issues about the Expo client or SDK).
170-
171-
If you're curious to learn more about React Native, check out the [Introduction to React Native](getting-started).
172-
173-
<h3>Running your app on a simulator or virtual device</h3>
174-
175-
Expo CLI allows you to run your React Native app on a physical device without setting up a development environment. If you want to run your app on the iOS Simulator or an Android Virtual Device, please refer to the instructions for "React Native CLI Quickstart" to learn how to install Xcode or set up your Android development environment.
176-
177-
Once you've set these up, you can launch your app on an Android Virtual Device by running `npm run android`, or on the iOS Simulator by running `npm run ios` (macOS only).
178-
179-
<h3>Caveats</h3>
180-
181-
Because you don't build any native code when using Expo to create a project, it's not possible to include custom native modules beyond the React Native APIs and components that are available in the Expo client app.
182-
183-
If you know that you'll eventually need to include your own native code, Expo is still a good way to get started. In that case you'll need to "[eject](https://docs.expo.io/versions/latest/workflow/customizing/)" eventually to create your own native builds. If you do eject, the "React Native CLI Quickstart" instructions will be required to continue working on your project.
184-
185-
Expo CLI configures your project to use the most recent React Native version that is supported by the Expo client app. The Expo client app usually gains support for a given React Native version about a week after the React Native version is released as stable. You can check [this document](https://docs.expo.io/versions/latest/sdk/overview/#sdk-version) to find out what versions are supported.
186-
187-
If you're integrating React Native into an existing project, you'll want to skip Expo CLI and go directly to setting up the native build environment. Select "React Native CLI Quickstart" above for instructions on configuring a native build environment for React Native.
188-
189107
</TabItem>
190108
</Tabs>

cndocs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default YourApp;
5252
上面的是一个 Snack Player。这是 Expo 提供的一个便捷工具,用来嵌入并运行 React Native 项目,并展示它们在 Android 和 iOS 等平台上的渲染效果。代码是实时可编辑的,因此你可以直接在浏览器中动手试试。现在就把上面的 “Try editing me!” 改成 “Hello, world!” 吧。
5353

5454
:::tip
55-
如果你想在本地搭建开发环境,也可以按照我们的指南[在本机上配置开发环境](set-up-your-environment),然后把这些代码示例粘贴到你的项目中运行。(如果你是 Web 开发者,你可能已经为移动端浏览器调试配置好了本地环境!)
55+
如果你想在本地搭建开发环境,也可以按照我们的指南[在本机上配置开发环境](environment-setup),然后把这些代码示例粘贴到你的项目中运行。(如果你是 Web 开发者,你可能已经为移动端浏览器调试配置好了本地环境!)
5656
:::
5757

5858
## 开发者提示

cndocs/set-up-your-environment.md

Lines changed: 0 additions & 108 deletions
This file was deleted.

cnwebsite/sidebars.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default {
1515
],
1616
环境搭建: [
1717
'environment-setup',
18-
'set-up-your-environment',
1918
'integration-with-existing-apps',
2019
'integration-with-android-fragment',
2120
'building-for-tv',

cnwebsite/versioned_docs/version-0.80/get-started-without-a-framework.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import RemoveGlobalCLI from './\_remove-global-cli.md';
1515

1616
If you have constraints that are not served well by a [Framework](/architecture/glossary#react-native-framework), or you prefer to write your own Framework, you can create a React Native app without using a Framework.
1717

18-
To do so, you'll first need to [set up your environment](set-up-your-environment). Once you're set up, continue with the steps below to create an application and start developing.
18+
To do so, you'll first need to [set up your environment](environment-setup). Once you're set up, continue with the steps below to create an application and start developing.
1919

2020
### Step 1: Creating a new application
2121

0 commit comments

Comments
 (0)