Skip to content

fix: Long filename handling in Preview#7097

Merged
Julesssss merged 21 commits intoExpensify:mainfrom
mananjadhav:fix/file-preview-line
Jan 20, 2022
Merged

fix: Long filename handling in Preview#7097
Julesssss merged 21 commits intoExpensify:mainfrom
mananjadhav:fix/file-preview-line

Conversation

@mananjadhav
Copy link
Collaborator

@mananjadhav mananjadhav commented Jan 8, 2022

Details

  • Long filename was overflowing outside the container. Added a component that adds ellipses (...) in the middle of the string.
  • Updated subtitle prop to Header so that a custom component or string can be passed to Header

Fixed Issues

$ #6873

Tests

  1. Tested with long filenames on Desktop, Web, and Mobile Apps
  2. Tested Fluid width to ensure ellipses show only if there isn't space for the whole name to show up.
  3. Tested ReportingTypingIndicator as the component was updated.
  • Verify that no errors appear in the JS console

QA Steps

  1. Launch the app and open any chat
  2. Upload an attachment with a very long name
  3. Open the attachment with the preview pane
  4. Ensure that the filename should be visible with ... and ensure that the extension should show up.
  • [] Verify that no errors appear in the JS console

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

web-file-preview-long-text

Mobile Web

mweb-file-preview-long-text

Desktop

desktop-file-preview-long-text

iOS

ios-file-preview-long-text

Android

android-file-preview-long-text

@mananjadhav mananjadhav requested a review from a team as a code owner January 8, 2022 17:42
@MelvinBot MelvinBot requested review from Julesssss and parasharrajat and removed request for a team January 8, 2022 17:42
@mananjadhav
Copy link
Collaborator Author

@parasharrajat PR updated with 1 pending clarification and 1-2 questions.

@mananjadhav
Copy link
Collaborator Author

PR updated.

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue MWeb.
image

@mananjadhav
Copy link
Collaborator Author

The issue MWeb.

I am not able to reproduce. Whats the filename and the device? I am trying on iPhone Safari.

Screenshot 2022-01-09 at 8 07 28 PM

Screenshot 2022-01-09 at 8 07 42 PM

@parasharrajat
Copy link
Member

parasharrajat commented Jan 9, 2022

this is Android M web.

file name => bored-cat asds sdsds asrrrrrrr asd sad asas sdas a rajat asdsa sad as asdaasdbaccxbcbxcbxbcbxsads asdjaskdjaskdjsakdjaskdjsadsadsad.gif

@mananjadhav
Copy link
Collaborator Author

Got it. Well, this issue exists with ReportingTypingIndicator as well currently.

Every time I've used this on the web, I also use white-space: nowrap, but wasn't sure if I should add right now. Adding it shows like this:

image

Do you have any other suggestions?

@parasharrajat
Copy link
Member

Oh, Ok. If this issue exists on the main as well, I would report separately but now as we are working on a change that replaces both at once so we will have to fix it. We can't merge with a known bug.

let's see if we can find a solution. But if you say that we should tackle this separately, then let me know. I am happy to report it.

@parasharrajat
Copy link
Member

But I see why this is caused. and it's not your Code's fault. It's an issue with RN-web and I am reporting it there and There is another issue #6913 due to that bug.

@parasharrajat
Copy link
Member

Here is the RN-web issue link necolas/react-native-web#2186

@mananjadhav
Copy link
Collaborator Author

mananjadhav commented Jan 9, 2022

@parasharrajat PR updated

Screenshot 2022-01-10 at 12 25 07 AM

but now as we are working on a change that replaces both at once so we will have to fix it. We can't merge with a known bug.

Agreed and hence I've fixed it with a solution albeit not fixing the root cause. It seems the ellipsis isn't working well with the multi-line styles but I haven't come across this earlier.

you say that we should tackle this separately, then let me know. I am happy to report it.

While I've tackled the issue and if it is accepted, can we add a bonus to this job to solve the other bug as well?

@parasharrajat
Copy link
Member

Ok, I have found the fix for the RN-web issue and I am going to submit a PR that will fix three issues at once in our repo including the one which you faced.

let's wait for that PR to merge.

@mananjadhav
Copy link
Collaborator Author

@parasharrajat Should I revert my recent changes? or wait for your PR to get merged? I saw your PR its the ideal fix for the issue.

@parasharrajat
Copy link
Member

Le's wait for today. Thanks.

@mananjadhav
Copy link
Collaborator Author

@parasharrajat I can see the RNWeb PR is still not merged. Are you sure that this will fix the issue then I can probably revert my recent changes and close it from my side?

@parasharrajat
Copy link
Member

Let's give it a couple of more days. I think it will fix it. I will create a tracking issue in the meantime.

@parasharrajat
Copy link
Member

parasharrajat commented Jan 15, 2022

@mananjadhav You can revert the changes for the ellipsis fix. PR is #7254. Then we can merge this.

@mananjadhav
Copy link
Collaborator Author

@parasharrajat @Julesssss PR updated.

this.submitAndClose = this.submitAndClose.bind(this);
this.closeConfirmModal = this.closeConfirmModal.bind(this);
this.isValidSize = this.isValidSize.bind(this);
this.splitExtensionFromFileName = this.splitExtensionFromFileName.bind(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No extra bindings.

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tests well.

cc: @Julesssss
🎀 👀 🎀 C+ reviewed

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Looks good to me.

I was going to suggest a var name change, but it is too minor to care about for now.

@Julesssss Julesssss merged commit 439116a into Expensify:main Jan 20, 2022
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @Julesssss in version: 1.1.31-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @AndrewGable in version: 1.1.32-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants