|
| 1 | +# From v0.5.x |
| 2 | + |
| 3 | +The biggest change from v0.5.x to 1.x.x is that now this library has no lightbox functionality. |
| 4 | +Read [this discussion](https://github.com/benhowell/react-grid-gallery/discussions/179) to learn more about the motivation for that decision. |
| 5 | +So if you want need lightbox integration please check out our [examples](https://benhowell.github.io/react-grid-gallery/). |
| 6 | + |
| 7 | +## API changes |
| 8 | +Also, we made API polishing and renamed some props, and changed event handler signatures. |
| 9 | + |
| 10 | +### Gallery Options changes |
| 11 | +- `onSelectImage` renamed to `onSelect` |
| 12 | +- `onClickThumbnail` renamed to `onClick` |
| 13 | + |
| 14 | +Both event handlers now receive the same arguments: |
| 15 | +```ts |
| 16 | +(index: number, item: Image, event: MouseEvent<HTMLElement>) => void |
| 17 | +``` |
| 18 | + |
| 19 | +Styling props such as `thumbnailStyle`, `tagStyle`, `tileViewportStyle` now get some extra data as arguments, read more in [the docs](https://github.com/benhowell/react-grid-gallery#gallery-options). |
| 20 | + |
| 21 | +In [v0.5.x docs](https://github.com/benhowell/react-grid-gallery/tree/v0.5.6#programmers-notes) there was a hacky access to `this` in event handlers. |
| 22 | +After lightbox functionality was stripped out it's not needed and removed. |
| 23 | + |
| 24 | +In [v0.5.x](https://github.com/benhowell/react-grid-gallery/tree/v0.5.6), there was [hacky access](https://github.com/benhowell/react-grid-gallery/tree/v0.5.6#programmers-notes) to `this` in event handlers. After lightbox functionality was stripped out this hack was removed as well. |
| 25 | + |
| 26 | +### Image Options changes |
| 27 | +- `thumbnail` renamed to `src` |
| 28 | +- `thumbnailWidth` renamed to `width` |
| 29 | +- `thumbnailHeight` renamed to `height` |
| 30 | + |
| 31 | +So now the minimum image object looks like this |
| 32 | + |
| 33 | +```json |
| 34 | +{ |
| 35 | + "src": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Apples.jpg/320px-Apples.jpg", |
| 36 | + "width": 320, |
| 37 | + "height": 480 |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | + |
| 42 | +## No default import |
| 43 | + |
| 44 | +React grid gallery now uses only named export. Please update import to |
| 45 | +```js |
| 46 | +import { Gallery } from "react-grid-gallery"; |
| 47 | +``` |
0 commit comments