tam315 / react-compare-image

React component to compare two images with a slider
react-compare-image-git-master.junkboy0315.vercel.app
MIT License
335 stars 77 forks source link

Container size may not change correctly when source is changed #33

Closed tam315 closed 4 years ago

Exonalex commented 4 years ago

have same problem. container define height in wrong way so end to cut my image. i had to edit bundle with height of container 100% but its temp fix. and i can slide under the max image size anyway. please fix

albingroen commented 4 years ago

I think this can also be solved by adding the image source or image id (if it's unique) as the key prop on the component. That way the CompareImage component should re-render every time the image is changed. It's not a optimal solution, but if the image sources changes often, the sizes and resolution really goes nuts.

tam315 commented 4 years ago

see https://react-compare-image.yuuniworks.com/?path=/story/images-with-different-aspect-ratios--default-behavior or give me a reproductive sample.