wadackel / react-stack-grid

Pinterest like layout components for React.js
https://wadackel.github.io/react-stack-grid/
MIT License
870 stars 77 forks source link

Grid item height change delay? #58

Closed samblackk closed 6 years ago

samblackk commented 6 years ago

Hello! I'm curious on how I can prevent this from happening: screen recording 2018-11-16 at 01 42 pm

The layout will update it's height (and not overlap) on the second "tag" submission but not on the first one that causes the overlap. It also doesn't re-update when removing tags and the grid item returns to it's original size.

handleChange = (tags) => {
  this.setState(tags);
  return this.grid.updateLayout();
}

 <StackGrid
  columnWidth={'33%'}
  gutterWidth={10}
  gutterHeight={10}
  gridRef={(grid) => this.grid = grid}
>
  {widgets.map((widget) =>
      <TagInput
          key={widget.id}
          id={widget.id}
          name={widget.name}
          description={widget.description}
          value={this.state[widget.id] || []}
          options={{placeholder: widget.placeholder}}
          handleChange={this.handleChange}
      />
  )}
</StackGrid>
samblackk commented 6 years ago

Nevermind, it was an issue with my state. ✌️

ntatko commented 5 years ago

@singram26 Would you mind showing what changed in your state? I'm having the same problem, and I'd love to see what changed in your state.