Skip to content

Commit 8b6e244

Browse files
committed
Merge pull request react-bootstrap#1145 from taion/fix-deprecated-tabbed-area
Fix mapping TabPane title
2 parents 57cde60 + 5aefb8b commit 8b6e244

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

docs/src/ComponentsPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ const ComponentsPage = React.createClass({
513513

514514
{/* Tabbed Areas */}
515515
<div className='bs-docs-section'>
516-
<h1 className='page-header'><Anchor id='tabs'>Togglable tabs</Anchor> <small>TabbedArea, TabPane</small></h1>
516+
<h1 className='page-header'><Anchor id='tabs'>Togglable tabs</Anchor> <small>Tabs, Tab</small></h1>
517517

518518
<p>Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus.</p>
519519

src/TabPane.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ import deprecationWarning from './utils/deprecationWarning';
33
import Tab from './Tab';
44

55
const TabPane = React.createClass({
6-
componentDidMount() {
7-
deprecationWarning('TabPane', 'Tab', 'https://github.com/react-bootstrap/react-bootstrap/pull/1091');
6+
componentWillMount() {
7+
deprecationWarning(
8+
'TabPane', 'Tab',
9+
'https://github.com/react-bootstrap/react-bootstrap/pull/1091'
10+
);
811
},
12+
913
render() {
1014
return (
1115
<Tab {...this.props} />

src/TabbedArea.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ import ValidComponentChildren from './utils/ValidComponentChildren';
55
import deprecationWarning from './utils/deprecationWarning';
66

77
const TabbedArea = React.createClass({
8-
componentDidMount() {
9-
deprecationWarning('TabbedArea', 'Tabs', 'https://github.com/react-bootstrap/react-bootstrap/pull/1091');
8+
componentWillMount() {
9+
deprecationWarning(
10+
'TabbedArea', 'Tabs',
11+
'https://github.com/react-bootstrap/react-bootstrap/pull/1091'
12+
);
1013
},
14+
1115
render() {
12-
let {children, ...props} = this.props;
13-
let tabTitles = [];
16+
const {children, ...props} = this.props;
1417

15-
tabTitles = ValidComponentChildren.map(function(child) {
16-
let {tab, ...others} = child.props;
17-
tabTitles.push(<TabPane title={tab} {...others}/>);
18+
const tabs = ValidComponentChildren.map(children, function (child) {
19+
const {tab: title, ...others} = child.props;
20+
return <TabPane title={title} {...others} />;
1821
});
1922

2023
return (
21-
<Tabs {...props} >{tabTitles}</Tabs>
24+
<Tabs {...props}>{tabs}</Tabs>
2225
);
2326
}
2427
});

0 commit comments

Comments
 (0)