fix: Allow zooming on full child content, even if it appeared truncat…#70
Conversation
SimonErich
left a comment
There was a problem hiding this comment.
@AmauryLiet Thank you for your MR.
Awesome feature, that I would really love to add.
Could you please just add the two small things I mentioned in the review and then we are good to go. 👍
src/ReactNativeZoomableView.tsx
Outdated
| // W = H * RATIO | ||
|
|
||
| const aspectRatioOnMount = originalHeight && originalWidth ? originalWidth / originalHeight : 1; | ||
| const { contentAspectRatio = aspectRatioOnMount } = this.props; |
There was a problem hiding this comment.
Could you please put this to the top of the method.
I would like to follow the best practice to have all external (prop) definitions at the top of the methods to know what we really use within our methods immediately.
(we need to convert some of the other occurences this.props... to, but let's start here.
src/ReactNativeZoomableView.tsx
Outdated
| const aspectRatioOnMount = originalHeight && originalWidth ? originalWidth / originalHeight : 1; | ||
| const { contentAspectRatio = aspectRatioOnMount } = this.props; | ||
|
|
||
| const wasWidthCroppedOnMount = aspectRatioOnMount < contentAspectRatio; |
There was a problem hiding this comment.
Could you please add a small comment explaining the logic here? It seems obvious, but up until now we kind of follow the approach to summarize the following block of logic, to make it easier to get into. :)
f7082d9 to
cb95ddd
Compare
…ed on first render
Hey, I'll try to explain the issue here
Exemple use case:
XX
XX
XX
XX
YYYY
YYYY
YYYY
YYYY
Then on first render the child won't be fully displayed (1st & 4th column hidden). This is fine.
However pan gesture does NOT allow to see the 1st & 4th column, whatever the gesture.
(Given
minZoom={1}and bindToBorders!==false)Ideally, I would include a minimal reproduction example & show the prop usage in the demo app, but I'm afraid to be lacking time is the near future :/