Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
2.99k stars 2.5k forks source link

[HOLD on #21219] [$2000] Assign Task- The header "from" field shows "Fro..." instead of " From username/email id" #24339

Open lanitochka17 opened 9 months ago

lanitochka17 commented 9 months ago

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:

  1. Launch app
  2. Tap Fab plus button
  3. Tap assign task
  4. Enter any title and description
  5. Tap next
  6. Tap "assignee" to assign task to yourself
  7. Tap Share somewhere to select email id in this specific format Eg- jaihanumanblog+hgfd@gmail.com vincenzoddragon+five@gmail.com Use a email id+ 4 letter word specifically like "five", " Life" to reproduce bug.
  8. Tap confirm task
  9. In task conversation page, note header "from" field

Expected Result:

In task conversation page, the header "from" field must show user name/ email id of contact which is selected for " Share somewhere "

Actual Result:

In task conversation page, the header "from" field shows "Fro..." instead of " From username/email id"

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Version Number: 1.3.52.1

Reproducible in staging?: Yes

Reproducible in production?: Yes

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

https://github.com/Expensify/App/assets/78819774/ebdc20aa-a271-4b83-bc27-488976019d6d

https://github.com/Expensify/App/assets/78819774/d063ac8b-a65d-4c1a-a4a6-7db76270af3d

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013e6bf0d4c8e7ce65
  • Upwork Job ID: 1689725638138093568
  • Last Price Increase: 2023-10-20
melvin-bot[bot] commented 9 months ago

Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] commented 9 months ago

Bug0 Triage Checklist (Main S/O)

pradeepmdk commented 9 months ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Assign Task- The header "from" field shows "Fro..." instead of " From username/email id"

What is the root cause of that problem?

In React Native, the Text component does not automatically take the full available space within its parent container by default. This behavior is different from web-based HTML elements, where elements such as <div> automatically take the full width of their parent container.

The reason why the Text component doesn't take full space is because of its inherent behavior as a text-rendering component. The width of the Text component is determined by the size of its content, and it will wrap to the next line if the content exceeds the available width. The default width of a Text component is essentially based on the width required to display its content without overflowing. android textbreakstrategy explanation here and here

What changes do you think we should make in order to solve the problem?

If we want the Text component to take full space or expand to fill the available width of its parent container, we need to explicitly specify a width style for the Text component or use flexbox properties to control its dimensions.

 1) using flexbox `flex:1`

https://github.com/Expensify/App/blob/8d84c23ae3a21130a540794104313b2f7e7e6b6a/src/components/ParentNavigationSubtitle.js?#L48 need add flex1 parent also need flex1 https://github.com/Expensify/App/blob/8d84c23ae3a21130a540794104313b2f7e7e6b6a/src/pages/home/HeaderView.js?#L196 updated correct https://github.com/Expensify/App/issues/24339#issuecomment-1690214992

2) when styles.alignSelfStart its will not take full space. so that in android its not take up the full space. the problem is android only so we can create a platform based style file like this under styles/HeaderViewStyle index.js index.android.js

index.js we can add styles.alignSelfStart and styles.mw100 in index.android.js we don't need that so we can declare an empty style on that. or in android apply styles.alignSelfStart and styles.w100 so that it will take full space.

https://github.com/Expensify/App/blob/1139e7ca891e3b0b84d6773ef82152adf3083ed4/src/pages/home/HeaderView.js#L193-L197

in Pressable style

pressableStyles={headerViewStyle.pressableStyles}

headerViewStyle import basic of platform-based so in android pressableStyles return empty style sheet.

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 9 months ago

Job added to Upwork: https://www.upwork.com/jobs/~013e6bf0d4c8e7ce65

melvin-bot[bot] commented 9 months ago

Current assignee @garrettmknight is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] commented 9 months ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

gzqyl commented 9 months ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Assign Task- The header "from" field shows "Fro..." instead of " From username/email id"

What is the root cause of that problem?

the root cause I had finally found, it is the issue on Android when layout the text content, if there's space in strings, then it will auto break to the new line when wrap, wrap means it has more than one line, and we setmaxlines = 1, then it will wrap, and will break at the space position, that's why we see it ellipsis at From..., as after "From" there's a space char.

What changes do you think we should make in order to solve the problem?

