ionic-team / ionic-team/ionic-framework

bug: react, IonTabBar does not allow for wrapped IonTabButton components

未关闭
#23,088 12 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看
package: react type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 14 小时
30 天内合并 PR
50

描述

# Bug Report: Importing outer IonTabButton into IonTabBar does not render in React.

**Ionic version:**
[x] **5.x** (React)

**Current behavior:**
I am following the docs on creating the tabbar with tab buttons which works perfectly:

```ts
const Tabs = () => {
return (








Settings



Login / Register




)
}

```
Renders like it is supposed to:

![Screenshot 2021-03-22 at 22 20 35](https://user-images.githubusercontent.com/15842767/112060170-1ece7b80-8b5d-11eb-8330-f11a0d5eefc1.png)

I particularly like breaking down components a bit more, so let's start with just one file:

```ts
// SettingsTab.tsx
import { IonIcon, IonLabel, IonTabButton } from "@ionic/react"
import { cog } from "ionicons/icons"

export const SettingsTab = () => (


Settings

)
```

And import it and use it on my Tabs.tsx:

```ts
const Tabs = () => {
return (









Login / Register




)
}
```

**Expected behaviour:**

Now I would expect the behaviour to be the same as the previous one when I declared all buttons directly inside the Tabs, but this is what I am getting instead:
![Screenshot 2021-03-22 at 22 25 15](https://user-images.githubusercontent.com/15842767/112060534-98666980-8b5d-11eb-81bd-d4b8063138ae.png)

**Steps to reproduce:**
- Install the latest Ionic React
- Start a Tabs application
- Create a new component that exports a single tab button, for example:
```ts
export const SettingsTab = () => (


Settings

)
```
- import that component into the tabs and place it within ``

Thanks

贡献指南

打开贡献指南

调研方向

首先,在使用报告中所示 SettingsTab 组件的 Ionic React 标签页应用中重现该问题。检查 IonTabBar 如何处理子组件,然后验证经过包装的 IonTabButton 是否能够像内联 IonTabButton 一样进行渲染并表现相同。

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

评估

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

把新 issue 发到你的邮箱

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