You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ed4fc43
Browse filesBrowse the repository at this point in the historyBrowse files
|`className`|`PropTypes.string`|`undefined`| Specify `className` of component. |
60
90
|`style`|`PropTypes.object`|`{}`| Original style of component. Following styles are ignored. (`position`, `height`, `transition`) |
91
+
|`gridRef`|`PropTypes.func`|`null`| Reference the instance of StackGrid. Unlike ordinary `ref`, it accepts only functions. |
61
92
|`component`|`PropTypes.string`|`"div"`| See [ReactTransitionGroup](https://facebook.github.io/react/docs/animation.html#rendering-a-different-component)|
62
93
|`columnWidth`|`PropTypes.oneOfType([PropTypes.number, PropTypes.string])`|`150`| Specify column width as an number(`px`), or percentage string. (Example `"33.33%"`) |
63
94
|`gutterWidth`|`PropTypes.number`|`5`| Specify gutter width as an number. |
@@ -78,6 +109,16 @@ You can set the following properties.
78
109
79
110
80
111
112
+
113
+
## Instance API
114
+
115
+
### updateLayout(): void
116
+
117
+
Update the current layout.
118
+
119
+
120
+
121
+
81
122
## Animations
82
123
83
124
The following function must return styles related to animation.
@@ -138,7 +179,6 @@ Please try actual demonstration in [live demo](https://tsuyoshiwada.github.io/re
138
179
139
180
140
181
141
-
142
182
## Tips
143
183
144
184
@@ -163,6 +203,32 @@ If it's not necessary, specify `0` for `duration` property.
163
203
```
164
204
165
205
206
+
### How to manually update layout ?
207
+
208
+
If the size of an item is changed by an action such as a click event, there are cases where you want to update the layout manually.
209
+
You can manually update the layout by referring to the StackGrid instance with `gridRef` and executing the`updateLayout()` method.
210
+
211
+
```javascript
212
+
classMyComponentextendsReact.Component {
213
+
214
+
// When the size of the item is changed...
215
+
something= () => {
216
+
this.grid.updateLayout();
217
+
};
218
+
219
+
render() {
220
+
return (
221
+
<StackGrid
222
+
gridRef={grid=>this.grid= grid}
223
+
>
224
+
{/* items ... */}
225
+
</StackGrid>
226
+
);
227
+
}
228
+
}
229
+
```
230
+
231
+
166
232
167
233
168
234
## Thanks
@@ -172,24 +238,28 @@ If it's not necessary, specify `0` for `duration` property.
172
238
173
239
174
240
241
+
175
242
## License
176
243
177
244
Released under the [MIT Licence](https://raw.githubusercontent.com/tsuyoshiwada/react-stack-grid/master/LICENSE)
178
245
179
246
180
247
248
+
181
249
## ChangeLog
182
250
183
251
See [CHANGELOG.md](./CHANGELOG.md)
184
252
185
253
186
254
255
+
187
256
## Author
188
257
189
258
[tsuyoshiwada](https://github.com/tsuyoshiwada)
190
259
191
260
192
261
262
+
193
263
## Development
194
264
195
265
Initialization of the project.
@@ -224,6 +294,7 @@ $ npm run build
224
294
```
225
295
226
296
297
+
227
298
## Contribution
228
299
229
300
Thank you for your interest in react-stack-grid.js.
0 commit comments