Skip to content

Commit bd653c9

Browse files
authored
docs(cndocs): 同步翻译更新(高质量) (#1006)
1 parent 959e4a1 commit bd653c9

8 files changed

Lines changed: 19 additions & 8 deletions

cndocs/accessibilityinfo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static prefersCrossFadeTransitions(): Promise<boolean>;
235235

236236
---
237237

238-
### `setAccessibilityFocus()`
238+
### 🗑️ `setAccessibilityFocus()`
239239

240240
```tsx
241241
static setAccessibilityFocus(reactTag: number);

cndocs/appstate.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ AppState 通常在处理推送通知的时候用来决定内容和对应的行
2020

2121
## 基本用法
2222

23-
要获取当前的状态,你可以使用 `AppState.currentState`,这个变量会一直保持更新。不过在启动的过程中,`currentState` 可能为 null,直到 `AppState` 通过 bridge 获取到值为止。
23+
要获取当前的状态,你可以使用 `AppState.currentState`,这个变量会一直保持更新。
24+
25+
:::info
26+
如果你使用的是旧架构,`currentState` 在启动时会是 `null`,直到从原生端异步获取到值为止。
27+
:::
2428

2529
```SnackPlayer name=AppState%20Example
2630
import React, {useRef, useState, useEffect} from 'react';
@@ -70,7 +74,7 @@ const styles = StyleSheet.create({
7074
export default AppStateExample;
7175
```
7276

73-
上面的这个例子只会显示"Current state is: active",这是因为应用只有在 `active` 状态下才能被用户看到。null 状态只会在启动时短暂出现。如果你想尝试这段代码,我们建议使用自己的设备而不是内嵌预览。
77+
上面的这个例子只会显示"Current state is: active",这是因为应用只有在 `active` 状态下才能被用户看到。如果你想尝试这段代码,我们建议使用自己的设备而不是内嵌预览。
7478

7579
---
7680

cndocs/building-for-tv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: building-for-tv
3-
title: 为电视和机顶盒制作应用
3+
title: 🗑️ 为电视和机顶盒制作应用
44
hide_table_of_contents: true
55
---
66

cndocs/images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const icon = this.props.active
6767

6868
## 静态的非图片资源
6969

70-
上面描述的`require`语法也可以用来静态地加载你项目中的声音、视频或者文档文件。大多数常见文件类型都支持,包括`.mp3`, `.wav`, `.mp4`, `.mov`, `.html`, `.pdf`完整列表请看 [bundler defaults](https://github.com/facebook/metro/blob/main/packages/metro-config/src/defaults/defaults.js#L16-L51))。
70+
上面描述的`require`语法也可以用来静态地加载你项目中的声音、视频或者文档文件。大多数常见文件类型都支持,包括`.mp3`, `.wav`, `.mp4`, `.mov`, `.html`, `.pdf`完整列表请看 [bundler defaults](https://github.com/facebook/metro/blob/main/packages/metro-config/src/defaults/defaults.js#L16-L51)
7171

7272
你也可以在 [Metro 配置文件](https://metrobundler.dev/docs/configuration)中添加 [`assetExts` resolver 配置项](https://metrobundler.dev/docs/configuration#resolver-options)来支持其他类型的文件。
7373

cndocs/intro-react.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,10 @@ const Cat = (props) => {
396396
/>
397397
```
398398

399-
> 你可能注意到虽然`isHungry`使用了常量关键字[const](https://developer.mozilla.org/Web/JavaScript/Reference/Statements/const),但它看起来还是可以修改!简单来说,当你调用`setIsHungry`这样的设置状态的函数时,其所在的组件会重新渲染。此处这一整个`Cat`函数都会从头重新执行一遍。重新执行的时候,`useState`会返回给我们新设置的值。
399+
:::info
400+
你可能注意到虽然 `isHungry` 使用了常量关键字 [const](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/const),但它看起来还是可以修改!这里的 `const` 并不意味着状态本身不可变,而是指"包含状态和更新函数"的引用不会改变。
401+
实际上,当你调用 `setIsHungry` 这样的状态设置函数时,其所在的组件会重新渲染。此处 `Cat` 函数会从头重新执行一遍——而这一次,`useState` 会返回给我们新的 `isHungry` 值。
402+
:::
400403

401404
最后再把猫咪放进`Cafe`组件:
402405

cndocs/testing-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ test('given empty GroceryShoppingList, user can add an item to it', () => {
245245

246246
快照本身并不能确保你的组件渲染逻辑是正确的,它们只是很好地守护着意外的变化,并检查测试的 React 树下的组件是否接收了预期的 props(样式等)。
247247

248-
我们建议你只使用小的快照(见 [`no-large-snapshots` 规则](https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/no-large-snapshots.md))。如果你想要测试两个 React 组件状态之间的变化,使用 [`snapshot-diff`](https://github.com/jest-community/snapshot-diff)。在不确定的情况下,优先使用前面段落中描述的显式期望。
248+
我们建议你只使用小的快照(见 [`no-large-snapshots` 规则](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-large-snapshots.md))。如果你想要测试两个 React 组件状态之间的变化,使用 [`snapshot-diff`](https://github.com/jest-community/snapshot-diff)。在不确定的情况下,优先使用前面段落中描述的显式期望。
249249

250250
<img src="/docs/assets/p_tests-snapshot.svg" alt=" " />
251251

cndocs/turbo-native-modules.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ React Native 提供了一个名为 [Codegen](/the-new-architecture/what-is-codeg
4545
你可以在 [附录](/appendix.md) 文档中看到可以在规范中使用的类型以及生成的原生类型。
4646
:::
4747

48+
:::info
49+
如果你想更改模块名称和相关规范文件的名称,请确保始终使用 'Native' 作为前缀(例如 `NativeStorage``NativeUsersDefault`)。
50+
:::
51+
4852
以下是一个 `localStorage` 规范的实现:
4953

5054
<Tabs groupId="language" queryString defaultValue={constants.defaultJavaScriptSpecLanguage} values={constants.javaScriptSpecLanguages}>

cndocs/virtualizedlist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ CellRendererComponent 允许自定义由 `renderItem`/`ListItemComponent` 渲染
557557
558558
---
559559
560-
### `disableVirtualization`
560+
### 🗑️ `disableVirtualization`
561561
562562
**已过时** : Virtualization 提供了显著的性能和内存优化,并且完全卸载了位于可视区之外的 react 实例。当且仅当为了调试,你才可以关闭这个特性。
563563

0 commit comments

Comments
 (0)