Skip to content

Commit

Permalink
Update 向后兼容
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Dec 18, 2022
1 parent a7de228 commit 5ea0998
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions cndocs/the-new-architecture/backward-compatibility.md
@@ -1,25 +1,25 @@
---
id: backward-compatibility
title: What Backward Compatibility Is
title: 向后兼容的意义
---

import NewArchitectureWarning from '../\_markdown-new-architecture-warning.mdx';

<NewArchitectureWarning/>

Creating a backward compatible module is important to provide a library that works in both the **Old Architecture** and the **New Architecture**. Not all the users of your library will immediately jump on the New Architecture ship: it is a good thing that they will be able to use your library even if they are still using the old architecture.
创建一个向后兼容的模块很重要,这样可以实现在**旧架构****新架构**中都能工作的库。并不是所有用户都会立刻转到新架构,最好在他们使用旧架构时仍然保持兼容。

The trick to create a good backward compatible module is to minimize the changes required to adopt the new version. In that way, users of the module can smoothly move to the new version and migrate to the New Architecture when they are ready, ideally by issueing one different command.
创建一个良好的向后兼容模块的要点是尽可能减少迁移到新版本所需的更改。这样用户就可以平稳地转到新版本,并在准备好时迁移到新架构,理想情况下最好只用输入一行不同的命令。

To achieve this result, we have to perform few changes in our **TurboModule** and **Fabric Component** configurations. The steps we have to follow are:
为了实现这一结果,我们必须对**TurboModule****Fabric Component**的配置进行几次更改。下面是需要的步骤:

1. **Update the installation configuration** to avoid using code that is not needed by the Old Architecture.
1. **Update the code** to support both architectures. Both Android and iOS build pipelines gives you mechanism to provide a library that will compile with the correct React Native Architecture.
1. **Configure the specs to load the proper implementation**, so that the JavaScript layer leverages the New Architecture whan it is available.
1. **更新安装配置**,以避免使用旧架构不需要的代码。
2. **更新代码**,以支持两个架构。Android iOS 构建流水线都提供了一种方法,使得库能够与正确的 React Native 架构一起编译。
3. **配置加载正确实现的规范**,以便 JavaScript 层在可用时利用新架构。

:::info
The next sections requires that you are familiar with the [Pillars](pillars) of the **New Architecture**.
接下来的部分要求您熟悉**新架构**[支柱](pillars)
:::

- To create a backward compatible **TurboModule**, follow [this guide](backward-compatibility-turbomodules).
- To create a backward compatible **Fabric Component**, follow [this guide](backward-compatibility-fabric-components).
- 要创建向后兼容的**TurboModule**,请遵循此[指南](backward-compatibility-turbomodules)
- 要创建向后兼容的**Fabric 组件**, 请遵循此[指南](backward-compatibility-fabric-components)
@@ -1,25 +1,25 @@
---
id: backward-compatibility
title: What Backward Compatibility Is
title: 向后兼容的意义
---

import NewArchitectureWarning from '../\_markdown-new-architecture-warning.mdx';

<NewArchitectureWarning/>

Creating a backward compatible module is important to provide a library that works in both the **Old Architecture** and the **New Architecture**. Not all the users of your library will immediately jump on the New Architecture ship: it is a good thing that they will be able to use your library even if they are still using the old architecture.
创建一个向后兼容的模块很重要,这样可以实现在**旧架构****新架构**中都能工作的库。并不是所有用户都会立刻转到新架构,最好在他们使用旧架构时仍然保持兼容。

The trick to create a good backward compatible module is to minimize the changes required to adopt the new version. In that way, users of the module can smoothly move to the new version and migrate to the New Architecture when they are ready, ideally by issueing one different command.
创建一个良好的向后兼容模块的要点是尽可能减少迁移到新版本所需的更改。这样用户就可以平稳地转到新版本,并在准备好时迁移到新架构,理想情况下最好只用输入一行不同的命令。

To achieve this result, we have to perform few changes in our **TurboModule** and **Fabric Component** configurations. The steps we have to follow are:
为了实现这一结果,我们必须对**TurboModule****Fabric Component**的配置进行几次更改。下面是需要的步骤:

1. **Update the installation configuration** to avoid using code that is not needed by the Old Architecture.
1. **Update the code** to support both architectures. Both Android and iOS build pipelines gives you mechanism to provide a library that will compile with the correct React Native Architecture.
1. **Configure the specs to load the proper implementation**, so that the JavaScript layer leverages the New Architecture whan it is available.
1. **更新安装配置**,以避免使用旧架构不需要的代码。
2. **更新代码**,以支持两个架构。Android iOS 构建流水线都提供了一种方法,使得库能够与正确的 React Native 架构一起编译。
3. **配置加载正确实现的规范**,以便 JavaScript 层在可用时利用新架构。

:::info
The next sections requires that you are familiar with the [Pillars](pillars) of the **New Architecture**.
接下来的部分要求您熟悉**新架构**[支柱](pillars)
:::

- To create a backward compatible **TurboModule**, follow [this guide](backward-compatibility-turbomodules).
- To create a backward compatible **Fabric Component**, follow [this guide](backward-compatibility-fabric-components).
- 要创建向后兼容的**TurboModule**,请遵循此[指南](backward-compatibility-turbomodules)
- 要创建向后兼容的**Fabric 组件**, 请遵循此[指南](backward-compatibility-fabric-components)
@@ -1,6 +1,6 @@
---
id: pillars
title: 新架构的“两驾马车
title: 新架构的“两大支柱
---

import NewArchitectureWarning from '../\_markdown-new-architecture-warning.mdx';
Expand Down

0 comments on commit 5ea0998

Please sign in to comment.