fix(cnwebsite): 修复 Docusaurus 3.10 编译 + 调整 getting-started 顺序#1022
Conversation
- Add markdown.format: 'detect' to avoid MDX parsing of .md files
- Remove HTML comments in versioned docs (invalid in MDX v3)
- Remove custom heading ID {#imageview-example} (invalid MDX expression)
- Remove orphaned sidebar entries (metro, codegen, create-module-library)
- Reorder getting-started tabs: React Native CLI before Expo
- Update default guide to 'native' in TabsConstants
❌ Deploy Preview for reactnativecn failed. Why did it fail? →
|
📝 WalkthroughWalkthroughThis PR restructures the React Native Chinese documentation site by updating navigation defaults, reorganizing tab layouts, adding Mermaid configuration, and systematically removing HTML comment artifacts across 15+ versioned docs while fixing a broken anchor reference. ChangesDocumentation and Navigation Restructuring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (3)
cndocs/getting-started.md (3)
20-20: 💤 Low valueHeading level skips from H1 to H4.
The "开发平台" heading at line 20 is marked as H4 (
####), but it should increment by only one level at a time according to markdown best practices. Consider using H2 (##) instead to maintain proper heading hierarchy.📝 Suggested fix for heading level
-#### 开发平台 +## 开发平台🤖 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 `@cndocs/getting-started.md` at line 20, The "开发平台" heading is currently a H4 (#### 开发平台) which skips levels after the H1; change that line to H2 (## 开发平台) so the heading increments properly (H1 -> H2), and review surrounding headings in getting-started.md to ensure the overall document hierarchy is consistent.
61-61: 💤 Low valueDuplicate "暂不支持" headings across tab contexts.
The heading "暂不支持" appears at lines 61 and 85. Since these occur in different OS tab contexts (Windows/iOS and Linux/iOS), the duplication may be acceptable, but consider whether the headings could be made more specific (e.g., "iOS 暂不支持" or adding context about which platform).
Also applies to: 85-85
🤖 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 `@cndocs/getting-started.md` at line 61, The duplicate markdown heading "## 暂不支持" appears in multiple OS tab contexts; update each heading to include the platform context so they are unique and clear (for example change the heading in the Windows/iOS tab to "## Windows/iOS 暂不支持" and the one in the Linux/iOS tab to "## Linux/iOS 暂不支持" or otherwise add platform-specific text), ensuring you update the headings that contain the exact text "## 暂不支持" so readers can tell which platform each section refers to.
47-47: 💤 Low valueDuplicate "目标平台" headings across tab contexts.
The heading "目标平台" appears at lines 47 and 71 (and implicitly at line 25). While these occur in different tab contexts, duplicate headings can affect document navigation and accessibility. Consider adding distinguishing text or using different heading structures.
Also applies to: 71-71
🤖 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 `@cndocs/getting-started.md` at line 47, The document contains repeated headings "目标平台" in the same file (use the literal heading text "目标平台" to find them); update each duplicate heading to be unique and context-specific (for example "目标平台 — 桌面", "目标平台 — 移动" or "目标平台(安装向导)"), or change some duplicates to a lower-level heading to preserve navigation hierarchy; ensure the modified headings remain clear in their tab contexts and retain consistent formatting so anchor links and accessibility tools can distinguish them.
🤖 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 `@cndocs/legacy/native-components-android.md`:
- Line 19: The internal link at line 866 points to the removed custom anchor
`#imageview-example`; update that link to the auto-generated Docusaurus anchor
for the heading "ImageView 示例" by replacing `#imageview-example` with
`#imageview-示例` (or update to use the exact heading text anchor format generated
from the "ImageView 示例" heading) so the link matches the auto-generated anchor
for the heading.
In `@cnwebsite/sidebars.ts`:
- Line 86: The sidebar entry Codegen: ['the-new-architecture/codegen-cli'] was
added but many docs still reference removed pages (what-is-codegen.md,
using-codegen.md, create-module-library.md); open the affected files
(cndocs/turbo-native-modules.md, cndocs/turbo-native-modules-android.md,
cndocs/the-new-architecture/pure-cxx-modules.md,
cndocs/the-new-architecture/advanced-topics-components.md,
cndocs/the-new-architecture/advanced-topics-modules.md,
cndocs/new-architecture-turbo-module.md, cndocs/fabric-native-components.md) and
either update links to point to the new /the-new-architecture/codegen-cli
location or remove/replace the links with appropriate existing docs, ensuring
any references to what-is-codegen, using-codegen, or create-module-library are
replaced consistently with the new codegen-cli page or deleted if the content no
longer exists.
In `@cnwebsite/versioned_docs/version-0.70/new-architecture-library-intro.md`:
- Around line 105-106: The import for the TypeScript type ViewProps is using the
wrong module; update the import so that ViewProps is imported from
'react-native' (not 'ViewPropTypes') — replace the existing import line that
reads import type {ViewProps} from 'ViewPropTypes' with an import from
'react-native' alongside HostComponent (ensure the symbol ViewProps is
referenced from 'react-native' so TypeScript resolution works for consumers).
---
Nitpick comments:
In `@cndocs/getting-started.md`:
- Line 20: The "开发平台" heading is currently a H4 (#### 开发平台) which skips levels
after the H1; change that line to H2 (## 开发平台) so the heading increments
properly (H1 -> H2), and review surrounding headings in getting-started.md to
ensure the overall document hierarchy is consistent.
- Line 61: The duplicate markdown heading "## 暂不支持" appears in multiple OS tab
contexts; update each heading to include the platform context so they are unique
and clear (for example change the heading in the Windows/iOS tab to "##
Windows/iOS 暂不支持" and the one in the Linux/iOS tab to "## Linux/iOS 暂不支持" or
otherwise add platform-specific text), ensuring you update the headings that
contain the exact text "## 暂不支持" so readers can tell which platform each section
refers to.
- Line 47: The document contains repeated headings "目标平台" in the same file (use
the literal heading text "目标平台" to find them); update each duplicate heading to
be unique and context-specific (for example "目标平台 — 桌面", "目标平台 — 移动" or
"目标平台(安装向导)"), or change some duplicates to a lower-level heading to preserve
navigation hierarchy; ensure the modified headings remain clear in their tab
contexts and retain consistent formatting so anchor links and accessibility
tools can distinguish them.
🪄 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: 41ed51ac-4df7-4170-a468-d09ddbac3444
📒 Files selected for processing (79)
cndocs/getting-started.mdcndocs/legacy/native-components-android.mdcnwebsite/core/TabsConstants.tsxcnwebsite/docusaurus.config.tscnwebsite/sidebars.tscnwebsite/versioned_docs/version-0.70/colors.mdcnwebsite/versioned_docs/version-0.70/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.70/running-on-device.mdcnwebsite/versioned_docs/version-0.71/colors.mdcnwebsite/versioned_docs/version-0.71/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.71/running-on-device.mdcnwebsite/versioned_docs/version-0.72/colors.mdcnwebsite/versioned_docs/version-0.72/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.72/running-on-device.mdcnwebsite/versioned_docs/version-0.73/colors.mdcnwebsite/versioned_docs/version-0.73/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.73/running-on-device.mdcnwebsite/versioned_docs/version-0.74/colors.mdcnwebsite/versioned_docs/version-0.74/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.74/running-on-device.mdcnwebsite/versioned_docs/version-0.75/colors.mdcnwebsite/versioned_docs/version-0.75/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.75/running-on-device.mdcnwebsite/versioned_docs/version-0.76/colors.mdcnwebsite/versioned_docs/version-0.76/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.76/running-on-device.mdcnwebsite/versioned_docs/version-0.76/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.76/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.76/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.77/colors.mdcnwebsite/versioned_docs/version-0.77/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.77/running-on-device.mdcnwebsite/versioned_docs/version-0.77/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.77/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.77/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.78/colors.mdcnwebsite/versioned_docs/version-0.78/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.78/running-on-device.mdcnwebsite/versioned_docs/version-0.78/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.78/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.78/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.79/colors.mdcnwebsite/versioned_docs/version-0.79/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.79/running-on-device.mdcnwebsite/versioned_docs/version-0.79/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.79/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.79/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.80/colors.mdcnwebsite/versioned_docs/version-0.80/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.80/running-on-device.mdcnwebsite/versioned_docs/version-0.80/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.80/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.80/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.81/colors.mdcnwebsite/versioned_docs/version-0.81/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.81/running-on-device.mdcnwebsite/versioned_docs/version-0.81/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.81/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.81/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.82/colors.mdcnwebsite/versioned_docs/version-0.82/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.82/running-on-device.mdcnwebsite/versioned_docs/version-0.82/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.82/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.82/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.83/colors.mdcnwebsite/versioned_docs/version-0.83/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.83/running-on-device.mdcnwebsite/versioned_docs/version-0.83/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.83/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.83/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.84/new-architecture-library-intro.mdcnwebsite/versioned_docs/version-0.84/running-on-device.mdcnwebsite/versioned_docs/version-0.84/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.84/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.84/the-new-architecture/what-is-codegen.mdcnwebsite/versioned_docs/version-0.85/the-new-architecture/create-module-library.mdcnwebsite/versioned_docs/version-0.85/the-new-architecture/using-codegen.mdcnwebsite/versioned_docs/version-0.85/the-new-architecture/what-is-codegen.md
💤 Files with no reviewable changes (73)
- cnwebsite/versioned_docs/version-0.85/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.81/colors.md
- cnwebsite/versioned_docs/version-0.83/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.80/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.82/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.82/colors.md
- cnwebsite/versioned_docs/version-0.84/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.77/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.70/running-on-device.md
- cnwebsite/versioned_docs/version-0.77/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.82/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.83/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.71/running-on-device.md
- cnwebsite/versioned_docs/version-0.80/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.84/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.84/running-on-device.md
- cnwebsite/versioned_docs/version-0.78/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.80/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.78/colors.md
- cnwebsite/versioned_docs/version-0.75/colors.md
- cnwebsite/versioned_docs/version-0.71/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.82/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.79/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.81/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.81/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.76/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.81/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.76/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.78/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.78/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.72/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.76/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.82/running-on-device.md
- cnwebsite/versioned_docs/version-0.83/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.83/running-on-device.md
- cnwebsite/versioned_docs/version-0.78/running-on-device.md
- cnwebsite/versioned_docs/version-0.83/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.77/running-on-device.md
- cnwebsite/versioned_docs/version-0.73/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.74/running-on-device.md
- cnwebsite/versioned_docs/version-0.76/running-on-device.md
- cnwebsite/versioned_docs/version-0.78/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.73/colors.md
- cnwebsite/versioned_docs/version-0.84/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.82/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.73/running-on-device.md
- cnwebsite/versioned_docs/version-0.81/running-on-device.md
- cnwebsite/versioned_docs/version-0.77/colors.md
- cnwebsite/versioned_docs/version-0.76/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.77/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.71/colors.md
- cnwebsite/versioned_docs/version-0.85/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.81/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.72/colors.md
- cnwebsite/versioned_docs/version-0.79/running-on-device.md
- cnwebsite/versioned_docs/version-0.79/the-new-architecture/using-codegen.md
- cnwebsite/versioned_docs/version-0.74/colors.md
- cnwebsite/versioned_docs/version-0.79/colors.md
- cnwebsite/versioned_docs/version-0.85/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.70/colors.md
- cnwebsite/versioned_docs/version-0.80/colors.md
- cnwebsite/versioned_docs/version-0.83/colors.md
- cnwebsite/versioned_docs/version-0.75/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.80/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.79/the-new-architecture/what-is-codegen.md
- cnwebsite/versioned_docs/version-0.74/new-architecture-library-intro.md
- cnwebsite/versioned_docs/version-0.72/running-on-device.md
- cnwebsite/versioned_docs/version-0.79/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.76/colors.md
- cnwebsite/versioned_docs/version-0.75/running-on-device.md
- cnwebsite/versioned_docs/version-0.80/running-on-device.md
- cnwebsite/versioned_docs/version-0.77/the-new-architecture/create-module-library.md
- cnwebsite/versioned_docs/version-0.84/new-architecture-library-intro.md
| ::: | ||
|
|
||
| ## ImageView 示例 {#imageview-example} | ||
| ## ImageView 示例 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify the auto-generated anchor format for Chinese headings in Docusaurus
# Check Docusaurus configuration for slug generation settings
cat cnwebsite/docusaurus.config.js | grep -A 5 "slug"
# Search for similar Chinese heading anchor references in the codebase to understand the pattern
rg -n "#[a-z-]+示例" --glob "*.md" --glob "*.mdx" -C 2Repository: reactnativecn/react-native-website
Length of output: 141
🏁 Script executed:
# First, confirm the file exists and read the relevant lines
head -20 cndocs/legacy/native-components-android.md | tail -5
# Also read around line 866
sed -n '860,870p' cndocs/legacy/native-components-android.md
# Find Docusaurus config file
find . -name "docusaurus.config.js" -type f 2>/dev/nullRepository: reactnativecn/react-native-website
Length of output: 301
🏁 Script executed:
# Search for Docusaurus configuration more broadly
find . -type f -name "*.config.js" 2>/dev/null | head -20
# Also check the directory structure
ls -la | grep -E "^d"
# Look for other markdown headings in the same file to understand the auto-generation pattern
rg "^## " cndocs/legacy/native-components-android.md -n | head -20
# Search for similar link patterns with Chinese anchors in other markdown files
rg "\]\(#[^)]*[^\x00-\x7F]" cndocs/ --glob "*.md" -c | head -20Repository: reactnativecn/react-native-website
Length of output: 1121
🏁 Script executed:
# Check cnwebsite directory structure
ls -la cnwebsite/ | head -20
# Look for docusaurus config
find cnwebsite/ -name "*.config.js" -o -name "*.config.json" -o -name "docusaurus.config.ts" 2>/dev/null
# Search for actual anchor link patterns in cndocs to understand the convention
rg "\[.*\]\(#" cndocs/ -A 1 -B 1 --glob "*.md" | head -40
# Check if there are any build artifacts or references that show auto-generated anchors
rg "imageview" cndocs/ --glob "*.md" -iRepository: reactnativecn/react-native-website
Length of output: 6040
🏁 Script executed:
# Check the Docusaurus configuration for slug generation rules
grep -A 10 -B 10 "slug\|markdownLinkExtensions\|remark" cnwebsite/docusaurus.config.ts | head -50
# Also check .remarkrc.mjs for markdown processing rules
cat cnwebsite/.remarkrc.mjs
# Look for how similar Chinese headings are referenced in other files
rg "\]\(#" cndocs/ --glob "*.md" | grep -v "virtualview" | head -20Repository: reactnativecn/react-native-website
Length of output: 4274
🏁 Script executed:
# Search for other mixed English-Chinese headings in cndocs
rg "^##[^#]*([\u4e00-\u9fff])" cndocs/ --glob "*.md" -o | head -20
# Check if there are examples in the same file with similar patterns
grep "^##" cndocs/legacy/native-components-android.md | head -10
# Verify the exact line 866 content one more time
sed -n '866p' cndocs/legacy/native-components-android.mdRepository: reactnativecn/react-native-website
Length of output: 1047
Update the broken anchor link at line 866.
Line 866 references #imageview-example, but the custom anchor ID {#imageview-example} was removed from the heading at line 19 to fix MDX v3 compilation. Docusaurus now auto-generates the anchor from the heading text "ImageView 示例" as #imageview-示例.
Update line 866 to fix the broken internal link:
📝 Suggested fix
-如果您想使用公开属性设置器 `@ReactProp` (or `@ReactPropGroup`) 详见上面的 [ImageView 示例](`#imageview-example`)。
+如果您想使用公开属性设置器 `@ReactProp` (or `@ReactPropGroup`) 详见上面的 [ImageView 示例](`#imageview-示例`)。🤖 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 `@cndocs/legacy/native-components-android.md` at line 19, The internal link at
line 866 points to the removed custom anchor `#imageview-example`; update that
link to the auto-generated Docusaurus anchor for the heading "ImageView 示例" by
replacing `#imageview-example` with `#imageview-示例` (or update to use the exact
heading text anchor format generated from the "ImageView 示例" heading) so the
link matches the auto-generated anchor for the heading.
| 'the-new-architecture/using-codegen', | ||
| 'the-new-architecture/codegen-cli', | ||
| ], | ||
| Codegen: ['the-new-architecture/codegen-cli'], |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if the allegedly removed doc files still exist
echo "=== Checking for removed documentation files ==="
# Check for the files that should have been removed
fd -t f "metro\.md" cndocs cnwebsite/versioned_docs
fd -t f "what-is-codegen\.md" cndocs cnwebsite/versioned_docs
fd -t f "using-codegen\.md" cndocs cnwebsite/versioned_docs
fd -t f "create-module-library\.md" cndocs cnwebsite/versioned_docs
echo ""
echo "=== Checking for references to removed docs ==="
# Search for any remaining references to these docs
rg -n "metro\.md|metro['\"]" cnwebsite/sidebars.ts cnwebsite/docusaurus.config.ts -C2
rg -n "what-is-codegen|using-codegen|create-module-library" cnwebsite/sidebars.ts -C2
echo ""
echo "=== Checking markdown links to removed docs ==="
# Check for markdown links to these removed docs
rg -n "\[.*\]\(.*(?:metro|what-is-codegen|using-codegen|create-module-library).*\)" cndocs -g "*.md" -g "*.mdx"Repository: reactnativecn/react-native-website
Length of output: 7870
Fix broken links to removed documentation pages.
The files what-is-codegen.md, using-codegen.md, and create-module-library.md were correctly removed from the sidebar, but multiple documentation files still contain broken links to these deleted pages:
cndocs/turbo-native-modules.md:37→/the-new-architecture/what-is-codegen.mdcndocs/turbo-native-modules-android.md:209→the-new-architecture/create-module-library.mdcndocs/the-new-architecture/pure-cxx-modules.md:75→what-is-codegen.mdcndocs/the-new-architecture/advanced-topics-components.md:3→what-is-codegencndocs/the-new-architecture/advanced-topics-modules.md:3→what-is-codegencndocs/new-architecture-turbo-module.md(3 references) →using-codegencndocs/fabric-native-components.md:53→what-is-codegen
These links must be updated to point to the correct location or removed if the referenced content no longer exists.
🤖 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/sidebars.ts` at line 86, The sidebar entry Codegen:
['the-new-architecture/codegen-cli'] was added but many docs still reference
removed pages (what-is-codegen.md, using-codegen.md, create-module-library.md);
open the affected files (cndocs/turbo-native-modules.md,
cndocs/turbo-native-modules-android.md,
cndocs/the-new-architecture/pure-cxx-modules.md,
cndocs/the-new-architecture/advanced-topics-components.md,
cndocs/the-new-architecture/advanced-topics-modules.md,
cndocs/new-architecture-turbo-module.md, cndocs/fabric-native-components.md) and
either update links to point to the new /the-new-architecture/codegen-cli
location or remove/replace the links with appropriate existing docs, ensuring
any references to what-is-codegen, using-codegen, or create-module-library are
replaced consistently with the new codegen-cli page or deleted if the content no
longer exists.
| import type {ViewProps} from 'ViewPropTypes'; | ||
| import type {HostComponent} from 'react-native'; |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
For React Native 0.70 TypeScript docs/examples, what is the correct import path for ViewPropsin Fabric component specs:react-nativeorViewPropTypes?
💡 Result:
The correct import path for ViewProps in React Native 0.70 TypeScript Fabric component specs is import type { ViewProps } from 'react-native'; [1][2][3][4]. ViewPropTypes refers to the deprecated runtime PropTypes (e.g., ViewPropTypes object for prop validation), not the TypeScript type ViewProps. ViewPropTypes was deprecated around 0.66-0.71 and migrated to deprecated-react-native-prop-types for JS/PropTypes usage, but is irrelevant for TypeScript Fabric specs which use ViewProps from react-native [5][6][7][8]. Official and example code consistently shows: import type { ViewProps } from 'react-native'; export interface NativeProps extends ViewProps { ... } This pattern holds from 0.70 (Fabric enabled) through later versions [1][2][4][9]. No sources indicate ViewPropTypes as a module for TypeScript imports in this context [10].
Citations:
- 1: https://reactnative.dev/docs/0.77/fabric-native-components-introduction
- 2: https://medium.com/@someSOAP/react-native-fabric-component-using-swiftui-40d692c1baaa
- 3: https://medium.com/%40someSOAP/react-native-fabric-component-using-jetpack-compose-97328f725fb0
- 4: https://github.com/reactwg/react-native-new-architecture/blob/main/docs/fabric-native-components.md
- 5: https://reactnative.dev/blog/2023/01/12/version-071
- 6: https://stackoverflow.com/questions/71702392/viewproptypes-will-be-removed-from-react-native-migrate-to-viewproptypes-export
- 7: ViewPropTypes will be removed from React Native facebook/react-native#47459
- 8: Invariant Violation: ViewPropTypes has been removed from React Native. facebook/react-native#41483
- 9: https://www.react-native.cn/docs/0.70/the-new-architecture/backward-compatibility-fabric-components
- 10: https://github.com/facebook/react-native/blob/972a30db/packages/react-native/Libraries/Components/View/ViewPropTypes.d.ts
Fix TypeScript import path for ViewProps to be resolvable in consumer projects.
Line 105 imports ViewProps from an invalid module path. In React Native 0.70, ViewProps must be imported from react-native, not ViewPropTypes (which is the deprecated runtime PropTypes object).
Suggested fix
-import type {ViewProps} from 'ViewPropTypes';
+import type {ViewProps} from 'react-native';
import type {HostComponent} from 'react-native';📝 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.
| import type {ViewProps} from 'ViewPropTypes'; | |
| import type {HostComponent} from 'react-native'; | |
| import type {ViewProps} from 'react-native'; | |
| import type {HostComponent} from 'react-native'; |
🤖 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/versioned_docs/version-0.70/new-architecture-library-intro.md`
around lines 105 - 106, The import for the TypeScript type ViewProps is using
the wrong module; update the import so that ViewProps is imported from
'react-native' (not 'ViewPropTypes') — replace the existing import line that
reads import type {ViewProps} from 'ViewPropTypes' with an import from
'react-native' alongside HostComponent (ensure the symbol ViewProps is
referenced from 'react-native' so TypeScript resolution works for consumers).
变更内容
编译修复
getting-started 调整
验证
Summary by CodeRabbit
Release Notes
Documentation
Configuration