App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Chat - In mWeb, text is centered but in Android text is dropping down

Open IuliiaHerets opened this issue 1 year ago • 17 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: V9. 0.64-3 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y Issue reported by: Applause Internal Team

Action Performed:

  1. Open both mWeb and app
  2. Open a chat
  3. Enter > # hai

Expected Result:

In mWeb, text is centered but in Android text must not drop down.

Actual Result:

In mWeb, text is centered but in Android text is dropping down.

Workaround:

Unknown

Platforms:

  • [x] Android: Standalone
  • [x] Android: HybridApp
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Standalone
  • [ ] iOS: HybridApp
  • [ ] iOS: mWeb Safari
  • [ ] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/d37b1dac-6824-423c-bc2a-bdf2b921ef3e

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021863815952930925048
  • Upwork Job ID: 1863815952930925048
  • Last Price Increase: 2024-12-10
Issue OwnerCurrent Issue Owner: @alitoshmatov

IuliiaHerets avatar Nov 20 '24 15:11 IuliiaHerets

Triggered auto assignment to @alexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Nov 20 '24 15:11 melvin-bot[bot]

Proposal

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

Headings are not vertically centered on Android.

What is the root cause of that problem?

The line height is enlarged on Android to fix overlapping lines.

Screenshot 2024-11-23 at 1 27 58 AM

However, the text is bottom-aligned in MarkdownLineHeightSpan.

Screenshot 2024-11-23 at 1 40 05 AM

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

Fine-tune the fm.ascent, fm.descent, fm.top, fm.bottom properties to vertically center the text. The code below refers to this implementation. It’s not the final version and might need confirmation from the design team.

  @Override
  public void chooseHeight(CharSequence text, int start, int end, int spanstartv, int lineHeight, Paint.FontMetricsInt fm) {
    float leading = mLineHeight - ((-fm.ascent) + fm.descent);
    fm.ascent -= (int)Math.ceil(leading / 2.0);
    fm.descent += (int)Math.floor(leading / 2.0);

    // The top of the first line, and the bottom of the last line, may influence bounds of the
    // paragraph, so we match them to the text ascent/descent. It is otherwise desirable to allow
    // line boxes to overlap (to allow too large glyphs to be drawn outside them), so we do not
    // adjust the top/bottom of interior line-boxes.
    if (start == 0) {
      fm.top = fm.ascent;
    }
    if (end == text.length()) {
      fm.bottom = fm.descent;
    }
  }

Screenshots

Before After
Before After

What alternative solutions did you explore? (Optional)

N/A

QichenZhu avatar Nov 22 '24 12:11 QichenZhu

I didn't get to test this one before going OOO. This week, I'll try to log in to confirm the next steps.

alexpensify avatar Nov 25 '24 20:11 alexpensify

@alexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Nov 29 '24 09:11 melvin-bot[bot]

No update

alexpensify avatar Nov 29 '24 21:11 alexpensify

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

melvin-bot[bot] avatar Dec 03 '24 05:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 03 '24 05:12 melvin-bot[bot]

@alitoshmatov - I was able to replicate the experience. Can you please verify if this proposal will fix the issue? Thanks!

alexpensify avatar Dec 03 '24 05:12 alexpensify

@alexpensify @alitoshmatov 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!

melvin-bot[bot] avatar Dec 04 '24 09:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 06 '24 09:12 melvin-bot[bot]

@QichenZhu Are you suggestion that this should be fixed in react-native-live-markdown

alitoshmatov avatar Dec 06 '24 21:12 alitoshmatov

@alitoshmatov That’s correct.

QichenZhu avatar Dec 06 '24 22:12 QichenZhu

@alexpensify, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Dec 10 '24 09:12 melvin-bot[bot]

📣 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] avatar Dec 10 '24 16:12 melvin-bot[bot]

@tomekzaw Can you check out this issue where heading in android is pushed down noticeably. And we have this proposal which suggests to update height calculation for android.

I suspect this issue is related to https://github.com/Expensify/react-native-live-markdown/issues/522

What do you think

alitoshmatov avatar Dec 10 '24 19:12 alitoshmatov

@alitoshmatov Indeed, this should be fixed on Android with https://github.com/Expensify/react-native-live-markdown/pull/535 telling from the screenshots in https://github.com/Expensify/react-native-live-markdown/pull/535#issuecomment-2525081847.

Looks like we need to center text vertically on iOS (as per this comment https://github.com/Expensify/react-native-live-markdown/pull/535#issuecomment-2525081489) and we're good to go.

tomekzaw avatar Dec 10 '24 20:12 tomekzaw

Great. I guess we can hold this issue then.

@alexpensify Can you update the issue to hold for https://github.com/Expensify/react-native-live-markdown/pull/535

alitoshmatov avatar Dec 10 '24 23:12 alitoshmatov

Done - thanks for flagging

alexpensify avatar Dec 12 '24 05:12 alexpensify

Heads up, I will be offline until Wednesday, December 18, 2024, and will not actively watch over this GitHub during that period.

If this GitHub requires an urgent update, please ask for help in the #expensify-open-source Slack Room. If the inquiry can wait, I'll review it when I return online.

alexpensify avatar Dec 15 '24 05:12 alexpensify

Weekly Update: https://github.com/Expensify/react-native-live-markdown/pull/535 is still under review

alexpensify avatar Dec 20 '24 05:12 alexpensify

Weekly Update: https://github.com/Expensify/react-native-live-markdown/pull/535 is still under review

alexpensify avatar Dec 22 '24 04:12 alexpensify

Weekly Update: Same as last week

alexpensify avatar Dec 30 '24 22:12 alexpensify

Weekly Update: Waiting on https://github.com/Expensify/react-native-live-markdown/pull/535

alexpensify avatar Jan 09 '25 00:01 alexpensify

Weekly Update: https://github.com/Expensify/react-native-live-markdown/pull/535 is still under review

alexpensify avatar Jan 17 '25 22:01 alexpensify

Weekly update: same as last week

alexpensify avatar Jan 23 '25 20:01 alexpensify

Weekly Update: No movement in the PR

alexpensify avatar Jan 30 '25 20:01 alexpensify

Just FYI, I wasn't actively working on this PR because I was hoping that RN 0.76 upgrade would fix this. Unfortunately this is not the case so I'll need to resume working on this PR once I complete my current tasks.

tomekzaw avatar Jan 31 '25 14:01 tomekzaw

Oh no, thank you for the update. Keep us posted when you have a better timeline to get to this one. Thanks!

alexpensify avatar Feb 13 '25 01:02 alexpensify

Weekly Update: Waiting for @tomekzaw to have a free cycle

alexpensify avatar Feb 22 '25 00:02 alexpensify

Weekly Update: Same

alexpensify avatar Feb 28 '25 23:02 alexpensify