Skip to content

Commit

Permalink
Revert back to 2.15.0 because of rendering bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luehang committed Jan 9, 2020
1 parent 40345b7 commit 26d9f10
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
37 changes: 22 additions & 15 deletions src/MasonryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,12 @@ export default class MasonryList extends React.PureComponent {
}
},
(resolvedImages) => {
resolvedImages.map((resolvedData, i) => {
resolvedData.index = i;
resolvedImages.map((resolvedData, index) => {
const resolvedImage = getItemSource(resolvedData, itemSource);
if (this.renderIndex !== 0) {
index = this.renderIndex;
}
resolvedData.index = index;

resolvedImage.masonryDimensions =
this._getCalculatedDimensions(
Expand Down Expand Up @@ -336,14 +339,14 @@ export default class MasonryList extends React.PureComponent {
this.setState({
_sortedData: sortedData
});
}

this.doneTotal++;
if (
this.props.onImagesResolveEnd &&
this.doneTotal === this.props.images.length
) {
this.props.onImagesResolveEnd(this.state._sortedData, this.doneTotal);
}
this.doneTotal++;
if (
this.props.onImagesResolveEnd &&
this.doneTotal === this.props.images.length
) {
this.props.onImagesResolveEnd(this.state._sortedData, this.doneTotal);
}
});
});
Expand All @@ -364,10 +367,11 @@ export default class MasonryList extends React.PureComponent {
}
},
(resolvedData) => {
resolvedData.index = this.unsortedIndex;
this.unsortedIndex++;
const resolvedImage = getItemSource(resolvedData, itemSource);

resolvedImage.index = this.unsortedIndex;
this.unsortedIndex++;

resolvedImage.masonryDimensions =
this._getCalculatedDimensions(
resolvedImage.dimensions,
Expand Down Expand Up @@ -469,8 +473,11 @@ export default class MasonryList extends React.PureComponent {
}
},
(resolvedImages) => {
resolvedImages.map((resolvedImage, i) => {
resolvedImage.index = i;
resolvedImages.map((resolvedImage, index) => {
if (this.renderIndex !== 0) {
index = this.renderIndex;
}
resolvedImage.index = index;

resolvedImage.masonryDimensions =
this._getCalculatedDimensions(
Expand Down Expand Up @@ -508,7 +515,7 @@ export default class MasonryList extends React.PureComponent {
this.props.onImagesResolveEnd &&
this.doneTotal === this.props.images.length
) {
this.props.onImagesResolveEnd(this.state._sortedData);
this.props.onImagesResolveEnd(this.state._sortedData, this.doneTotal);
}
});
});
Expand Down Expand Up @@ -568,7 +575,7 @@ export default class MasonryList extends React.PureComponent {
this.props.onImagesResolveEnd &&
this.doneTotal === this.props.images.length
) {
this.props.onImagesResolveEnd(this.state._sortedData);
this.props.onImagesResolveEnd(this.state._sortedData, this.doneTotal);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Masonry extends React.PureComponent {
]),

onImageResolved: PropTypes.func,
onImagesResolveEnd: PropTypes.func,
onImagesResolveEnd: PropTypes.func,

onPressImage: PropTypes.func,
onLongPressImage: PropTypes.func,
Expand Down

0 comments on commit 26d9f10

Please sign in to comment.