Skip to content

Commit

Permalink
Bugfix: Allow tab to un/mount with transition
Browse files Browse the repository at this point in the history
Also, fix documentation errors:
- Tab component docs stated that the transition prop of value 'true' would use the 'Fade' transition. Rather, the 'Fade' transition is applied by default. Otherwise, the transition prop accepts 'false' or a react-transition-group 'Transition' component.
- Replace references to v2 with v4

Refs react-bootstrap#3497
  • Loading branch information
fungjj92 committed Mar 12, 2020
1 parent 3f981a4 commit 231743a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/TabContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const propTypes = {
},

/**
* Sets a default animation strategy for all children `<TabPane>`s. Use
* `false` to disable, `true` to enable the default `<Fade>` animation or
* a react-transition-group v2 `<Transition/>` component.
* Sets a default animation strategy for all children `<TabPane>`s.
* Defaults to `<Fade>` animation; else, use `false` to disable, or a
* custom react-transition-group `<Transition/>` component.
*
* @type {{Transition | false}}
* @default {Fade}
Expand Down
8 changes: 4 additions & 4 deletions src/TabPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const propTypes = {
active: PropTypes.bool,

/**
* Use animation when showing or hiding `<TabPane>`s. Use `false` to disable,
* `true` to enable the default `<Fade>` animation or
* a react-transition-group v2 `<Transition/>` component.
* Use animation when showing or hiding `<TabPane>`s. Defaults to `<Fade>`
* animation, else use `false` to disable or a react-transition-group
* `<Transition/>` component.
*/
transition: PropTypes.oneOfType([PropTypes.bool, PropTypes.elementType]),

Expand Down Expand Up @@ -136,7 +136,7 @@ const TabPane = React.forwardRef((props, ref) => {

const prefix = useBootstrapPrefix(bsPrefix, 'tab-pane');

if (!active && unmountOnExit) return null;
if (!active && !Transition && unmountOnExit) return null;

let pane = (
<Component
Expand Down
6 changes: 3 additions & 3 deletions src/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const propTypes = {
variant: PropTypes.string,

/**
* Sets a default animation strategy for all children `<TabPane>`s. Use
* `false` to disable, `true` to enable the default `<Fade>` animation or
* a react-transition-group v2 `<Transition/>` component.
* Sets a default animation strategy for all children `<TabPane>`s.
* Defaults to `<Fade>` animation, else use `false` to disable or a
* react-transition-group `<Transition/>` component.
*
* @type {Transition | false}
* @default {Fade}
Expand Down

0 comments on commit 231743a

Please sign in to comment.