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

[$2000] Android - Title is not rendered fully in the available space. #21219

Open kbecciv opened 11 months ago

kbecciv commented 11 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. Open the app on Android.
  2. See the chats in the LHN.
  3. Notice a few reports will longer title.

Expected Result:

Title is clipped when reached the right edge of the screen.

Actual Result:

Title is clipped with ellipsis in the middle of screen and there is more available room.

Workaround:

Unknown

Platforms:

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

Version Number: 1.3.27-2

Reproducible in staging?: y

Reproducible in production?: y

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

Screenshot 2023-06-14 at 6 54 44 PM (1)

Screenshot_20230620_203809_New Expensify

Expensify/Expensify Issue URL:

Issue reported by: @parasharrajat

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686749244980549

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ef0ae782c96792ac
  • Upwork Job ID: 1671576465794899968
  • Last Price Increase: 2023-11-06
  • Automatic offers:
    • aimane-chnaif | Reviewer | 27596163
    • fabriziobertoglio1987 | Contributor | 27981486
melvin-bot[bot] commented 11 months ago

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

melvin-bot[bot] commented 11 months ago

Bug0 Triage Checklist (Main S/O)

ahmedGaber93 commented 11 months ago

Proposal

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

Android - Title is not rendered fully in the available space.

What is the root cause of that problem?

The root cause is android use different way to break words, see here and textbreakstrategy explanation here I don't think any textbreakstrategy value will make the text stretch to end of the line, because there is no flex 1 style for text which make Text break instead of stretch in the parent view.

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

remove style optionDisplayNameCompact and add styles.flex1

const displayNameStyle = StyleUtils.combineStyles([styles.optionDisplayName, styles.pre, styles.flex1, ...textUnreadStyle], props.style);
old proposal we need change `flexGrow: 0`, here to be `flexGrow: 1`, or remove it and use `flex: 1` https://github.com/Expensify/App/blob/797298e272bc0867c15dd3e1c76293a0e9009503/src/styles/styles.js#L1401-L1406

before and after.

Screenshot 2023-07-12 at 5 07 24 PM

What alternative solutions did you explore? (Optional)

adelekennedy commented 11 months ago

yeah - longer chat names are being cut off in the center of the screen with ellipses rather than reaching the border of the screen like we see in IOS

melvin-bot[bot] commented 11 months ago

Job added to Upwork: https://www.upwork.com/jobs/~01ef0ae782c96792ac

melvin-bot[bot] commented 11 months ago

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

melvin-bot[bot] commented 11 months ago

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

Pujan92 commented 11 months ago

Proposal

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

Android - Title is not rendered fully in the available space.

What is the root cause of that problem?

Default Text render startegy for android is highQuality which is causing the issue where it breaks unwantedly the string but we are only showing a single line.

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

We need to provide the prop textBreakStrategy here with textBreakStrategy="simple" which solves the issue. Same we are providing for ResendValidationForm here.

https://github.com/Expensify/App/blob/003e5e563a20459e4252189bd0eaa6a8f60b744c/src/components/DisplayNames/index.native.js#L8-L12

manjesh-yadav commented 11 months ago

Proposal

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

Android - Title is not rendered fully in the available space.

What is the root cause of that problem?

It is Android style word breaking IOS work differently that is why we found two diffrent design in the screenshot.

textBreakStrategy="simple" is not the right solution for the following reasons.

  1. textBreakStrategy="simple" use for, not break words when break line
  2. textBreakStrategy="simple" lose the layout quality in Android Read here
  3. it's not working on all devices Read here
  4. In other devices textBreakStrategy="simple" is just removing - at the end and works the same as before

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

I suggest use text.replace(/\s/g, '\xa0') for replacing whitespace by non-breaking unicode space in the variable and it will work fine and it does not lose any layout quality.

We are using different files for web and native so it will not affect our web

https://github.com/Expensify/App/blob/3585d7ba030a05045123ef87ebeccf084db90bbd/src/components/DisplayNames/index.native.js#L6-L15

