Skip to content

Commit c486024

Browse files
committed
Remove legacy native module setup documentation and update content to reflect current practices using Bob for project structure setup.
1 parent fcd5bbb commit c486024

File tree

2 files changed

+13
-46
lines changed

2 files changed

+13
-46
lines changed

cndocs/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)

0 commit comments

Comments
 (0)