-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Chat - Magnifying glass displayed anywhere on the modal page for small images #6326
Comments
Triggered auto assignment to @timszot ( |
Triggered auto assignment to @mallenexpensify ( |
Triggered auto assignment to @deetergp ( |
ProposalWe can calculate the pressable size by calculating the final size of the image. The final size of the image can be calculated using the size of the container (extracted with We will need to add the following functions to storeImageContainerSize(event) {
if (this.state.imageContainer) {
// just do it first time to avoid potentially falling in a loop of update image size -> layout changes size -> update image size -> etc.
return;
}
this.setState({
imageContainer: {
height: event.nativeEvent.layout.height,
width: event.nativeEvent.layout.width,
ratio: event.nativeEvent.layout.height / event.nativeEvent.layout.width,
}
});
}
shouldUseImageSize() {
// We can use the calculated image size if we have all required sizes (original image size + container size) and we are not zoomed in
if (!this.state.imageContainer || !this.state.imgHeight || !this.state.imgWidth || this.state.isZoomed) {
return false;
}
return true;
}
getFinalImageWidth() {
if (this.state.imageContainer.width >= this.state.imgWidth && this.state.imageContainer.height >= this.state.imgHeight) {
// Image fits completely
return this.state.imgWidth;
}
const imageAspect = this.state.imgWidth / this.state.imgHeight;
const imageContainterAspect = this.state.imageContainer.width / this.state.imageContainer.height;
if (imageAspect > imageContainterAspect) {
// Image is wider than container
return '100%';
}
// Image is taller than container
return this.state.imageContainer.height * imageAspect;
}
getFinalImageHeight() {
if (this.state.imageContainer.width >= this.state.imgWidth && this.state.imageContainer.height >= this.state.imgHeight) {
// Image fits completely
return this.state.imgHeight;
}
const imageAspect = this.state.imgWidth / this.state.imgHeight;
const imageContainterAspect = this.state.imageContainer.width / this.state.imageContainer.height;
if (imageAspect > imageContainterAspect) {
// Image is wider than container
return this.state.imageContainer.width / imageAspect;
}
// Image is taller than container
return '100%';
} We will adjust the current like this: <Pressable
style={[
this.shouldUseImageSize() ? {height: this.getFinalImageHeight()} : styles.h100,
this.shouldUseImageSize() ? {width: this.getFinalImageWidth()} : styles.w100,
getZoomCursorStyle(this.state.isZoomed, this.state.isDragging),
]} And the store the layout container size from like this: <Image
onLayout={e => this.storeImageContainerSize(e)}
source={{uri: this.props.url}}
style={getZoomSizingStyle(this.state.isZoomed, this.state.imgWidth, this.state.imgHeight, this.state.zoomScale)}
resizeMode={this.state.isZoomed ? 'contain' : 'center'}
/> |
1. Replication 2. Problems 3. Solution
This is my solution to resolve this issue. |
@deetergp , can you please review @CamilaRivera and @railway17 's proposals above? |
Thank you both for your proposals @CamilaRivera & @railway17's. After reviewing them both, I'm inclined to go with @railway17 proposal is it's appears to get the job done with fewer changes. |
📣 @railway17 You have been assigned to this job by @deetergp! |
Hired @railway17 / MingYun H. in Upwork for the job. |
@mallenexpensify , @deetergp
I tried with node 12.x, 14.x and 17.x by using nvm. Even though it was tested before, I would like to keep the rule to write the pull request description with attachments. |
I created a pull request with 2 videos (web fix was taken from my pc but desktop-fix video was taken from another pc). |
Hi @railway17 , this is likely a better question for @deetergp who will be the one reviewing the PR. Scott, can you take a look above plz |
Hi, @deetergp , @mallenexpensify
|
Hey @railway17. Here are the versions I'm running on my Big Sur machine: ➜ App git:(han-fix-magnifying-glass) ✗ node --version
v14.17.4
➜ App git:(han-fix-magnifying-glass) ✗ npm --version
6.14.14
➜ App git:(han-fix-magnifying-glass) ✗ nvm --version
0.38.0
➜ App git:(han-fix-magnifying-glass) ✗ Generally, when I run into these kinds of runtime issues, I find that just deleting the |
We are tracking are a regression from this issue's PR. #6518. It must be fixed before this issue can be paid out. Also, this is @railway17 's first issue/PR in our repo so I think further assignment should be restrained until the regression is fixed, |
Just to reiterate and confirm what @parasharrajat said above, this issue should not be considered complete until #6518 is resolved as well. |
Hi, @roryabraham , @parasharrajat 20211211201522018.mp4 |
Hi, @roryabraham , @parasharrajat |
@railway17 have you tried testing this on a touch-screen device? |
Touch screen means mobile devices? Because #6518 is tagged with Web platform, I have just tried in Desktop browser and desktop app. |
@roryabraham But for now, mobile apps never use my changes. |
Not 100% sure, but it's possible that this PR added this regression |
Hi, @roryabraham |
Those are not related, @iwiznia |
Issue not reproducible during KI retests. (Second week) |
Looks like we're holding on this before payment is issued.... right? |
I think there is no reason why we should hold this issue now. |
@parasharrajat @deetergp can you help here? With the regressions, I'm unsure when I should pay |
Aha, this issue is all spread out. @mvtglobally Could you please retest it once and let us know if this is fixed? Thanks. |
This specific Issue not reproducible during KI retests. (Third week). We can close it. |
Thank you, @mvtglobally . |
Ok, Looks like both regressions are fixed now. @mallenexpensify. |
Thanks @parasharrajat for the update. Thanks @railway17 for the help, paid in Upwork, $250. |
Thank you, @mallenexpensify |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Magnifying glass displayed only when hovering the image
Actual Result:
Magnifying glass displayed on all the places
Workaround:
Unknown
Platform:
Where is this issue occurring?
Version Number: 1.1.15.1
Reproducible in staging?: Yes
Reproducible in production?: Yes
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
Bug5330197_Recording__1115.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause
Slack conversation:
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: