Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 6267cb2

Browse files
refactor(List): remove transition group
When upgrading to react-transition-group v2.5 the transitions in List & ListItem were broken. While working on fixing them we decided to just remove the transitions instead. This library is depracated, we're not aware of any usages of this component and we don't really like the transition here anyway.
1 parent b939d30 commit 6267cb2

File tree

3 files changed

+6
-62
lines changed

3 files changed

+6
-62
lines changed

docs/src/List/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,7 @@ class ListExample extends React.Component {
115115
<ComponentExample>
116116
<div className="row row-flex">
117117
<div className="column-9">
118-
<List
119-
transition={true}
120-
content={this.getComplexNestedList()}
121-
tag="ol"
122-
/>
118+
<List content={this.getComplexNestedList()} tag="ol" />
123119
</div>
124120
<div className="column-3">
125121
<button

src/List/List.js

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
import React from "react";
22
import PropTypes from "prop-types";
3-
import { CSSTransition } from "react-transition-group";
43

54
import ListItem from "./ListItem";
65
import Util from "../Util/Util";
76

87
class List extends React.Component {
98
getListItems(list, childIndex = 0) {
10-
const { props } = this;
119
const items = list.map((item, parentIndex) => {
1210
const key = `${parentIndex}.${childIndex}`;
1311
childIndex++;
1412

15-
const htmlAttributes = Util.exclude(item, [
16-
"content",
17-
"transitionName",
18-
"transitionEnterTimeout",
19-
"transitionExitTimeout"
20-
]);
13+
const htmlAttributes = Util.exclude(item, ["content"]);
2114

2215
if (Util.isArrayLike(item.content)) {
2316
return (
24-
<ListItem
25-
{...htmlAttributes}
26-
key={key}
27-
tag={item.tag}
28-
transition={true}
29-
timeout={{
30-
enter: props.transitionEnterTimeout,
31-
exit: props.transitionExitTimeout
32-
}}
33-
classNames={props.transitionName}
34-
>
17+
<ListItem key={key} tag={item.tag} {...htmlAttributes}>
3518
{this.getListItems(item.content, childIndex)}
3619
</ListItem>
3720
);
@@ -54,22 +37,6 @@ class List extends React.Component {
5437
// Uses all passed properties as attributes, excluding propTypes
5538
const htmlAttributes = Util.exclude(props, Object.keys(List.propTypes));
5639

57-
if (props.transition) {
58-
return (
59-
<CSSTransition
60-
in={true}
61-
className={props.className}
62-
classNames={props.transitionName}
63-
timeout={{
64-
exit: props.transitionExitTimeout,
65-
enter: props.transitionEnterTimeout
66-
}}
67-
>
68-
<Tag>{this.getListItems(props.content)}</Tag>
69-
</CSSTransition>
70-
);
71-
}
72-
7340
return (
7441
<Tag {...htmlAttributes} className={props.className}>
7542
{this.getListItems(props.content)}
@@ -80,11 +47,7 @@ class List extends React.Component {
8047

8148
List.defaultProps = {
8249
className: "list",
83-
tag: "ul",
84-
transition: true,
85-
transitionName: "list-item",
86-
transitionEnterTimeout: 500,
87-
transitionExitTimeout: 500
50+
tag: "ul"
8851
};
8952

9053
List.propTypes = {
@@ -107,12 +70,7 @@ List.propTypes = {
10770
PropTypes.string
10871
]).isRequired,
10972
// Optional tag for the container of the list
110-
tag: PropTypes.string,
111-
transition: PropTypes.bool,
112-
transitionName: PropTypes.string,
113-
// Transition lengths
114-
transitionEnterTimeout: PropTypes.number,
115-
transitionExitTimeout: PropTypes.number
73+
tag: PropTypes.string
11674
};
11775

11876
module.exports = List;

src/List/ListItem.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from "react";
22
import PropTypes from "prop-types";
3-
import { CSSTransition } from "react-transition-group";
43

54
import Util from "../Util/Util";
65

@@ -12,14 +11,6 @@ class ListItem extends React.Component {
1211
// Uses all passed properties as attributes, excluding propTypes
1312
const htmlAttributes = Util.exclude(props, Object.keys(ListItem.propTypes));
1413

15-
if (props.transition) {
16-
return (
17-
<CSSTransition {...htmlAttributes} className={props.className}>
18-
<Tag>{props.children}</Tag>
19-
</CSSTransition>
20-
);
21-
}
22-
2314
return (
2415
<Tag {...htmlAttributes} className={props.className}>
2516
{props.children}
@@ -36,8 +27,7 @@ ListItem.defaultProps = {
3627
ListItem.propTypes = {
3728
children: PropTypes.node,
3829
className: PropTypes.string,
39-
tag: PropTypes.string,
40-
transition: PropTypes.bool
30+
tag: PropTypes.string
4131
};
4232

4333
module.exports = ListItem;

0 commit comments

Comments
 (0)