Skip to content

Commit 46b8577

Browse files
committed
fix(cnwebsite): fix build for Docusaurus 3.10
- Add markdown.format: 'detect' to avoid MDX parsing of .md files - Remove HTML comments in versioned docs (invalid in MDX v3) - Remove custom heading ID {#imageview-example} (invalid MDX expression) - Remove orphaned sidebar entries (metro, codegen, create-module-library) - Reorder getting-started tabs: React Native CLI before Expo - Update default guide to 'native' in TabsConstants
1 parent 06ea604 commit 46b8577

79 files changed

Lines changed: 95 additions & 347 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cndocs/getting-started.md

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,88 @@ import GuideLinuxAndroid from './\_getting-started-linux-android.md'; import Gui
1111
欢迎使用 React Native!这篇文档会帮助你搭建基本的 React Native 开发环境。
1212

1313
<Tabs groupId="guide" defaultValue={constants.defaultGuide} values={constants.guides}>
14+
<TabItem value="native">
15+
16+
根据你所使用的操作系统、针对的目标平台不同,具体步骤有所不同。如果想同时开发 iOS 和 Android 也没问题,你只需要先选一个平台开始,另一个平台的环境搭建只是稍有不同。
17+
18+
如果`阅读完本文档`后还碰到很多环境搭建的问题,我们建议你还可以再看看[求助讨论区](https://github.com/reactnativecn/react-native-website/issues)。注意!视频教程或者其他网络上的博客和文章可能和本文档有所出入,请以最新版本的本文档所述为准!
19+
20+
#### 开发平台
21+
22+
<Tabs groupId="os" defaultValue={constants.defaultOs} values={constants.oses} className="pill-tabs">
23+
<TabItem value="macos">
24+
25+
#### 目标平台
26+
27+
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
28+
<TabItem value="android">
29+
30+
[//]: # 'macOS, Android'
31+
32+
<GuideMacOSAndroid/>
33+
34+
</TabItem>
35+
<TabItem value="ios">
36+
37+
[//]: # 'macOS, iOS'
38+
39+
<GuideMacOSIOS/>
40+
41+
</TabItem>
42+
</Tabs>
43+
44+
</TabItem>
45+
<TabItem value="windows">
46+
47+
#### 目标平台
48+
49+
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
50+
<TabItem value="android">
51+
52+
[//]: # 'Windows, Android'
53+
54+
<GuideWindowsAndroid/>
55+
56+
</TabItem>
57+
<TabItem value="ios">
58+
59+
[//]: # 'Windows, iOS'
60+
61+
## 暂不支持
62+
63+
> 苹果公司目前只允许在 Mac 电脑上开发 iOS 应用。如果你没有 Mac 电脑,那么只能考虑使用`沙盒环境`,或者先开发 Android 应用了。
64+
65+
</TabItem>
66+
</Tabs>
67+
68+
</TabItem>
69+
<TabItem value="linux">
70+
71+
#### 目标平台
72+
73+
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
74+
<TabItem value="android">
75+
76+
[//]: # 'Linux, Android'
77+
78+
<GuideLinuxAndroid/>
79+
80+
</TabItem>
81+
<TabItem value="ios">
82+
83+
[//]: # 'Linux, iOS'
84+
85+
## 暂不支持
86+
87+
> 苹果公司目前只允许在 Mac 电脑上开发 iOS 应用。如果你没有 Mac 电脑,那么只能考虑使用`沙盒环境`,或者先开发 Android 应用了。
88+
89+
</TabItem>
90+
</Tabs>
91+
92+
</TabItem>
93+
</Tabs>
94+
95+
</TabItem>
1496
<TabItem value="quickstart">
1597

1698
> 译注:沙盒环境大量依赖于国外网络环境,也不能直接安装第三方原生组件。不建议国内用户使用
@@ -104,87 +186,5 @@ Expo CLI configures your project to use the most recent React Native version tha
104186

105187
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.
106188

107-
</TabItem>
108-
<TabItem value="native">
109-
110-
根据你所使用的操作系统、针对的目标平台不同,具体步骤有所不同。如果想同时开发 iOS 和 Android 也没问题,你只需要先选一个平台开始,另一个平台的环境搭建只是稍有不同。
111-
112-
如果`阅读完本文档`后还碰到很多环境搭建的问题,我们建议你还可以再看看[求助讨论区](https://github.com/reactnativecn/react-native-website/issues)。注意!视频教程或者其他网络上的博客和文章可能和本文档有所出入,请以最新版本的本文档所述为准!
113-
114-
#### 开发平台
115-
116-
<Tabs groupId="os" defaultValue={constants.defaultOs} values={constants.oses} className="pill-tabs">
117-
<TabItem value="macos">
118-
119-
#### 目标平台
120-
121-
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
122-
<TabItem value="android">
123-
124-
[//]: # 'macOS, Android'
125-
126-
<GuideMacOSAndroid/>
127-
128-
</TabItem>
129-
<TabItem value="ios">
130-
131-
[//]: # 'macOS, iOS'
132-
133-
<GuideMacOSIOS/>
134-
135-
</TabItem>
136-
</Tabs>
137-
138-
</TabItem>
139-
<TabItem value="windows">
140-
141-
#### 目标平台
142-
143-
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
144-
<TabItem value="android">
145-
146-
[//]: # 'Windows, Android'
147-
148-
<GuideWindowsAndroid/>
149-
150-
</TabItem>
151-
<TabItem value="ios">
152-
153-
[//]: # 'Windows, iOS'
154-
155-
## 暂不支持
156-
157-
> 苹果公司目前只允许在 Mac 电脑上开发 iOS 应用。如果你没有 Mac 电脑,那么只能考虑使用`沙盒环境`,或者先开发 Android 应用了。
158-
159-
</TabItem>
160-
</Tabs>
161-
162-
</TabItem>
163-
<TabItem value="linux">
164-
165-
#### 目标平台
166-
167-
<Tabs groupId="platform" defaultValue={constants.defaultPlatform} values={constants.platforms} className="pill-tabs">
168-
<TabItem value="android">
169-
170-
[//]: # 'Linux, Android'
171-
172-
<GuideLinuxAndroid/>
173-
174-
</TabItem>
175-
<TabItem value="ios">
176-
177-
[//]: # 'Linux, iOS'
178-
179-
## 暂不支持
180-
181-
> 苹果公司目前只允许在 Mac 电脑上开发 iOS 应用。如果你没有 Mac 电脑,那么只能考虑使用`沙盒环境`,或者先开发 Android 应用了。
182-
183-
</TabItem>
184-
</Tabs>
185-
186-
</TabItem>
187-
</Tabs>
188-
189189
</TabItem>
190190
</Tabs>

cndocs/legacy/native-components-android.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import NativeDeprecated from '../the-new-architecture/\_markdown_native_deprecat
1616
您还可以通过一个命令来配置生成包含原生组件的本地库模板。阅读[本地库设置](local-library-setup)指南以获取更多详细信息。
1717
:::
1818

19-
## ImageView 示例 {#imageview-example}
19+
## ImageView 示例
2020

2121
在这个例子里,我们来看看为了让 JavaScript 中可以使用 ImageView,需要做哪些准备工作。
2222

@@ -863,4 +863,4 @@ export const MyView = ({ style }) => {
863863
};
864864
```
865865
866-
如果您想使用公开属性设置器 `@ReactProp` (or `@ReactPropGroup`) 详见上面的 [ImageView 示例](#imageview-example)。
866+
如果您想使用公开属性设置器 `@ReactProp` (or `@ReactPropGroup`) 详见上面的 [ImageView 示例](#imageview-example)。

cnwebsite/core/TabsConstants.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ const jsDebuggers = [
5858
const defaultJsDebugger = 'flipper';
5959

6060
const guides = [
61-
{label: 'Expo Go Quickstart', value: 'quickstart'},
6261
{label: 'React Native CLI Quickstart', value: 'native'},
62+
{label: 'Expo Go Quickstart', value: 'quickstart'},
6363
];
64-
const defaultGuide = 'quickstart';
64+
const defaultGuide = 'native';
6565

6666
const platforms = [
6767
{label: 'Android', value: 'android'},

cnwebsite/docusaurus.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const isDeployPreview =
3232
const config: Config = {
3333
markdown: {
3434
mermaid: true,
35+
format: 'detect',
3536
},
3637
themes: ['@docusaurus/theme-mermaid'],
3738
future: {

cnwebsite/sidebars.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default {
2424
开发流程: [
2525
'running-on-device',
2626
'fast-refresh',
27-
'metro',
2827
'libraries',
2928
'typescript',
3029
'strict-typescript-api',
@@ -84,11 +83,7 @@ export default {
8483
'profiling',
8584
],
8685
'JavaScript 运行环境': ['javascript-environment', 'timers', 'hermes'],
87-
Codegen: [
88-
'the-new-architecture/what-is-codegen',
89-
'the-new-architecture/using-codegen',
90-
'the-new-architecture/codegen-cli',
91-
],
86+
Codegen: ['the-new-architecture/codegen-cli'],
9287
原生开发: [
9388
{
9489
type: 'doc',
@@ -149,10 +144,6 @@ export default {
149144
id: 'appendix',
150145
label: '附录',
151146
},
152-
{
153-
type: 'doc',
154-
id: 'the-new-architecture/create-module-library',
155-
},
156147
],
157148
},
158149
],

cnwebsite/versioned_docs/version-0.70/colors.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ React Native 还支持将颜色表示为`int`值(以 RGB 颜色模式):
5353

5454
你还可以使用颜色名称来作为颜色值. React Native 遵循[CSS3 规范](http://www.w3.org/TR/css3-color/#svg-color)
5555

56-
<!-- alex ignore black white -->
57-
5856
- <ins style={{background: '#f0f8ff'}} className="color-box" /> aliceblue (<code>#f0f8ff</code>)
5957
- <ins style={{background: '#faebd7'}} className="color-box" /> antiquewhite (<code>#faebd7</code>)
6058
- <ins style={{background: '#00ffff'}} className="color-box" /> aqua (<code>#00ffff</code>)

cnwebsite/versioned_docs/version-0.70/new-architecture-library-intro.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export default (TurboModuleRegistry.get<Spec>('<MODULE_NAME>'): ?Spec);
5454
<TabItem value="TypeScript">
5555
5656
```ts
57-
import type { TurboModule } from 'react-native';
58-
import { TurboModuleRegistry } from 'react-native';
57+
import type {TurboModule} from 'react-native';
58+
import {TurboModuleRegistry} from 'react-native';
5959

6060
export interface Spec extends TurboModule {
6161
readonly getConstants: () => {};
@@ -102,16 +102,16 @@ export default (codegenNativeComponent<NativeProps>(
102102
<TabItem value="TypeScript">
103103
104104
```ts
105-
import type { ViewProps } from 'ViewPropTypes';
106-
import type { HostComponent } from 'react-native';
105+
import type {ViewProps} from 'ViewPropTypes';
106+
import type {HostComponent} from 'react-native';
107107
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
108108

109109
export interface NativeProps extends ViewProps {
110110
// add other props here
111111
}
112112

113113
export default codegenNativeComponent<NativeProps>(
114-
'<FABRIC COMPONENT>'
114+
'<FABRIC COMPONENT>',
115115
) as HostComponent<NativeProps>;
116116
```
117117
@@ -122,8 +122,6 @@ export default codegenNativeComponent<NativeProps>(
122122
123123
When using Flow or TypeScript, you will be using [type annotations](https://flow.org/en/docs/types/) to define your spec. Keeping in mind that the goal of defining a JavaScript spec is to ensure the generated native interface code is type safe, the set of supported types will be those that can be mapped one-to-one to a corresponding type on the native platform.
124124
125-
<!-- alex ignore primitive -->
126-
127125
In general, this means you can use primitive types (strings, numbers, booleans), as well as function types, object types, and array types. Union types, on the other hand, are not supported. All types must be read-only. For Flow: either `+` or `$ReadOnly<>` or `{||}` objects. For TypeScript: `readonly` for properties, `Readonly<>` for objects, and `ReadonlyArray<>` for arrays.
128126
129127
> See Appendix [I. Flow Type to Native Type Mapping](#i-flow-type-to-native-type-mapping).
@@ -150,8 +148,6 @@ If your existing native module has methods with the same name on multiple platfo
150148
151149
## Make sure _autolinking_ is enabled
152150
153-
<!-- alex ignore master -->
154-
155151
[Autolinking](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) is a feature of the React Native CLI that simplifies the installation of third-party React Native libraries. Instructions to enable _autolinking_ are available at https://github.com/react-native-community/cli/blob/master/docs/autolinking.md.
156152
157153
### Android
@@ -501,10 +497,10 @@ return <RNTMyNativeViewNativeComponent />;
501497
```
502498
503499
```js title="RNTMyNativeViewNativeComponent.js"
504-
import { requireNativeComponent } from 'react-native';
500+
import {requireNativeComponent} from 'react-native';
505501

506502
const RNTMyNativeViewNativeComponent = requireNativeComponent(
507-
'RNTMyNativeView'
503+
'RNTMyNativeView',
508504
);
509505

510506
export default RNTMyNativeViewNativeComponent;

cnwebsite/versioned_docs/version-0.70/running-on-device.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ $ npx react-native run-android
8080

8181
你可以在**System Preferences****Network**中找到 IP 地址。
8282

83-
<!-- alex ignore host -->
84-
8583
1. 首先确保你的电脑和手机设备在**同一个 Wi-Fi 环境**下。
8684
2. 在设备上运行你的 React Native 应用。和打开其它 App 一样操作。
8785
3. 你应该会看到一个“红屏”错误提示。这是正常的,下面的步骤会解决这个报错。
@@ -157,8 +155,6 @@ $ npx react-native run-android
157155

158156
你可以在**System Preferences****Network**中找到 IP 地址。
159157

160-
<!-- alex ignore host -->
161-
162158
1. 首先确保你的电脑和手机设备在**同一个 Wi-Fi 环境**下。
163159
2. 在设备上运行你的 React Native 应用。和打开其它 App 一样操作。
164160
3. 你应该会看到一个“红屏”错误提示。这是正常的,下面的步骤会解决这个报错。
@@ -234,8 +230,6 @@ $ npx react-native run-android
234230

235231
你可以在**System Preferences****Network**中找到 IP 地址。
236232

237-
<!-- alex ignore host -->
238-
239233
1. 首先确保你的电脑和手机设备在**同一个 Wi-Fi 环境**下。
240234
2. 在设备上运行你的 React Native 应用。和打开其它 App 一样操作。
241235
3. 你应该会看到一个“红屏”错误提示。这是正常的,下面的步骤会解决这个报错。

cnwebsite/versioned_docs/version-0.71/colors.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ React Native 还支持将颜色表示为`int`值(以 RGB 颜色模式):
5353

5454
你还可以使用颜色名称来作为颜色值. React Native 遵循[CSS3 规范](http://www.w3.org/TR/css3-color/#svg-color)
5555

56-
<!-- alex ignore black white -->
57-
5856
- <ins style={{background: '#f0f8ff'}} className="color-box" /> aliceblue (<code>#f0f8ff</code>)
5957
- <ins style={{background: '#faebd7'}} className="color-box" /> antiquewhite (<code>#faebd7</code>)
6058
- <ins style={{background: '#00ffff'}} className="color-box" /> aqua (<code>#00ffff</code>)

cnwebsite/versioned_docs/version-0.71/new-architecture-library-intro.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ export default codegenNativeComponent<NativeProps>(
122122
123123
When using Flow or TypeScript, you will be using [type annotations](https://flow.org/en/docs/types/) to define your spec. Keeping in mind that the goal of defining a JavaScript spec is to ensure the generated native interface code is type-safe, the set of supported types will be those that can be mapped one-to-one to a corresponding type on the native platform.
124124
125-
<!-- alex ignore primitive -->
126-
127125
In general, this means you can use primitive types (strings, numbers, booleans), function types, object types, and array types. Union types, on the other hand, are not supported. All types must be read-only. For Flow: either `+` or `$ReadOnly<>` or `{||}` objects. For TypeScript: `readonly` for properties, `Readonly<>` for objects, and `ReadonlyArray<>` for arrays.
128126
129127
> See Appendix [II. Flow Type to Native Type Mapping](new-architecture-appendix#ii-flow-type-to-native-type-mapping).
@@ -150,8 +148,6 @@ If your existing native module has methods with the same name on multiple platfo
150148
151149
## Make Sure _autolinking_ is Enabled
152150
153-
<!-- alex ignore master -->
154-
155151
[Autolinking](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) is a feature of the React Native CLI that simplifies the installation of third-party React Native libraries. Instructions to enable _autolinking_ are available in the [React Native CLI docs](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md).
156152
157153
### Android

0 commit comments

Comments
 (0)