Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs 组件在 tabPosition 为 left 或 right 的时候,renderTabBar 会使样式失效 #13086

Closed
1 task done
Madridspark opened this issue Nov 12, 2018 · 2 comments
Closed
1 task done
Assignees

Comments

@Madridspark
Copy link

Madridspark commented Nov 12, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.10.3

Environment

Windows 10

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 设置 Tabs 组件的 tabPosition 属性为 left
  2. 为 Tabs 组件的 renderTabBar 返回 一个有 wapper 的 DefaultTabBar

What is expected?

使 TabBar 重写后其原生的样式不变

What is actually happening?

TabBar 重写后变成了水平排列


查看了 antd 样式后发现,antd 中对于 vertical 方向的 TabBar 的样式定义是这样的:

.ant-tabs-vertical.ant-tabs-left>.ant-tabs-bar {
    float: left;
    border-right: 1px solid #e8e8e8;
    margin-right: -1px;
    margin-bottom: 0;
}

这样,一旦 DefaultTabBar 的外面包裹了一层 div ,就会使该样式失效

@xiongchen2012
Copy link

不用div包,使用<React.Fragment>DefaultTabBar </React.Fragment>来包呢?

@zombieJ zombieJ assigned zombieJ and unassigned yesmeck Nov 13, 2018
zombieJ added a commit to react-component/tabs that referenced this issue Nov 13, 2018
@Madridspark
Copy link
Author

这样的话使用场景就受限了,Fragment 不能渲染为任何 DOM 元素,也就不能加样式了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants