Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Nov 3, 2024
1 parent c6562af commit 7b5e48d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 37 deletions.
8 changes: 5 additions & 3 deletions cndocs/appendix.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# 附录

## 一、术语

整个与新架构相关的指南将遵循以下**术语**

- **Spec** - TypeScript or Flow code that describes the API for a Turbo Native Module or Fabric Native component. Used by **Codegen** to generate boilerplate code.
- **Spec** - TypeScript Flow 形式的代码,用于描述 Turbo Native 模块或 Fabric 原生组件的 API。 **Codegen** 根据它来生成样板代码。

- **Fabric 原生组件** - 指已经适配以与新架构(即新渲染器)良好协同工作的组件。为简洁起见,您可能会看到它们被称为**Fabric 组件**
- **Turbo 原生模块** - 指已经适配以与新架构(即新原生模块系统)良好协同工作的模块。为简洁起见,您可能会看到它们被称为**Turbo 模块**
- **传统原生组件** - 指运行在旧版 React Native 架构上的组件
- **传统原生模块** - 指运行在旧版 React Native 架构上的模块
- **传统原生组件** - 指运行在 React Native 旧架构上的组件
- **传统原生模块** - 指运行在 React Native 旧架构上的模块

## II. Codegen 类型

Expand Down
20 changes: 10 additions & 10 deletions cndocs/debugging-native-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ title: 调试原生代码
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';

<div className="banner-native-code-required">
<h3>Projects with Native Code Only</h3>
<p>The following section only applies to projects with native code exposed. If you are using the managed Expo workflow, see the guide on <a href="https://docs.expo.dev/workflow/prebuild/" target="_blank">prebuild</a> to use this API.</p>
<h3>仅限包含原生代码的项目</h3>
<p>以下部分仅适用于包含原生代码的项目。如果你使用的是托管型 Expo 工作流,请参阅 <a href="https://docs.expo.dev/workflow/prebuild/" target="_blank">prebuild</a> 指南以使用此 API</p>
</div>

## Accessing Logs
## 打印日志

You can display the native logs for an iOS or Android app by using the following commands in a terminal while the app is running:
当应用正在运行时,你可以在终端中使用以下命令打印 iOS Android 应用的日志:

```shell
# For Android:
Expand All @@ -21,18 +21,18 @@ npx react-native log-android
npx react-native log-ios
```

You may also access these through Debug > Open System Log… in the iOS Simulator or by running `adb logcat "*:S" ReactNative:V ReactNativeJS:V` in a terminal while an Android app is running on a device or emulator.
你也可以通过 iOS 模拟器中的 "Debug > Open System Log..." 菜单,或者在运行 Android 应用的设备或模拟器中运行 `adb logcat "*:S" ReactNative:V ReactNativeJS:V` 来访问这些日志。

## Debugging in a Native IDE
## 在原生 IDE 中调试

When working with native code, such as when writing native modules, you can launch the app from Android Studio or Xcode and take advantage of the native debugging features (setting up breakpoints, etc.) as you would in case of building a standard native app.
当你编写原生模块时,你可以使用 Android Studio Xcode 来启动应用,并使用其原生调试功能(设置断点等),就像在构建标准原生应用时一样。

Another option is to run your application using the React Native CLI and attach the native debugger of the native IDE (Android Studio or Xcode) to the process.
另一种选择是使用 React Native CLI 运行应用,并从原生 IDEAndroid Studio Xcode)中附加到进程。

### Android Studio

On Android Studio you can do this by going on the "Run" option on the menu bar, clicking on "Attach to Process..." and selecting the running React Native app.
Android Studio 中,你可以通过点击菜单栏中的 "Run" 选项,然后选择 "Attach to Process...",并选择正在运行的 React Native 应用。

### Xcode

On Xcode click on "Debug" on the top menu bar, select the "Attach to process" option, and select the application in the list of "Likely Targets".
Xcode 中,点击菜单栏中的 "Debug",选择 "Attach to Process...",然后从 "Likely Targets" 列表中选择正在运行的应用。
8 changes: 4 additions & 4 deletions cndocs/native-platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ title: 桥接原生平台能力
- **原生组件:** 原生平台视图、小部件和控制器,通过 React 组件可供你的应用的 JavaScript 代码使用。

:::note
你可能以前熟悉
你可能曾经用过

- [Legacy Native Modules](./legacy/native-modules-intro);
- [Legacy Native Components](./legacy/native-components-android);
- [传统原生模块](./legacy/native-modules-intro);
- [传统原生 UI 组件](./legacy/native-components-android);

这些是我们弃用的原生模块和组件 API。你可以继续使用许多这些遗留库,感谢我们的互操作层。你应该考虑
这些是我们即将弃用的原生模块和组件 API。由于我们引入了向后兼容的互操作层,所以你仍然可以继续使用许多这些遗留库。但即便如此,你还是应该考虑

- 使用替代库,
- 升级到支持新架构的库,或者
Expand Down
8 changes: 5 additions & 3 deletions cnwebsite/versioned_docs/version-0.76/appendix.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# 附录

## 一、术语

整个与新架构相关的指南将遵循以下**术语**

- **Spec** - TypeScript or Flow code that describes the API for a Turbo Native Module or Fabric Native component. Used by **Codegen** to generate boilerplate code.
- **Spec** - TypeScript Flow 形式的代码,用于描述 Turbo Native 模块或 Fabric 原生组件的 API。 **Codegen** 根据它来生成样板代码。

