[Android] react-android's prefab has no react/renderer/components/scrollview headers, so a library cannot include ScrollView's component descriptor

未關閉 適合新手
#59,929 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
android

研究方向

閱讀 packages/react-native/ReactAndroid/build.gradle.kts,特別查看第 219–227 行附近 preparePrefab 的元件資料夾清單,並與匯出的元件標頭檔比較。Issue 回報缺少 rrc_scrollview,但 libreactnative.so 中有 ScrollView 符號。新增缺少的 scrollview 標頭檔匯出,並驗證 prefab 包含這些標頭檔,且重現案例的原生建置能解析 ScrollViewComponentDescriptor.h。

由索引模型根據 Issue 內容生成。

描述

Description

The reactnative prefab module in the react-android AAR carries the headers of react/renderer/components/view, image, root, text and textinput, but none of react/renderer/components/scrollview. libreactnative.so defines ScrollView's shadow node and state (ScrollViewShadowNode::layout, ScrollViewShadowNode::updateStateIfNeeded, ScrollViewState::getContentSize, ScrollViewComponentName), so a library or app that builds against the prebuilt AAR can link them but cannot include ScrollViewShadowNode.h, ScrollViewComponentDescriptor.h or ScrollViewState.h; for example, to register a component descriptor that extends ScrollView's.

preparePrefab in packages/react-native/ReactAndroid/build.gradle.kts lists a Pair for each exported component folder (// rrc_textinput and its platform/android/ folder among them) and has none for rrc_scrollview: https://github.com/react/react-native/blob/1273ca128fa378e231dd351a65fb7d63fe0b6526/packages/react-native/ReactAndroid/build.gradle.kts#L219-L227

Steps to reproduce
  1. git clone https://github.com/YevheniiKotyrlo/rn-prefab-scrollview-headers-repro && cd rn-prefab-scrollview-headers-repro
  2. ./reproduce.sh. It installs ReproducerApp (React Native 0.90.0-nightly-20261111-1273ca128) and runs ./gradlew :app:externalNativeBuildDebug -PreactNativeArchitectures=arm64-v8a. The app's src/main/jni/CMakeLists.txt is the default app setup plus one file, scrollview/ScrollViewDescriptorProvider.cpp:
#include <react/renderer/components/view/ViewComponentDescriptor.h>
#include <react/renderer/components/scrollview/ScrollViewComponentDescriptor.h>

namespace facebook::react {

ComponentDescriptorProvider scrollViewComponentDescriptorProvider() {
  return concreteComponentDescriptorProvider<ScrollViewComponentDescriptor>();
}

} // namespace facebook::react

Expected: the scrollview include resolves from the prefab, as the view include on the line before it does.

Seen: the build stops at the scrollview include, and the prefab's react/renderer/components holds no scrollview folder. The release AAR from the same nightly has none either, while its jni/arm64-v8a/libreactnative.so defines the ScrollView symbols above.

React Native Version

0.90.0-nightly-20261111-1273ca128

Affected Platforms

Runtime - Android, Build - Windows

Output of npx @react-native-community/cli info
System:
  OS: Windows 11 10.0.26300
  CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor          "
  Memory: 181.10 GB / 255.67 GB
Binaries:
  Node:
    version: 26.12.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Users\<user>\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 12.2.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.26100.0
IDEs:
  Android Studio: AI-262.9437.185.2621.16467767
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.20.1
    path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 21.0.0-alpha.1
    wanted: 21.0.0-alpha.1
  react:
    installed: 19.3.0
    wanted: 19.3.0
  react-native:
    installed: 0.90.0-nightly-20261111-1273ca128
    wanted: 0.90.0-nightly-20261111-1273ca128
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
MINGW64_NT-10.0-26300 x86_64, node v26.12.1, openjdk version "17.0.20.1" 2026-08-18 LTS
react-native 0.90.0-nightly-20261111-1273ca128
== ./gradlew :app:externalNativeBuildDebug -PreactNativeArchitectures=arm64-v8a
C/C++: ReproducerApp/android/app/src/main/jni/scrollview/ScrollViewDescriptorProvider.cpp:4:10: fatal error: 'react/renderer/components/scrollview/ScrollViewComponentDescriptor.h' file not found
BUILD FAILED in 35s
== react/renderer/components in react-android-0.90.0-nightly-20261111-1273ca128-SNAPSHOT-debug/prefab/modules/reactnative/include
androidtextinput
FBReactNativeSpec
image
root
text
textinput
view
SUMMARY: the react-android prefab has no react/renderer/components/scrollview headers
MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/rn-prefab-scrollview-headers-repro

Screenshots and Videos

No response

主要語言
C++
星號
127k
分支
25.5k
平均合併
3 天 18 小時
30 天內合併 PR
188

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

react/react-native 的其他 Issue

查看 react/react-native 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。