Skip to content

Commit dddc754

Browse files
committed
Update advanced topics documentation for native modules and components
- Translated section titles and content to Chinese for better accessibility. - Revised the structure and wording to enhance clarity and understanding of advanced topics in native modules and components. - Removed legacy native module setup documentation across multiple versions to streamline the content.
1 parent c486024 commit dddc754

24 files changed

+146
-425
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Advanced Topics on Native Modules Development
1+
# 深入原生组件开发
22

3-
This document contains a set of advanced topics to implement more complex functionalities of Native Components. It is recommended to first read the [Codegen](/docs/the-new-architecture/what-is-codegen) section and the guides on [Native Components](/docs/fabric-native-components-introduction).
3+
本文档包含一些深度技术主题,用于实现原生组件的更复杂功能。建议先阅读 [Codegen](/docs/the-new-architecture/what-is-codegen) 部分和 [原生组件](/docs/fabric-native-components-introduction) 指南以获得更好的理解。
44

5-
This guide will cover the following topics:
5+
本指南将涵盖以下主题:
66

7-
- [Direct Manipulation](/docs/the-new-architecture/direct-manipulation-new-architecture)
8-
- [Measuring the Layout](/docs/the-new-architecture/layout-measurements)
9-
- [Invoking native functions on your native component](/docs/next/the-new-architecture/fabric-component-native-commands)
7+
- [直接操作](/docs/the-new-architecture/direct-manipulation-new-architecture)
8+
- [测量布局](/docs/the-new-architecture/layout-measurements)
9+
- [在原生组件上调用原生函数](/docs/next/the-new-architecture/fabric-component-native-commands)

cndocs/the-new-architecture/advanced-topics-modules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# 原生模块开发高级主题
1+
# 深入原生模块开发
22

3-
本文档包含一系列高级主题,用于实现原生模块的更复杂功能。建议先阅读 [Codegen](/docs/the-new-architecture/what-is-codegen) 部分和 [原生模块](/docs/turbo-native-modules-introduction) 指南
3+
本文档包含一些深度技术主题,用于实现原生模块的更复杂功能。建议先阅读 [Codegen](/docs/the-new-architecture/what-is-codegen) 部分和 [原生模块](/docs/turbo-native-modules-introduction) 指南以获得更好的理解
44

55
本指南将涵盖以下主题:
66

cnwebsite/sidebars.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export default {
9797
{
9898
type: 'doc',
9999
id: 'turbo-native-modules-introduction',
100+
key: 'turbo-native-modules-introduction',
100101
label: 'Android 和 iOS',
101102
},
102103
{
@@ -107,7 +108,7 @@ export default {
107108
{
108109
type: 'doc',
109110
id: 'the-new-architecture/advanced-topics-modules',
110-
label: '高级主题',
111+
label: '深入原生模块开发',
111112
},
112113
],
113114
},
@@ -120,12 +121,13 @@ export default {
120121
{
121122
type: 'doc',
122123
id: 'fabric-native-components-introduction',
124+
key: 'fabric-native-components-introduction',
123125
label: 'Android 和 iOS',
124126
},
125127
{
126128
type: 'doc',
127129
id: 'the-new-architecture/advanced-topics-components',
128-
label: '高级主题',
130+
label: '深入原生组件开发',
129131
},
130132
],
131133
},

cnwebsite/versioned_docs/version-0.76/legacy/native-module-setup.md

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
---
22
id: native-modules-setup
3-
title: Native Modules NPM Package Setup
3+
title: 原生模块配置
44
---
55

66
import NativeDeprecated from '../the-new-architecture/\_markdown_native_deprecation.mdx'
77

88
<NativeDeprecated />
99

10-
Native modules are usually distributed as npm packages, except that on top of the usual JavaScript they will include some native code per platform. To understand more about npm packages you may find [this guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) useful.
10+
原生模块通常作为 npm 包分发,除了常规的 JavaScript 外,它们还会包含每个平台的一些本地代码。要了解更多关于 npm 包的信息,你可能会发现[这个指南](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)很有用。
1111

