ionic-team / ionic-team/ionic-framework

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

Đang mở
#23,088 12 bình luận 5 reaction 0 người được giao Xem trên GitHub
package: react type: bug
Ngôn ngữ chính
TypeScript
Star
52.7k
Fork
13.3k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
51

Mô tả

# 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reproducing the issue in an Ionic React tabs application using the SettingsTab component shown in the report. Inspect how IonTabBar handles child components, then verify that a wrapped IonTabButton renders and behaves like an inline IonTabButton.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
react, typescript
Lĩnh vực
frontend, web-dev
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.