Skip to content

docs(cndocs): sync latest upstream docs#1028

Merged
sunnylqm merged 1 commit into
productionfrom
auto-translate-20260526
May 27, 2026
Merged

docs(cndocs): sync latest upstream docs#1028
sunnylqm merged 1 commit into
productionfrom
auto-translate-20260526

Conversation

@sunnylqm
Copy link
Copy Markdown

@sunnylqm sunnylqm commented May 26, 2026

Summary

同步本轮 scripts/sync-translations.sh 候选中确认存在实际上游漂移的中文文档,并同步上游 website 配置/样式更新到 cnwebsite

翻译同步

  • cndocs/accessibility.md
    • 更新 increment / decrement accessibility action 在 Android TalkBack 旧版/新版中的触发说明。
    • 更新 label 字段说明,补充辅助技术如何使用标准动作 label 描述具体结果。
  • cndocs/linking.md
    • 跟随上游 Swift AppDelegate 示例,移除两个 override

本轮脚本还列出了 checkboxclipboardcolorsdatepickerandroiddatepickeriosimagepickeriosmodalsegmentedcontroliosstatusbariostimepickerandroid;逐一比对后确认这些是已同步/短 stub 已翻译的 stale candidates,本 PR 未改动。

cnwebsite 同步

  • cnwebsite/package.json
    • 同步新增依赖 docusaurus-plugin-copy-page-button
    • 顺手将 @docusaurus/theme-mermaid 排序到与上游一致的位置。
  • cnwebsite/src/css/customTheme.scss
    • 同步上游 scrollbar gutter 与 light theme scrollbar color 样式。
  • cnwebsite/src/theme/DocItem/Layout/*
    • 同步上游新增的 DocItem Layout override,用于 copy page button。

Verification

  • yarn install
  • yarn --cwd cnwebsite build
    • 构建通过;仍有既有的 versioned docs 链接/HTML minifier warning(如 native-modules-android.md#register-the-moduleNo "p" element in scope 等),与本次改动无关。

Notes

sync-translations.sh 在本分支改完后仍会列出同一批候选,因为脚本按 production 上的中文翻译时间戳判断;这些改动合并回 production 后列表才会更新。

Summary by CodeRabbit

  • New Features

    • Added copy-to-clipboard functionality for documentation pages
    • Enhanced table of contents with adaptive rendering for mobile and desktop
  • Bug Fixes

    • Resolved layout shift issues caused by scrollbar visibility
  • Documentation

    • Improved accessibility documentation formatting and guidance
    • Updated linking documentation with refined code examples
  • Style

    • Refined scrollbar styling for improved visual consistency

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

This PR enhances the React Native documentation website by introducing a new DocItem layout component for better document presentation, updating accessibility and linking documentation with clarifications and corrected examples, and adding scrollbar styling to prevent layout shifts. Supporting package dependencies are reordered and new CSS styling is added.

Changes

Documentation Updates

Layer / File(s) Summary
Accessibility documentation updates
cndocs/accessibility.md
Import path escaping, table reformatting for accessibilityState and accessibilityValue fields, expanded increment/decrement action descriptions with platform-specific guidance, and revised label field explanation clarifying behavior for standard vs. custom actions.
Linking documentation example updates
cndocs/linking.md
Swift method declarations remove override keyword to match correct RCTLinkingManager forwarding patterns.

DocItem Layout Feature and Styling

Layer / File(s) Summary
Theme scrollbar styling
cnwebsite/src/css/customTheme.scss
Global body receives scrollbar-gutter: stable to prevent layout shift, and light theme defines scrollbar-color using theme variables.
DocItem layout component and TOC logic
cnwebsite/src/theme/DocItem/Layout/index.tsx
DocItemLayout composes breadcrumbs, banner, copy button, conditional mobile/desktop TOC, content, footer, and paginator; useDocTOC hook determines visibility based on frontMatter and viewport size; DocItemCopyPageButton wraps copy functionality with styled containers.
DocItem layout styles and package updates
cnwebsite/src/theme/DocItem/Layout/styles.module.css, cnwebsite/package.json
CSS module defines spacing, flex header layout, button/dropdown styling with dark-theme overrides, and responsive rules; dependencies are reordered for consistency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A new layout blooms, with buttons so fair,
Copy pages quick, scrollbars don't glare,
Docs shine brighter with TOC in place,
Accessibility speaks with clearer grace!
The website hops forward, one pull at a time. 🌿✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective: synchronizing upstream documentation and website configuration changes to the Chinese docs repository.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch auto-translate-20260526

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cnwebsite/src/theme/DocItem/Layout/index.tsx`:
- Line 73: The class application currently uses !docTOC.hidden which can be true
even when there are no TOC items; update the condition on the div that builds
className (the clsx call where styles.docItemCol is applied) to only add
styles.docItemCol when a renderable TOC exists, e.g. require both !docTOC.hidden
and docTOC.toc?.length > 0 (or equivalent null-safe check) so the content column
isn't capped when toc is empty.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 89b2319a-bc37-4431-a0d8-4376dffb2167

📥 Commits

Reviewing files that changed from the base of the PR and between 2e9ee68 and 764e1b9.

📒 Files selected for processing (6)
  • cndocs/accessibility.md
  • cndocs/linking.md
  • cnwebsite/package.json
  • cnwebsite/src/css/customTheme.scss
  • cnwebsite/src/theme/DocItem/Layout/index.tsx
  • cnwebsite/src/theme/DocItem/Layout/styles.module.css

const {metadata} = useDoc();
return (
<div className="row">
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Apply .docItemCol only when TOC is actually renderable.

The current condition can cap content width to 75% on desktop even when no TOC column is rendered (e.g., toc.length === 0), leaving empty space.

💡 Proposed fix
-      <div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
+      <div className={clsx('col', docTOC.canRender && styles.docItemCol)}>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
<div className={clsx('col', docTOC.canRender && styles.docItemCol)}>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cnwebsite/src/theme/DocItem/Layout/index.tsx` at line 73, The class
application currently uses !docTOC.hidden which can be true even when there are
no TOC items; update the condition on the div that builds className (the clsx
call where styles.docItemCol is applied) to only add styles.docItemCol when a
renderable TOC exists, e.g. require both !docTOC.hidden and docTOC.toc?.length >
0 (or equivalent null-safe check) so the content column isn't capped when toc is
empty.

@sunnylqm sunnylqm merged commit bf73fc4 into production May 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant