Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Android: generated ReactNativeHostManager loads React Native twice and crashes (Feature flags cannot be overridden more than once)

未关闭 适合新手
#492 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
android, kotlin, react-native
领域
mobile

调研方向

从 expo-config-plugin 模板文件夹中生成的模板 ReactNativeHostManager.vanilla.kt 开始,并将其与 ReactNativeBrownfield.kt 进行比较,后者的 initialize 会调用 loadNativeLibs(SoLoader.init 和 DefaultNewArchitectureEntryPoint.load)。通过生成一个项目并启动应用来复现问题。当模板不再调用 loadReactNative(application),并且应用在没有功能开关错误的情况下启动时,即完成。

由索引模型根据 Issue 内容生成。

描述

The ReactNativeHostManager that the scaffold generates for a React Native CLI project crashes on start:

Feature flags cannot be overridden more than once

It calls loadReactNative(application) and then ReactNativeBrownfield.initialize(...) (ReactNativeHostManager.vanilla.kt). initialize already runs loadNativeLibs, which calls SoLoader.init and DefaultNewArchitectureEntryPoint.load() (ReactNativeBrownfield.kt), so React Native's feature flags are set twice.

Repro: npm create @callstack/react-native-brownfield@latest, package the AAR, and start React Native from a native app with the generated ReactNativeHostManager.initialize.

Fix: remove the loadReactNative(application) call from the template; initialize loads the native libraries itself. Removing it in the generated file makes the app start.

Tested with: @callstack/create-react-native-brownfield 5.3.0, React Native 0.85.2.

主要语言
TypeScript
星标
552
派生
53
平均合并
4 天 13 小时
30 天内合并 PR
15

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstack/react-native-brownfield 的其他 Issue

查看 callstack/react-native-brownfield 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。