-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix - On increasing the screen size the user can see the previous image in the list #17760 #18615
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1014d69
Issue17760
AmjedNazzal 487588c
Update src/components/AttachmentCarousel/index.js
AmjedNazzal b1bbbf8
Common value for centered modals
AmjedNazzal 5d75473
Merge branch 'Expensify:main' into Issue17760
AmjedNazzal 08ab529
Merge branch 'Expensify:main' into Issue17760
AmjedNazzal bd4858e
Update src/components/AttachmentCarousel/index.js
AmjedNazzal 30d5628
Update src/components/AttachmentCarousel/index.js
AmjedNazzal f9dffc5
Merge branch 'Expensify:main' into Issue17760
AmjedNazzal c845f79
Merge branch 'Expensify:main' into Issue17760
AmjedNazzal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks for the ping @aimane-chnaif
As a developer, I have concerns with this approach as it seems to create an implicit coupling between components.
If, for any reason, someone changes the generic modal dimensions through methods other than
marginHorizontal
orborderWidth
, they could inadvertently disrupt thewidth
utilized here without even realizing it.Moreover, the Carousel appears to be aware of its rendering context within a centered modal - a detail which, ideally, it should not be concerned with.
It seems we might be trading one bug, that only occurs on resize, for another which could potentially occur all the time.
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.
@kidroca thanks for the feedback. I know this is not ideal solution.
Do you have better solution to be synced with window size considering margin and border?
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 addressing this bug is crucial, my preference would be to continue using
containerWidth
, but dynamically adjust its value in accordance with changes in window size. Here's a step-by-step outline of how this could work:containerWidth
andwindowWidth
.windowWidth
has either shrunk or expanded, and immediately apply this same proportion tocontainerWidth
.This solution is universal and does not depend on specifics. It remains effective regardless of specific properties or the modal context, thereby reducing the risk of inadvertently introducing new issues.
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.
That makes sense. So
containerWidth
's first value comes fromonLayout
callback and we store size difference betweencontainerWidth
andwindowWidth
. And then wheneverwindowWidth
changes,containerWidth
=windowWidth
- stored diff value. Right?