bug: IonTabs throws when a Fragment contains one IonRouterOutlet

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

还没有人认领这个 Issue。

评估

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

调研方向

从 IonTabs 的实现开始,使用 npm install 和 npm run dev 通过链接的应用复现该故障。将 IonRouterOutlet 作为传递给 IonTabs 的 React Fragment 中唯一的子元素进行渲染,并确认不会出现 TypeError,以验证修复有效。

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

描述

triage
Prerequisites
  • I have read the contributing guidelines.
  • I agree to follow the Code of Conduct.
  • I searched existing issues without finding this problem.
Ionic Framework Version

v8.x, v9.x, Nightly

Current Behavior

When IonRouterOutlet is the only child of a React Fragment passed to IonTabs, rendering throws:

TypeError: Cannot read properties of undefined (reading 'type')

IonTabs treats the Fragment's children as an array, but React stores a single child as an element.

Expected Behavior

IonTabs should render when IonRouterOutlet is wrapped in a single-child Fragment.

Steps to Reproduce
  1. Clone the reproduction.
  2. Run npm install and npm run dev.
  3. Open the app.
Code Reproduction URL

https://github.com/Benziza/ion-tabs-fragment-repro

Ionic Info
Ionic CLI       : 7.2.1
Ionic Framework : @ionic/react 9.0.1
NodeJS          : v25.6.0
npm             : 11.12.1
OS              : Windows 10
Additional Information

Removing the Fragment allows the same app to render.

主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
2 天 20 小时
30 天内合并 PR
35

贡献指南

打开贡献指南

从这里开始

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

ionic-team/ionic-framework 的其他 Issue

查看 ionic-team/ionic-framework 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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