- **Fabric 原生组件** - 指已经适配以与新架构(即新渲染器)良好协同工作的组件。为简洁起见,您可能会看到它们被称为**Fabric 组件**
- **Turbo 原生模块** - 指已经适配以与新架构(即新原生模块系统)良好协同工作的模块。为简洁起见,您可能会看到它们被称为**Turbo 模块**
- **传统原生组件** - 指运行在旧版 React Native 架构上的组件
- **传统原生模块** - 指运行在旧版 React Native 架构上的模块
- **传统原生组件** - 指运行在 React Native 旧架构上的组件
- **传统原生模块** - 指运行在 React Native 旧架构上的模块

## II. Codegen 类型

Expand Down
20 changes: 10 additions & 10 deletions cnwebsite/versioned_docs/version-0.76/debugging-native-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ title: 调试原生代码
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';

<div className="banner-native-code-required">
<h3>Projects with Native Code Only</h3>
<p>The following section only applies to projects with native code exposed. If you are using the managed Expo workflow, see the guide on <a href="https://docs.expo.dev/workflow/prebuild/" target="_blank">prebuild</a> to use this API.</p>
<h3>仅限包含原生代码的项目</h3>
<p>以下部分仅适用于包含原生代码的项目。如果你使用的是托管型 Expo 工作流,请参阅 <a href="https://docs.expo.dev/workflow/prebuild/" target="_blank">prebuild</a> 指南以使用此 API</p>
</div>

## Accessing Logs
## 打印日志

You can display the native logs for an iOS or Android app by using the following commands in a terminal while the app is running:
当应用正在运行时,你可以在终端中使用以下命令打印 iOS Android 应用的日志:

```shell
# For Android:
Expand All @@ -21,18 +21,18 @@ npx react-native log-android
npx react-native log-ios
```

You may also access these through Debug > Open System Log… in the iOS Simulator or by running `adb logcat "*:S" ReactNative:V ReactNativeJS:V` in a terminal while an Android app is running on a device or emulator.
你也可以通过 iOS 模拟器中的 "Debug > Open System Log..." 菜单,或者在运行 Android 应用的设备或模拟器中运行 `adb logcat "*:S" ReactNative:V ReactNativeJS:V` 来访问这些日志。

## Debugging in a Native IDE
## 在原生 IDE 中调试

When working with native code, such as when writing native modules, you can launch the app from Android Studio or Xcode and take advantage of the native debugging features (setting up breakpoints, etc.) as you would in case of building a standard native app.
当你编写原生模块时,你可以使用 Android Studio Xcode 来启动应用,并使用其原生调试功能(设置断点等),就像在构建标准原生应用时一样。

Another option is to run your application using the React Native CLI and attach the native debugger of the native IDE (Android Studio or Xcode) to the process.
另一种选择是使用 React Native CLI 运行应用,并从原生 IDEAndroid Studio Xcode)中附加到进程。

### Android Studio

On Android Studio you can do this by going on the "Run" option on the menu bar, clicking on "Attach to Process..." and selecting the running React Native app.
Android Studio 中,你可以通过点击菜单栏中的 "Run" 选项,然后选择 "Attach to Process...",并选择正在运行的 React Native 应用。

### Xcode

On Xcode click on "Debug" on the top menu bar, select the "Attach to process" option, and select the application in the list of "Likely Targets".
Xcode 中,点击菜单栏中的 "Debug",选择 "Attach to Process...",然后从 "Likely Targets" 列表中选择正在运行的应用。
14 changes: 7 additions & 7 deletions cnwebsite/versioned_docs/version-0.76/native-platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ title: 桥接原生平台能力
- **原生组件:** 原生平台视图、小部件和控制器,通过 React 组件可供你的应用的 JavaScript 代码使用。

:::note
你可能以前熟悉
你可能曾经用过

- [Legacy Native Modules](./legacy/native-modules-intro);
- [Legacy Native Components](./legacy/native-components-android);
- [传统原生模块](./legacy/native-modules-intro);
- [传统原生 UI 组件](./legacy/native-components-android);

这些是我们弃用的原生模块和组件 API。你可以继续使用许多这些遗留库,感谢我们的互操作层。你应该考虑
这些是我们即将弃用的原生模块和组件 API。由于我们引入了向后兼容的互操作层,所以你仍然可以继续使用许多这些遗留库。但即便如此,你还是应该考虑

- 使用替代库,
- 升级到支持新架构的库,或者
Expand All @@ -25,8 +25,8 @@ title: 桥接原生平台能力
:::

1. Turbo 原生模块
- [Android & iOS](turbo-native-modules.md)
- [跨平台使用 C++](the-new-architecture/pure-cxx-modules.md)
- [Android iOS 的原生模块](turbo-native-modules.md)
- [使用 C++ 实现跨平台的原生模块](the-new-architecture/pure-cxx-modules.md)
- [高级:自定义 C++ 类型](the-new-architecture/custom-cxx-types.md)
2. Fabric 原生组件
- [Android & iOS](fabric-native-components.md)
- [Android iOS 的原生 UI 组件](fabric-native-components.md)

0 comments on commit 7b5e48d

Please sign in to comment.