react-photo-gallery icon indicating copy to clipboard operation
react-photo-gallery copied to clipboard

Direction Column not working with Custom Render and no example has been there.

Open venkat-waran opened this issue 4 years ago • 4 comments

Screenshot 2020-04-23 at 9 11 44 PM

venkat-waran avatar Apr 23 '20 15:04 venkat-waran

you can pass left and top props on your renderImage like so: renderImage={({photo, left, top, margin}) => ( <CutsomImageComponent left={left} top={top} photo={photo} margin={margin} )} then on you custom component use position absolute and the top and left props. const CustomImageComponent = ({margin, photo, left, top}) => ( <div style={{ width: photo.width, height: photo.height, margin, {/*Use this to apply the column layout*/} position: "absolute", left: left, top: top }}> <img alt={photo.title} width={photo.width} height={photo.height} src={photo.src} /> </div> )

Skil3e avatar May 14 '20 12:05 Skil3e

@Skil3e thanks this looks promising but I cannot get it working. Could you please post a more functional example or repo that we can work from?

Thanks!

Vacilando avatar May 18 '20 21:05 Vacilando

@Vacilando here is a codesandbox with a working example Just make sure the photos array has the width and the height of the photos. https://codesandbox.io/s/direction-column-react-photo-gallery-wc158

Skil3e avatar May 19 '20 20:05 Skil3e

Thanks, @Skil3e, it works now. Much appreciated!

Vacilando avatar May 19 '20 21:05 Vacilando