12-
To get set up with the basic project structure for a native module we will use the community tool called [create-react-native-library](https://callstack.github.io/react-native-builder-bob/create). You can go ahead further and dive deep into how that library works, but for our needs we will only execute the basic script:
12+
为了设置一个原生模块的基本项目结构,我们将使用社区工具[Bob](https://github.com/react-native-community/bob)。你可以继续深入了解该库的工作原理,但对于我们的需求,我们只需要执行基本的`create`脚本:
1313

14-
```shell
15-
npx create-react-native-library@latest react-native-awesome-module
14+
```sh
15+
npx @react-native-community/bob create react-native-awesome-module
1616
```
1717

18-
Where `react-native-awesome-module` is the name you would like for the new module. After doing this you will navigate into `react-native-awesome-module` folder and bootstrap the example project by running:
18+
`react-native-awesome-module` 是您希望为新模块命名的名称。完成此操作后,在终端进入到 `react-native-awesome-module` 文件夹,并运行以下命令来引导示例项目:
1919

20-
```shell
21-
yarn
20+
```sh
21+
yarn bootstrap
2222
```
2323

24-
When the bootstrap is done, you will be able to start the example app by executing one of the following commands:
24+
当引导完成后,您可以通过执行以下任一命令启动示例应用程序:
2525

26-
```shell
26+
```sh
2727
# Android app
2828
yarn example android
2929
# iOS app
3030
yarn example ios
3131
```
3232

33-
When all steps above are done, you will be able to continue with [Android Native Modules](native-modules-android) or [iOS Native Modules](native-modules-ios) guides to add in some code.
33+
当完成上述所有步骤后,您将能够继续使用 [Android Native Modules](native-modules-android)[iOS Native Modules](native-modules-ios) 指南来添加一些代码。
34+
35+
> 想要一个不那么主观的设置?可查看第三方工具 [create-react-native-module](https://github.com/brodybits/create-react-native-module)

cnwebsite/versioned_docs/version-0.77/legacy/native-module-setup.md

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
---
22
id: native-modules-setup
3-
title: Native Modules NPM Package Setup
3+
title: 原生模块配置
44
---
55

66
import NativeDeprecated from '../the-new-architecture/\_markdown_native_deprecation.mdx'
77

88
<NativeDeprecated />
99

10-
Native modules are usually distributed as npm packages, except that on top of the usual JavaScript they will include some native code per platform. To understand more about npm packages you may find [this guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) useful.
10+
原生模块通常作为 npm 包分发,除了常规的 JavaScript 外,它们还会包含每个平台的一些本地代码。要了解更多关于 npm 包的信息,你可能会发现[这个指南](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)很有用。
1111

12-
To get set up with the basic project structure for a native module we will use the community tool called [create-react-native-library](https://callstack.github.io/react-native-builder-bob/create). You can go ahead further and dive deep into how that library works, but for our needs we will only execute the basic script:
12+
为了设置一个原生模块的基本项目结构,我们将使用社区工具[Bob](https://github.com/react-native-community/bob)。你可以继续深入了解该库的工作原理,但对于我们的需求,我们只需要执行基本的`create`脚本:
1313

14-
```shell
15-
npx create-react-native-library@latest react-native-awesome-module
14+
```sh
15+
npx @react-native-community/bob create react-native-awesome-module
1616
```
1717

18-
Where `react-native-awesome-module` is the name you would like for the new module. After doing this you will navigate into `react-native-awesome-module` folder and bootstrap the example project by running:
18+
`react-native-awesome-module` 是您希望为新模块命名的名称。完成此操作后,在终端进入到 `react-native-awesome-module` 文件夹,并运行以下命令来引导示例项目:
1919

20-
```shell
21-
yarn
20+
```sh
21+
yarn bootstrap
2222
```
2323

24-
When the bootstrap is done, you will be able to start the example app by executing one of the following commands:
24+
当引导完成后,您可以通过执行以下任一命令启动示例应用程序:
2525

26-
```shell
26+
```sh
2727
# Android app
2828
yarn example android
2929
# iOS app
3030
yarn example ios
3131
```
3232

33-
When all steps above are done, you will be able to continue with [Android Native Modules](native-modules-android) or [iOS Native Modules](native-modules-ios) guides to add in some code.
33+
当完成上述所有步骤后,您将能够继续使用 [Android Native Modules](native-modules-android)[iOS Native Modules](native-modules-ios) 指南来添加一些代码。
34+
35+
> 想要一个不那么主观的设置?可查看第三方工具 [create-react-native-module](https://github.com/brodybits/create-react-native-module)

cnwebsite/versioned_docs/version-0.78/legacy/native-module-setup.md

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
---
22
id: native-modules-setup
3-
title: Native Modules NPM Package Setup
3+
title: 原生模块配置
44
---
55

66
import NativeDeprecated from '../the-new-architecture/\_markdown_native_deprecation.mdx'
77

88
<NativeDeprecated />
99

10-
Native modules are usually distributed as npm packages, except that on top of the usual JavaScript they will include some native code per platform. To understand more about npm packages you may find [this guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) useful.
10+
原生模块通常作为 npm 包分发,除了常规的 JavaScript 外,它们还会包含每个平台的一些本地代码。要了解更多关于 npm 包的信息,你可能会发现[这个指南](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)很有用。
1111

12-
To get set up with the basic project structure for a native module we will use the community tool called [create-react-native-library](https://callstack.github.io/react-native-builder-bob/create). You can go ahead further and dive deep into how that library works, but for our needs we will only execute the basic script:
12+
为了设置一个原生模块的基本项目结构,我们将使用社区工具[Bob](https://github.com/react-native-community/bob)。你可以继续深入了解该库的工作原理,但对于我们的需求,我们只需要执行基本的`create`脚本:
1313

14-
```shell
15-
npx create-react-native-library@latest react-native-awesome-module
14+
```sh
15+
npx @react-native-community/bob create react-native-awesome-module
1616
```
1717

18-
Where `react-native-awesome-module` is the name you would like for the new module. After doing this you will navigate into `react-native-awesome-module` folder and bootstrap the example project by running:
18+
`react-native-awesome-module` 是您希望为新模块命名的名称。完成此操作后,在终端进入到 `react-native-awesome-module` 文件夹,并运行以下命令来引导示例项目:
1919

20-
```shell
21-
yarn
20+
```sh
21+
yarn bootstrap
2222
```
2323

24-
When the bootstrap is done, you will be able to start the example app by executing one of the following commands:
24+
当引导完成后,您可以通过执行以下任一命令启动示例应用程序:
2525

26-
```shell
26+
```sh
2727
# Android app
2828
yarn example android
2929
# iOS app
3030
yarn example ios
3131
```
3232

33-
When all steps above are done, you will be able to continue with [Android Native Modules](native-modules-android) or [iOS Native Modules](native-modules-ios) guides to add in some code.
33+
当完成上述所有步骤后,您将能够继续使用 [Android Native Modules](native-modules-android)[iOS Native Modules](native-modules-ios) 指南来添加一些代码。
34+
35+
> 想要一个不那么主观的设置?可查看第三方工具 [create-react-native-module](https://github.com/brodybits/create-react-native-module)

cnwebsite/versioned_docs/version-0.79/legacy/native-module-setup.md

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

0 commit comments

Comments
 (0)