-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6326: fix bug reported at #6518 #6535
Changes from 4 commits
73afc16
c94fbf0
2167b00
11fce35
c98a78d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ class ImageView extends PureComponent { | |
this.canUseTouchScreen = canUseTouchScreen(); | ||
this.state = { | ||
containerHeight: 0, | ||
containerWidth: 0, | ||
isZoomed: false, | ||
isDragging: false, | ||
isMouseDown: false, | ||
|
@@ -85,9 +86,17 @@ class ImageView extends PureComponent { | |
imgRight = imgLeft + (fitRate * width); | ||
} | ||
|
||
this.setState({ | ||
imgWidth: width, imgHeight: height, imageLeft: imgLeft, imageTop: imgTop, imageRight: imgRight, imageBottom: imgBottom, | ||
}); | ||
// In case image loading is delayed than onLayout callback of the root View caused internet speed. | ||
const newZoomScale = Math.min(this.state.containerWidth / width, this.state.containerHeight / height); | ||
this.setState(prevState => ({ | ||
imgWidth: width, | ||
zoomScale: prevState.zoomScale === 0 ? newZoomScale : prevState.zoomScale, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I was going to set zoomScale in the |
||
imgHeight: height, | ||
imageLeft: imgLeft, | ||
imageTop: imgTop, | ||
imageRight: imgRight, | ||
imageBottom: imgBottom, | ||
})); | ||
} | ||
|
||
/** | ||
|
@@ -169,6 +178,7 @@ class ImageView extends PureComponent { | |
const scale = imageHeight && imageWidth ? Math.min(width / imageWidth, height / imageHeight) : 0; | ||
this.setState({ | ||
containerHeight: height, | ||
containerWidth: width, | ||
zoomScale: scale, | ||
}); | ||
}} | ||
|
@@ -181,9 +191,10 @@ class ImageView extends PureComponent { | |
> | ||
<Pressable | ||
style={{ | ||
...StyleUtils.getZoomSizingStyle(this.state.isZoomed, this.state.imgWidth, this.state.imgHeight, this.state.zoomScale, this.state.containerHeight), | ||
...StyleUtils.getZoomSizingStyle(this.state.isZoomed, this.state.imgWidth, this.state.imgHeight, this.state.zoomScale, | ||
this.state.containerHeight, this.state.containerWidth), | ||
...StyleUtils.getZoomCursorStyle(this.state.isZoomed, this.state.isDragging), | ||
...this.state.isZoomed ? styles.pRelative : styles.pAbsolute, | ||
...this.state.isZoomed && this.state.zoomScale > 1 ? styles.pRelative : styles.pAbsolute, | ||
...styles.flex1, | ||
}} | ||
onPressIn={(e) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really understand what this comment is about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For regression, there is new issue that is open.
Because I didn't know which issue number should be written, so I made it.
Which issue number should be written?
Original one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this comment, I noticed that image loading is delayed because of internet speed.
In this case, image size is not decided even though the container (modal) is open.
Because of this reason,
zoomScale
is also not decided.To avoid this problem, I wrote the code and comment like above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not making sense to me. Could you please update it?
Please mention both issue URLs in the description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means
1: You don't need such exception handling? Need to remove that code?
2. Should not write as
Original issue
,Regression issue
?Instead of it, should write urls directly like below?
https://github.com/Expensify/App/issues/6326
,https://github.com/Expensify/App/issues/6518
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @parasharrajat
Could you please let me know what you expect exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will let others review it. I don't really know this part of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, I can remove that code shortly.
But I added that code because I noticed the issue in my side.
Please let me know whenever you have any feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @parasharrajat , @deetergp
How are you doing?
Any feedback from other reviewers?
Please kindly let me know so that we can proceed.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried hard to understand what you were trying to communicate with this comment, but it doesn't make sense to me. It sounds like there's some race condition at play here? If you can explain what you mean in a different way, that would be great. Otherwise, please just remove this comment.