Skip to content

Commit 2e20fb4

Browse files
authored
docs(cndocs): sync translations with upstream — remove React imports, fix drift patterns, update cnwebsite config (#1031)
Translation sync (92 cndocs files): - Remove unused 'import React from react' (React 17+ JSX transform) - Update 'import React, {useState}' → 'import {useState}' (named imports only) - Convert jsx → tsx code fences where EN uses tsx exclusively - Update /blob/master/ → /blob/main/ branch references - Update reactjs.org → react.dev documentation URLs - Update <div class= → <div className= (React DOM prop fix) - Fix fullwidth # → # heading characters (animatedvaluexy, appregistry, backhandler) - Add SafeAreaView from react-native-safe-area-context in flexbox examples - Add static position value to flexbox Position section - Update yogalayout.com → yogalayout.dev links in flexbox - Convert blockquote to :::caution admonition in flexbox cnwebsite config sync: - Update package.json: docusaurus-plugin-copy-page-button ^0.6.2→^0.8.0, react 19.2.6→19.2.7, sass 1.99.0→1.100.0, @types/react 19.2.14→19.2.16 - Replace PrismTheme.ts with PrismThemeDark.ts + PrismThemeLight.ts (light/dark theme split) - Update docusaurus.config.ts to use new PrismTheme imports
1 parent 0e90f72 commit 2e20fb4

97 files changed

Lines changed: 655 additions & 677 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cndocs/_integration-with-existing-apps-ios.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ AppRegistry.registerComponent('HelloWorld', () => App);
159159
让我们创建一个 `App.tsx` 文件。这是一个 [TypeScript](https://www.typescriptlang.org/) 文件,可以包含 [JSX](<https://en.wikipedia.org/wiki/JSX_(JavaScript)>) 表达式。它包含我们要集成到 iOS 应用程序中的根 React Native 组件(<RNTemplateRepoLink href="template/App.tsx">链接</RNTemplateRepoLink>):
160160

161161
```tsx
162-
import React from 'react';
163162
import {
164163
SafeAreaView,
165164
ScrollView,

cndocs/_integration-with-existing-apps-kotlin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ dependencies {
119119
}
120120

121121
+react {
122-
+ // 启用自动链接需要添加以下行,参考: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
122+
+ // 启用自动链接需要添加以下行,参考: https://github.com/react-native-community/cli/blob/main/docs/autolinking.md
123123
+ autolinkLibrariesWithApp()
124124
+}
125125
```
@@ -193,7 +193,6 @@ AppRegistry.registerComponent('HelloWorld', () => App);
193193
下面我们创建一个 `App.tsx` 文件。这是一个 [TypeScript](https://www.typescriptlang.org/) 文件,可以包含 [JSX](<https://en.wikipedia.org/wiki/JSX_(JavaScript)>) 表达式。它包含了我们将在 Android 应用中集成的根 React Native 组件(<RNTemplateRepoLink href="template/App.tsx">链接</RNTemplateRepoLink>):
194194

195195
```tsx
196-
import React from 'react';
197196
import {
198197
SafeAreaView,
199198
ScrollView,

cndocs/accessibilityinfo.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: AccessibilityInfo
88
## 示例
99

1010
```SnackPlayer name=AccessibilityInfo%20Example&supportedPlatforms=android,ios
11-
import React, {useState, useEffect} from 'react';
11+
import {useState, useEffect} from 'react';
1212
import {AccessibilityInfo, Text, StyleSheet} from 'react-native';
1313
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';
1414
@@ -90,16 +90,16 @@ static addEventListener(
9090

9191
添加事件处理函数。支持的事件如下:
9292

93-
| 事件名 | 说明 |
94-
| -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95-
| `accessibilityServiceChanged`<br/><div className="label two-lines android">Android</div> | 当 TalkBack、其他 Android 辅助技术或第三方无障碍服务被启用时触发。处理函数参数为布尔值:当任一无障碍服务启用时为 `true`,否则为 `false` |
96-
| `announcementFinished`<br/><div className="label two-lines ios">iOS</div> | 当读屏器完成播报时触发。处理函数参数是一个对象,包含:<ul><li>`announcement`:读屏器播报的文本。</li><li>`success`:是否成功播报的布尔值。</li></ul> |
97-
| `boldTextChanged`<br/><div className="label two-lines ios">iOS</div> | 当“粗体文本”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false` |
98-
| `grayscaleChanged`<br/><div className="label two-lines ios">iOS</div> | 当“灰度”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false` |
99-
| `invertColorsChanged`<br/><div className="label two-lines ios">iOS</div> | 当“反转颜色”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false` |
100-
| `reduceMotionChanged` | 当“减少动态效果”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false`。(在 Android 上,“开发者选项”中的“过渡动画比例”设为“动画关闭”也会返回 `true`。) |
101-
| `reduceTransparencyChanged`<br/><div className="label two-lines ios">iOS</div> | 当“降低透明度”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false` |
102-
| `screenReaderChanged` | 当读屏器状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false` |
93+
| 事件名 | 说明 |
94+
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95+
| `accessibilityServiceChanged`<br/><div className="label two-lines android">Android</div> | 当 TalkBack、其他 Android 辅助技术或第三方无障碍服务被启用时触发。处理函数参数为布尔值:当任一无障碍服务启用时为 `true`,否则为 `false`|
96+
| `announcementFinished`<br/><div className="label two-lines ios">iOS</div> | 当读屏器完成播报时触发。处理函数参数是一个对象,包含:<ul><li>`announcement`:读屏器播报的文本。</li><li>`success`:是否成功播报的布尔值。</li></ul> |
97+
| `boldTextChanged`<br/><div className="label two-lines ios">iOS</div> | 当“粗体文本”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false`|
98+
| `grayscaleChanged`<br/><div className="label two-lines ios">iOS</div> | 当“灰度”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false`|
99+
| `invertColorsChanged`<br/><div className="label two-lines ios">iOS</div> | 当“反转颜色”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false`|
100+
| `reduceMotionChanged` | 当“减少动态效果”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false`。(在 Android 上,“开发者选项”中的“过渡动画比例”设为“动画关闭”也会返回 `true`。) |
101+
| `reduceTransparencyChanged`<br/><div className="label two-lines ios">iOS</div> | 当“降低透明度”开关状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false`|
102+
| `screenReaderChanged` | 当读屏器状态变化时触发。参数为布尔值:启用为 `true`,否则为 `false`|
103103

104104
---
105105

@@ -126,10 +126,10 @@ static announceForAccessibilityWithOptions(
126126

127127
**参数:**
128128

129-
| 名称 | 类型 | 说明 |
130-
| ----------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------- |
131-
| announcement <div className="label basic required">Required</div> | string | 要播报的字符串 |
132-
| options <div className="label basic required">Required</div> | object | `queue` - 是否排队到当前播报之后 <div className="label ios">iOS</div> |
129+
| 名称 | 类型 | 说明 |
130+
| ----------------------------------------------------------------- | ------ | --------------------------------------------------------------------- |
131+
| announcement <div className="label basic required">Required</div> | string | 要播报的字符串 |
132+
| options <div className="label basic required">Required</div> | object | `queue` - 是否排队到当前播报之后 <div className="label ios">iOS</div> |
133133

134134
---
135135

@@ -144,9 +144,9 @@ static getRecommendedTimeoutMillis(originalTimeout: number): Promise<number>;
144144

145145
**参数:**
146146

147-
| 名称 | 类型 | 说明 |
148-
| -------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
149-
| originalTimeout <div className="label basic required">Required</div> | number | 当“辅助功能超时”未设置时返回的超时值(毫秒)。 |
147+
| 名称 | 类型 | 说明 |
148+
| -------------------------------------------------------------------- | ------ | ---------------------------------------------- |
149+
| originalTimeout <div className="label basic required">Required</div> | number | 当“辅助功能超时”未设置时返回的超时值(毫秒)。 |
150150

151151
---
152152

@@ -287,7 +287,7 @@ static sendAccessibilityEvent(host: HostInstance, eventType: AccessibilityEventT
287287
确保希望接收无障碍焦点的 `View` 设置了 `accessible={true}`
288288
:::
289289

290-
| 名称 | 类型 | 说明 |
291-
| -------------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------- |
292-
| host <div className="label basic required">Required</div> | HostInstance | 要向其发送事件的组件 ref。 |
290+
| 名称 | 类型 | 说明 |
291+
| -------------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------- |
292+
| host <div className="label basic required">Required</div> | HostInstance | 要向其发送事件的组件 ref。 |
293293
| eventType <div className="label basic required">Required</div> | AccessibilityEventTypes | `'click'`(仅 Android)、`'focus'``'viewHoverEnter'`(仅 Android)或 `'windowStateChange'`(仅 Android)之一 |

cndocs/actionsheetios.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: ActionSheetIOS
88
## 示例
99

1010
```SnackPlayer name=ActionSheetIOS%20Example&supportedPlatforms=ios
11-
import React, {useState} from 'react';
11+
import {useState} from 'react';
1212
import {ActionSheetIOS, Button, StyleSheet, Text} from 'react-native';
1313
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';
1414

cndocs/activityindicator.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ title: ActivityIndicator
88
## 示例
99

1010
```SnackPlayer name=ActivityIndicator%20Example
11-
import React from 'react';
1211
import {ActivityIndicator, StyleSheet} from 'react-native';
1312
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';
1413
@@ -62,8 +61,8 @@ export default App;
6261

6362
滚轮的前景颜色。
6463

65-
| 类型 | 默认值 |
66-
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64+
| 类型 | 默认值 |
65+
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
6766
| [color](colors) | `null`(系统默认强调色)<div className="label android">Android</div><hr/><ins style={{background: '#999'}} className="color-box" />`'#999999'` <div className="label ios">iOS</div> |
6867

6968
---

0 commit comments

Comments
 (0)