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

CHORE: Remove deprecated lifecycle methods #1

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Row.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ export default class Row extends Component {
},
});

componentWillReceiveProps(nextProps) {
if (!this._active && !shallowEqual(this._location, nextProps.location)) {
const animated = !this._active && nextProps.animated;
this._relocate(nextProps.location, animated);
componentDidUpdate() {
const {animated, location} = this.props;

if (!this._active && !shallowEqual(this._location, location)) {
this._relocate(location, !this._active && animated);
}
}

Expand Down
19 changes: 7 additions & 12 deletions src/SortableList.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class SortableList extends Component {
manuallyActivateRows: PropTypes.bool,
keyboardShouldPersistTaps: PropTypes.oneOf(['never', 'always', 'handled']),
scrollEventThrottle: PropTypes.number,
decelerationRate: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
decelerationRate: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
pagingEnabled: PropTypes.bool,
nestedScrollEnabled: PropTypes.bool,
disableIntervalMomentum: PropTypes.bool,
Expand Down Expand Up @@ -88,7 +88,7 @@ export default class SortableList extends Component {
scrollEnabled: this.props.scrollEnabled
};

componentWillMount() {
componentDidMount() {
this.state.order.forEach((key) => {
this._rowsLayouts[key] = new Promise((resolve) => {
this._resolveRowLayout[key] = resolve;
Expand All @@ -100,20 +100,20 @@ export default class SortableList extends Component {
this._resolveHeaderLayout = resolve;
});
}

if (this.props.renderFooter && !this.props.horizontal) {
this._footerLayout = new Promise((resolve) => {
this._resolveFooterLayout = resolve;
});
}
}

componentDidMount() {
this._onUpdateLayouts();
}

componentWillReceiveProps(nextProps) {
const {data, order} = this.state;
let {data: nextData, order: nextOrder} = nextProps;
componentDidUpdate(prevProps, prevState) {
const {data, order, scrollEnabled} = this.state;
let {data: nextData, order: nextOrder} = this.props;
const {data: prevData} = prevState;

if (data && nextData && !shallowEqual(data, nextData)) {
nextOrder = nextOrder || Object.keys(nextData)
Expand Down Expand Up @@ -143,11 +143,6 @@ export default class SortableList extends Component {
} else if (order && nextOrder && !shallowEqual(order, nextOrder)) {
this.setState({order: nextOrder});
}
}

componentDidUpdate(prevProps, prevState) {
const {data, scrollEnabled} = this.state;
const {data: prevData} = prevState;

if (data && prevData && !shallowEqual(data, prevData)) {
this._onUpdateLayouts();
Expand Down