function DisplayNames(props) {
    return (
        <Text
            accessibilityLabel={props.accessibilityLabel}
            style={props.textStyles}
            numberOfLines={props.numberOfLines}
        >
-           {props.fullTitle}
+            {props.fullTitle.replace(/\s/g, '\xa0')}
        </Text>
    );
}
Result ![Screenshot_1687443917](https://github.com/Expensify/App/assets/70934016/58b73797-c311-424c-ac9b-0135f22b66b0) ![IMG_D674EEB790B1-1](https://github.com/Expensify/App/assets/70934016/db5a1573-e001-4afd-b808-35dc55e8bc91)

What alternative solutions did you explore? (Optional)

adelekennedy commented 10 months ago

@aimane-chnaif thoughts on the proposal above?

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

@adelekennedy, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

adelekennedy commented 10 months ago

I don't think we need to adjust the bounty just yet - we have proposals above to review

melvin-bot[bot] commented 10 months ago

@adelekennedy, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

adelekennedy commented 10 months ago

pending proposal review @aimane-chnaif

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

@adelekennedy @aimane-chnaif 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!

adelekennedy commented 10 months ago

pending review @aimane-chnaif will you be able to review the above proposals soon?

melvin-bot[bot] commented 10 months ago

@adelekennedy, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

adelekennedy commented 10 months ago

lil' bump on the above

melvin-bot[bot] commented 10 months ago

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

aimane-chnaif commented 10 months ago

@Pujan92 your textBreakStrategy solution doesn't work for me. I tested on various android devices.

aimane-chnaif commented 10 months ago

Can everyone update proposals based on latest codebase? No satisfactory proposals yet

manjesh-yadav commented 10 months ago

@aimane-chnaif Have you tried my proposal? it's working and up to date

aimane-chnaif commented 10 months ago

@aimane-chnaif Have you tried my proposal? it's working and up to date

I don't like your solution.

ahmedGaber93 commented 10 months ago

Proposal

Updated @aimane-chnaif

melvin-bot[bot] commented 10 months ago

@adelekennedy @aimane-chnaif this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

aimane-chnaif commented 10 months ago

Still open for better solution

Pujan92 commented 10 months ago

Proposal

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

Android - Title is not rendered fully in the available space.

What is the root cause of that problem?

Seems the child View with flexRow here not having the full width automatically all the time even the child Text is long when the textStrategy is highQuality. https://github.com/Expensify/App/blob/7490ea6becd0ba87909dd3223428cdde05370ca3/src/components/LHNOptionsList/OptionRowLHN.js#L190

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

As the TextPill is removed now from the row we can take out the extra View which seems not required now. With that the parent View already has contentContainerStyles(flex1) for the full available width. https://github.com/Expensify/App/blob/7490ea6becd0ba87909dd3223428cdde05370ca3/src/components/LHNOptionsList/OptionRowLHN.js#L190

For focus priority mode we want to allow the DisplayName to take width as per the content, to achieve that we need to remove the class styles.optionDisplayNameCompact and add styles.flexShrink0.

https://github.com/Expensify/App/blob/f638162c899795821e8d6fa68735aa47fa6e2aa1/src/components/LHNOptionsList/OptionRowLHN.js#L84

Result ![Screenshot_1689259459](https://github.com/Expensify/App/assets/14358475/600a50f7-2dde-4590-ac9b-6a8703bc1f97)
Pujan92 commented 10 months ago

@Pujan92 your textBreakStrategy solution doesn't work for me. I tested on various android devices.

Yes, while posting it was working that time. maybe that time the parent View is taking available width considering the Pill also exists. But now we removed the TextPill, I made a new proposal here.

aimane-chnaif commented 10 months ago

@Pujan92 can you please test on all 6 platforms?

ahmedGaber93 commented 10 months ago

Still open for better solution

@aimane-chnaif are you mean better than using flex to take the full wide available or how and where flex will write?

we can set flex in many places, and all can pass it to DisplayNames textStyles

as i describe in my proposal change flexGrow: 0, here to be flexGrow: 1, or remove it and use flex: 1 https://github.com/Expensify/App/blob/797298e272bc0867c15dd3e1c76293a0e9009503/src/styles/styles.js#L1401-L1406

or remove optionDisplayNameCompact and add styles.flex1

const displayNameStyle = StyleUtils.combineStyles([styles.optionDisplayName, styles.pre, styles.flex1, ...textUnreadStyle], props.style);

Here https://github.com/Expensify/App/blob/531dba82e00eb95d9c03533006b8ef3365a258ac/src/components/LHNOptionsList/OptionRowLHN.js#L84

aimane-chnaif commented 10 months ago

We can simplify code after removing pill

ahmedGaber93 commented 10 months ago

ok i will update my proposal to remove optionDisplayNameCompact and add styles.flex1 
 it the same as my current proposal but it now more simple.

const displayNameStyle = StyleUtils.combineStyles([styles.optionDisplayName, styles.pre, styles.flex1, ...textUnreadStyle], props.style);
ahmedGaber93 commented 10 months ago

Proposal

Updated

Pujan92 commented 10 months ago
  • both priority modes (Most recent / #focus)

@aimane-chnaif my current solution is not working as expected for both modes. I will check and update my proposal if I am able to find the solution. But on checking with main branch I am seeing that issue already there where the last message shows even the display name is longer(not the same has been replicated for the web).

Main Branch SS

Screenshot_1689597623

Screenshot 2023-07-17 at 6 21 27 PM
adelekennedy commented 10 months ago

We have some updated proposals to review - not overdue as we're just back from the weekend melvin

melvin-bot[bot] commented 10 months ago

@adelekennedy, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

aimane-chnaif commented 10 months ago

Still awaiting proposals which meet https://github.com/Expensify/App/issues/21219#issuecomment-1634394582

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

@adelekennedy @aimane-chnaif this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

Thanks!

melvin-bot[bot] commented 10 months ago

Current assignee @aimane-chnaif is eligible for the Internal assigner, not assigning anyone new.

melvin-bot[bot] commented 10 months ago

Upwork job price has been updated to $2000

adelekennedy commented 10 months ago

doubling to get more proposals

ahmedGaber93 commented 10 months ago

@aimane-chnaif what do you think of my proposal? I think the result is as expected for both priority modes (Most recent / #focus)

Most recent ![Screenshot 2023-07-21 at 1 18 42 AM](https://github.com/Expensify/App/assets/41129870/6855be4e-2c3a-4315-995a-6d3018af34f0)
#focus ![Screenshot 2023-07-21 at 1 19 42 AM](https://github.com/Expensify/App/assets/41129870/4eaeca41-e40a-4b38-99e7-612922832d69)
aimane-chnaif commented 9 months ago

@aimane-chnaif what do you think of my proposal? I think the result is as expected for both priority modes (Most recent / #focus)

Still looking for more simplified solution

manjesh-yadav commented 9 months ago

Proposal 2

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

Android - Title is not rendered fully in the available space.

What is the root cause of that problem?

It is Android-style word-breaking IOS work differently, so we found two different designs in the screenshot.

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

As the TextPill is removed now from the code we have now the advantage to take the full available width by width 100% or flex1 property in Most resent mode only

I suggest this snippet in file

<View style={props.viewMode === CONST.OPTION_MODE.DEFAULT ? styles.flex1 : null}>
            <Text
                accessibilityLabel={props.accessibilityLabel}
                style={props.textStyles}
                numberOfLines={props.numberOfLines}
            >
                {props.fullTitle}
            </Text>
        </View>

We need to add props in the file

<DisplayNames
    accessibilityLabel={translate('accessibilityHints.chatUserDisplayNames')}
    fullTitle={optionItem.text}
    displayNamesWithTooltips={optionItem.displayNamesWithTooltips}
    tooltipEnabled
    numberOfLines={1}
    textStyles={displayNameStyle}
+    viewMode={props.viewMode}
    shouldUseFullTitle={
        optionItem.isChatRoom || optionItem.isPolicyExpenseChat || optionItem.isTaskReport || optionItem.isThread || optionItem.isMoneyRequestReport
    }
/>
Result Video https://github.com/Expensify/App/assets/70934016/4fa668cb-9e84-4e3a-91ca-739d9a0b0c0e **Most resent mode** ![Screenshot_1690252912](https://github.com/Expensify/App/assets/70934016/778a70dc-2559-4f73-a552-cd253f03b8da) **Focus Mode** ![Screenshot_1690252926](https://github.com/Expensify/App/assets/70934016/07d6498b-7565-4369-b6f2-392fcfab606b)

What alternative solutions did you explore? (Optional)

Proposal 1 is still valid I know it is a hack but works as this is Android only problem. it is a valid proposal if we have any problem while setting width full or flex1 like before it is

adelekennedy commented 9 months ago

Not overdue - we have one more proposal to review, however @aimane-chnaif do you think we'll need to increase the price on this one

adelekennedy commented 9 months ago

pending proposal review from @aimane-chnaif

aimane-chnaif commented 9 months ago

reviewing today