replace the space char with unicode will solve this issue, and it will have no regression issues on other platforms as the layout does not change, and we just "escaped space char with unicode", I tested it, it works on mobile both, and web desktop. For safely without any other issue on Android when there's some special chars make it unexpected break to new line, we could escape the string with unicode '\u200D'. use unicode '\u00A0' no-break space replace the space char we need to have, ie, 'From ' to be 'From\u00A0', tell the os not to beak, we add '\u200D' before special chars, tell the os it will join, while not break to a new line. The key to solve this issue is that we use the unicode features, to keep the display text same and let the os know how to do. after we replace the white space ' ' with unicode '\u00A0', on Android, there maybe still some issue for some special chars, so we could map the string to chars, then check the char, if it is a white space, we use '\u00A0' replace it, if it is out of '/[a-zA-Z\d]/' test, we think it maybe a special char, then we add '\u200D' before it, for the normal text '/[a-zA-Z\d]/' just keep it as it is.

Optional Solution

use View layout on Android with platform specific, but it is not the real root cause solved solution, I preferred the unicode solution, text content will display to user same as before, but the issue on Android will disappear. The unicode does the magic. Screenshot_1691739162

melvin-bot[bot] commented 9 months ago

📣 @gzqyl! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
gzqyl commented 9 months ago

Contributor details Expensify account email: allen.gzqyl@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01e99782a01937e92c

just find that @foxmail.com can not be added slack channel, so I use google mail as a replace.

gzqyl commented 9 months ago

I have already checked out branch, and will merge the latest main branch when I PR, hope this issue assign to me.

pradeepmdk commented 9 months ago

@gzqyl don't create PR until assign you

pradeepmdk commented 9 months ago

@gzqyl don't create PR until assign you

gzqyl commented 9 months ago

@pradeepmdk thanks for your reminding, I will not create PR, just save the solution at local branch, so that I can watch other issues, and when the issue assigned to me, I can quickly checkout the branch to fix the issue.

abdulrahuman5196 commented 9 months ago

Reviewing now

abdulrahuman5196 commented 9 months ago

On @pradeepmdk 's proposal here, I agree that flex might be the right path to go, but the solution is not working for me.

Screenshot 2023-08-13 at 2 13 18 PM
abdulrahuman5196 commented 9 months ago

@gzqyl On your proposal here https://github.com/Expensify/App/issues/24339#issuecomment-1674338057, we would need to know what change you are expecting to make explained as per our contributing guidelines to review the proposal - https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md

pradeepmdk commented 9 months ago

@abdulrahuman5196 for me its working let's add my code here

App/src/components/ParentNavigationSubtitle.js

Screenshot 2023-08-13 at 4 51 28 PM

App/src/pages/home/HeaderView.js

Screenshot 2023-08-13 at 4 44 06 PM

Result before flex1

Screenshot 2023-08-13 at 5 19 04 PM

after flex1

Screenshot 2023-08-13 at 5 19 52 PM
melvin-bot[bot] commented 9 months ago

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

garrettmknight commented 9 months ago

@abdulrahuman5196 can you review?

melvin-bot[bot] commented 9 months ago

@garrettmknight, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!

garrettmknight commented 9 months ago

@abdulrahuman5196 please prioritize this one so we can get it moving. Thanks!

gzqyl commented 9 months ago

I am looking forward to the early reply too, as my proposal does fix the issue.

situchan commented 9 months ago

@garrettmknight I can help this to push forward.

No satisfactory proposals yet. If we stretch subtitle, it will cause regression - #21215

gzqyl commented 9 months ago

@situchan had you tested my proposal? I think my proposal works, and I will test the regression https://github.com/Expensify/App/issues/21215 later

situchan commented 9 months ago

@gzqyl you stretched subtitle by adding width: '100%'

gzqyl commented 9 months ago

@situchan Okay, let me test https://github.com/Expensify/App/issues/21215 firstly

melvin-bot[bot] commented 9 months ago

❌ There was an error making the offer to @situchan for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam

gzqyl commented 9 months ago

❌ There was an error making the offer to @situchan for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam

does it mean this issue already assigned to @situchan , and @situchan gets the offer, so others' proposal will not get offer any more even if others update their proposals?

garrettmknight commented 9 months ago

If @situchan accepts your proposals, you'll be assigned. Right now that's just clarifying that he's the C+ assigned to this bug.

gzqyl commented 9 months ago

@garrettmknight thanks, now I understand the process clearly, and I will try to think if we can get a better way to solve this issue

situchan commented 9 months ago

@gzqyl Click on the right area of email text. It should still go to details page, not parent report

gzqyl commented 9 months ago

@situchan tested mac desktop, right area of email text will go to details page, I will test ios now, for android, it had already occupied the full space, so there's no blank area right of email text.

gzqyl commented 9 months ago

@situchan How about specify the platform "Android", only on android, we use this style minWidth? This is not the best solution, for now, I have no other ideas, I will try to find a better way.

pradeepmdk commented 8 months ago

