From 631d9440f87bdf98768e9d7193dc29e2443a00bb Mon Sep 17 00:00:00 2001 From: Sandra Date: Wed, 6 Jun 2018 15:41:24 +0200 Subject: [PATCH 01/32] change the way ImageComponent gets called, change Photo to function, add keys to components --- examples/src/SelectedImage.js | 4 ++-- src/Gallery.js | 19 ++++++++----------- src/Photo.js | 29 +++++++++++------------------ 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/examples/src/SelectedImage.js b/examples/src/SelectedImage.js index cbe8e6b..b43dea6 100644 --- a/examples/src/SelectedImage.js +++ b/examples/src/SelectedImage.js @@ -17,14 +17,14 @@ const cont = { position: 'relative' } -const SelectedImage = ({ index, onClick, photo, margin}) => { +const SelectedImage = ({ key, index, onClick, photo, margin}) => { //calculate x,y scale const sx = (100 - ((30 / photo.width) * 100)) / 100; const sy = (100 - ((30 / photo.height) * 100)) / 100; selectedImgStyle.transform = `translateZ(0px) scale3d(${sx}, ${sy}, 1)`; return ( -
+
onClick(e, {index, photo})} />