|
2 | 2 | var React = require('react/addons');
|
3 | 3 | var GridItem = require('./GridItem.jsx');
|
4 | 4 | var utils = require('./utils');
|
| 5 | +var PureDeepRenderMixin = require('./PureDeepRenderMixin'); |
| 6 | + |
5 | 7 |
|
6 | 8 | var ReactGridLayout = module.exports = React.createClass({
|
7 | 9 | displayName: 'ReactGridLayout',
|
8 |
| - // mixins: [React.addons.PureRenderMixin], |
| 10 | + mixins: [PureDeepRenderMixin], |
9 | 11 |
|
10 | 12 | propTypes: {
|
11 | 13 | // If true, the container height swells and contracts to fit contents
|
@@ -235,9 +237,15 @@ var ReactGridLayout = module.exports = React.createClass({
|
235 | 237 | placeholder() {
|
236 | 238 | if (!this.state.activeDrag) return '';
|
237 | 239 |
|
| 240 | + // {...this.state.activeDrag} is pretty slow, actually |
238 | 241 | return (
|
239 | 242 | <GridItem
|
240 |
| - {...this.state.activeDrag} |
| 243 | + w={this.state.activeDrag.w} |
| 244 | + h={this.state.activeDrag.h} |
| 245 | + x={this.state.activeDrag.x} |
| 246 | + y={this.state.activeDrag.y} |
| 247 | + i={this.state.activeDrag.i} |
| 248 | + placeholder={true} |
241 | 249 | className="react-grid-placeholder"
|
242 | 250 | containerWidth={this.state.width}
|
243 | 251 | cols={this.state.cols}
|
@@ -266,7 +274,11 @@ var ReactGridLayout = module.exports = React.createClass({
|
266 | 274 | var moveOnStartChange = drag && drag.i === i ? false : true;
|
267 | 275 | return (
|
268 | 276 | <GridItem
|
269 |
| - {...l} |
| 277 | + w={l.w} |
| 278 | + h={l.h} |
| 279 | + x={l.x} |
| 280 | + y={l.y} |
| 281 | + i={l.i} |
270 | 282 | containerWidth={this.state.width}
|
271 | 283 | cols={this.state.cols}
|
272 | 284 | margin={this.props.margin}
|
|
0 commit comments