@situchan can you check this one https://github.com/Expensify/App/issues/24339#issuecomment-1676328189 because this will not create a regression https://github.com/Expensify/App/issues/21215

when we remove styles.alignSelfStart only it will create the regression

gzqyl commented 8 months ago

why we should View while not Text here? on Android, Text changes in some cases not re-render after its size changes, that's why other platform is ok, Android keeps its short width size, use View will solve this issue, it will auto re-render and keep its layout adaptive with the Text width, we use flex row makes numberOfLines={1} works, and use flexShrink make it "inline-block" like a Text, hope that my proposal will be selected, I worked on this issue for hours already.

melvin-bot[bot] commented 8 months ago

@garrettmknight @situchan this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

situchan commented 8 months ago

@gzqyl I am still not inclined to your solution. Let's fix the root cause.

gzqyl commented 8 months ago

@situchan anyway, my solution has fixed the issue, and no any other regression issue occurs, I had already tested on the all platform, it really works.

pradeepmdk commented 8 months ago

@situchan were you able to check mine https://github.com/Expensify/App/issues/24339#issuecomment-1676328189

gzqyl commented 8 months ago

@pradeepmdk your solution does not work on ios device, and the style is a little strange on mobile device, I still think that the right way to solve this issue is using View while not Text only, my solution is almost the perfect, and tested on mobile, desktop, web, style is ok and no other issues.

pradeepmdk commented 8 months ago

@gzqyl yes, I agree, its adding space on native due to flex1

cc @situchan we need add flexShrink1 web also working fine.

 pressableStyles={[styles.alignSelfStart, styles.flexShrink1, styles.flexRow]}
and
style={[styles.optionAlternateText, styles.flex1 ]}

Screenshot 2023-08-23 at 9 20 51 PM

pradeepmdk commented 8 months ago

@situchan can you check my updated one https://github.com/Expensify/App/issues/24339#issuecomment-1690214992

garrettmknight commented 8 months ago

@situchan can you review the updated solution here? If it's not satisfactory, should we be upping the $$ on this one?

situchan commented 8 months ago

@situchan can you review the updated solution here? If it's not satisfactory, should we be upping the $$ on this one?

yes, still looking for ideal solution which fixes the root cause which happens only on android

melvin-bot[bot] commented 8 months ago

Upwork job price has been updated to $2000

melvin-bot[bot] commented 8 months ago

Upwork job price has been updated to $1000

garrettmknight commented 8 months ago

Just saw that the Help Wanted label got dropped. Readding and seeing if we get any other proposals before upping the price.

Nodebrute commented 8 months ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Assign Task- The header "from" field shows "Fro..." instead of " From username/email id"

What is the root cause of that problem?

The problem here is that unnecessary styling is being added to the ParentNavigationSubtitle. This issue isn't just limited to tasks; it's happening everywhere we use the HeaderView. For instance, we're seeing the same problem in thread headers as well.

Interestingly, this problem doesn't appear in IOU reports. The reason is that the styling used in that context is correct and doesn't cause the same issue.

What changes do you think we should make in order to solve the problem?

We should implement the ParentNavigationSubtitle in HeaderView the same way we do for IOU reports in AvtarWithDisplayName. https://github.com/Expensify/App/blob/1139e7ca891e3b0b84d6773ef82152adf3083ed4/src/components/AvatarWithDisplayName.js#L129-L132 https://github.com/Expensify/App/blob/1139e7ca891e3b0b84d6773ef82152adf3083ed4/src/pages/home/HeaderView.js#L193-L197

I've observed that the issue stems from the usage of styles.alignSelfStart. To address this, we have two options:

Before

Screenshot 2023-08-29 at 1 09 43 AM

After

Screenshot 2023-08-29 at 1 10 26 AM

I have added background color here for convenience

What alternative solutions did you explore? (Optional)

pradeepmdk commented 8 months ago

@situchan the problem is android only so we can create a platform based style file like this under styles/HeaderViewStyle index.js index.android.js

index.js we can add styles.alignSelfStart and styles.mw100 in index.android.js we don't need that so we can declare an empty style on that.

gzqyl commented 8 months ago

@garrettmknight I had already solved this issue indeed, and I had already tested my solution on web, android, ios, desktop, it is fine without any other regression issue. Though @situchan was not much agree with the stated root cause is that using Text wrap Text is not a good practice, we should use View to keep flex layout works on all platforms. My solution is already a tested ok solution, hope that my proposal could be considered again, and when we want to layout multi Text component in later dev, we just use View layout it is ok, not much hard to understand, style the View and its child Text component is enough to solve such issue in the future devs.