Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamically measured images example #1081

Merged
merged 1 commit into from May 11, 2018

Conversation

kirill-konshin
Copy link
Contributor

Fixes #979

This pull request adds a small demo with masonry and images of unknown size which are measured in runtime.

@bvaughn
Copy link
Owner

bvaughn commented Apr 21, 2018

Hm, the live demo looks busted to me :(

screen shot 2018-04-21 at 12 01 47 pm

Do you see similar broken/overlapping images and text?

@kirill-konshin
Copy link
Contributor Author

Fixed it in the demo, CellMeasurer and CellPositioned somehow sneaked inside the MasonryComponent and were recreated on every render.

docs/Masonry.md Outdated

const MasonryComponent = ({ itemsWithSizes }) => {
// Default sizes help Masonry decide how many images to batch-measure
const cache = new CellMeasurerCache({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be created within the MasonryComponent component because that would mean it gets recreated each time.

docs/Masonry.md Outdated
});

// Our masonry layout will use 3 columns with a 10px gutter between
const cellPositioner = createMasonryCellPositioner({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be created within the MasonryComponent component because that would mean it gets recreated each time.

@kirill-konshin
Copy link
Contributor Author

Fixed in docs too.

@wuweiweiwu
Copy link
Collaborator

Ill take a look later when I have time. But so far it looks good!

@kirill-konshin
Copy link
Contributor Author

@wuweiweiwu awesome! Glad to hear that.

@wuweiweiwu
Copy link
Collaborator

Awesome, the demo seems to have been fixed! Thanks for contributing!

@wuweiweiwu wuweiweiwu merged commit ccc2a52 into bvaughn:master May 11, 2018
@kirill-konshin
Copy link
Contributor Author

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants