ascoders / react-native-image-viewer

🚀 tiny & fast lib for react native image viewer pan and zoom
MIT License
2.45k stars 580 forks source link

Configurable cropWidth and cropHeight #183

Open tngan opened 6 years ago

tngan commented 6 years ago

Thanks for your hard work on this project!

The cropWidth and cropHeight passed into the ImageZoom component are referring to the root view's width and height.

https://github.com/ascoders/react-native-image-viewer/blob/c1e567ed0ba61205dadbc1b7becdb22dcff3870a/src/image-viewer.component.tsx#L396-L412

Then if I have two image viewers wrapped side by side on the same page, they are not supposed to use the same operating area. Then the zooming center will look a little bit of weird.

Is it possible to make width and height as a props ?

ascoders commented 6 years ago

Thank for you advice! try pass style to props?

<ImageViewer style={{width: 200, height: 200}} />
tngan commented 6 years ago

@ascoders Let me try later today. Thanks for your quick reply.

tngan commented 6 years ago

@ascoders The style is for the container, but not related to the zooming center. The upper view looks okay, but the bottom one, looks like the zooming center is not relative to the parent view.

bug