App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Chat - Height of edit field is different for mWeb and native app @thesahindia

Open kbecciv opened this issue 2 years ago โ€ข 18 comments

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


Action Performed:

  1. Launch the app
  2. Navigate to any chat
  3. Send a message
  4. Long press on it > Edit
  5. Keep pressing enter and check the max height

Expected Result:

The height should be consistent

Actual Result:

The height isn't consistent

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.2.12.2

Reproducible in staging?: Yes

Reproducible in production?: Yes

Email or phone of affected tester (no customers): any

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

Notes/Photos/Videos: Any additional supporting documentation Screenshot_20220926_182516 Screenshot_20220926_182452

Expensify/Expensify Issue URL:

Issue reported by: @thesahindia

Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1664197609260269

View all open jobs on GitHub

kbecciv avatar Oct 10 '22 00:10 kbecciv

Triggered auto assignment to @strepanier03 (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

melvin-bot[bot] avatar Oct 10 '22 00:10 melvin-bot[bot]

Proposal

We need to keep the max lines 6 for isSmallScreenWidth and 16 when it's false

https://github.com/Expensify/App/blob/f84651934726d25e720047839c4ed750eea111b6/src/pages/home/report/ReportActionItemMessageEdit.js#L201

maxLines={this.props.isSmallScreenWidth ? 6 : 16}

we can keep add them in CONST.js

I think we should also check if it's a touch screen by canUseTouchScreen() we should also check the same here https://github.com/Expensify/App/blob/f84651934726d25e720047839c4ed750eea111b6/src/pages/home/report/ReportActionCompose.js#L144

Puneet-here avatar Oct 10 '22 07:10 Puneet-here

Triage notes:

This issue is repeatable.

Tested this on my Android using the new.expensify mobile app.

I was able to have a height much greater than 6 or 16, it seemed near infinite and I could keep increasing the height repeatedly.

2022-10-10_13-22-47

strepanier03 avatar Oct 10 '22 20:10 strepanier03

I think even with a proposal, this should go to Eng according ot the linked SO. There's multiple moving parts to our transition to BZ and I think this Triage process will go away in it's current form soon, a DD was just released for reviews regarding it.

Based on this thread in Slack, I think I should still triage as normal for now, with this going to eng who can put the external label on it as needed??

strepanier03 avatar Oct 10 '22 20:10 strepanier03

Triggered auto assignment to @roryabraham (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

melvin-bot[bot] avatar Oct 10 '22 20:10 melvin-bot[bot]

Triggered auto assignment to @sonialiap (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

melvin-bot[bot] avatar Oct 12 '22 18:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 12 '22 18:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 12 '22 18:10 melvin-bot[bot]

@Puneet-here's proposal looks good to me, but I'll let @rushatgabhane buddy-check it. I'm not sure if we need to check canUseTouchScreen or if just screen width is sufficient here.

roryabraham avatar Oct 12 '22 18:10 roryabraham

@Puneet-here question: In message edit, why is the max line height 6 for native? Shouldn't it be 16 because we're setting it over here?

https://github.com/Expensify/App/blob/f84651934726d25e720047839c4ed750eea111b6/src/pages/home/report/ReportActionItemMessageEdit.js#L201

Also, I'm curious why we should use canUseTouchScreen(), is it because it's mWeb only?

rushatgabhane avatar Oct 17 '22 14:10 rushatgabhane

@Puneet-here question: In message edit, why is the max line height 6 for native? Shouldn't it be 16 because we're setting it over here?

It's probably because of the styling

Also, I'm curious why we should use canUseTouchScreen(), is it because it's mWeb only?

I think it's good to use canUseTouchScreen() and isSmallScreenWidth because this way the height of composer won't change for desktop when we decrease the screen size

Puneet-here avatar Oct 17 '22 17:10 Puneet-here

It's probably because of the styling

@Puneet-here I think we need to dive deeper then. Like which specific style is changing maxLine behavior for native only?

I think it's good to use canUseTouchScreen() and isSmallScreenWidth because this way the height of composer won't change for desktop when we decrease the screen size

Oh, I get you. Desktop app is rarely resized to small width. And I think it's okay to change the height on desktop when the screen size is reduced to simplify the code a bit.

rushatgabhane avatar Oct 18 '22 04:10 rushatgabhane

@Puneet-here I think we need to dive deeper then. Like which specific style is changing maxLine behavior for native only?

I was a little bit busy, I will check this today.

Puneet-here avatar Oct 20 '22 21:10 Puneet-here

Apologies, I just realised that I had closed the tab without really pressing the comment button earlier.

So we have platform specific file for composer and because we are passing maxHeight, passing maxLines has no effect on it https://github.com/Expensify/App/blob/83676c1036299ffecbf82f4b829a7f8cbd741cd7/src/components/Composer/index.ios.js#L104 https://github.com/Expensify/App/blob/83676c1036299ffecbf82f4b829a7f8cbd741cd7/src/components/Composer/index.android.js#L99

Puneet-here avatar Oct 24 '22 21:10 Puneet-here

You're right! maxLines internally sets the numberOfLines. And numberOfLines is an android only prop (docs).

So for Native, we're using maxHeight.

We need to keep the max lines 6 for isSmallScreenWidth and 16 when it's false

Sounds good.

@roryabraham @Puneet-here's proposal LGTM! :) ๐ŸŽ€ ๐Ÿ‘€ ๐ŸŽ€ C+ reviewed

rushatgabhane avatar Oct 26 '22 03:10 rushatgabhane

@roryabraham do you think a cleaner solution would be to implement maxLines for native using maxHeight?

This way, Composer will have a single interface to change it's maximum number of lines.

rushatgabhane avatar Oct 28 '22 01:10 rushatgabhane

bump on https://github.com/Expensify/App/issues/11694#issuecomment-1291451773 @roryabraham

rushatgabhane avatar Nov 13 '22 09:11 rushatgabhane

@sonialiap, @rushatgabhane, @roryabraham Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 17 '22 08:11 melvin-bot[bot]

@roryabraham do you think a cleaner solution would be to implement maxLines for native using maxHeight?

I think a cleaner solution would probably be to implement the maxLines prop in React Native for iOS and use maxLines consistently across platforms.

roryabraham avatar Nov 18 '22 14:11 roryabraham

Perfect, thanks @roryabraham

@Puneet-here feel free to submit an update proposal applying this suggestion

rushatgabhane avatar Nov 18 '22 14:11 rushatgabhane

Overall I feel like:

  1. The platform differences of the Composer have diverged more than they should have, such that the differences between the platforms aren't clear
  2. There is a lot of custom logic in the Composer component, much of which is probably intentional, but a lot of the context behind that logic is not very transparent. Some automated tests which cover the behaviors that we expect would go a long way into preserving the intention of the component.
  3. What is even happening with isComposerFullSize?
    • Why do we have three separate values for isFullComposerAvailable, setIsFullComposerAvailable, and isComposerFullSize?
    • isComposerFullSize is actually persisted in Onyx on a report level: https://github.com/Expensify/App/blob/0e147426759c9cf4878479f3ffeb69e54249aeb6/src/pages/home/ReportScreen.js#L341-L343, is that something we actually want to persist between sessions or are we just using that as a way to manage UI state?
    • Do we actually need a separate value for isFullComposerAvailable? It seems like it's just shadowing isComposerFullSize.
  4. It seems like all of this boils down to maxLines, which we could use directly across all platforms if it was implemented in React Native iOS.
  5. Why is maxLines smaller for small screens? Is this because we have a software keyboard that takes up screen height? If so, why don't we determine maxLines based on whether the software keyboard is open, rather than based on platform or screen width?

I think the wisest course of action would be:

  • To do a Full Throttle (FT) or Slack meeting for the Composer component across platforms, to identify the behaviors we expect.
  • (optional, but ideal) Write some automated tests to cover the expected behavior
  • Update the Composer component to address this issue and some of the above concerns with as simple and cross-platform an implementation as possible, implementing maxLines in React Native for iOS if needed.

What do people think?

roryabraham avatar Nov 18 '22 15:11 roryabraham

@sonialiap, @rushatgabhane, @roryabraham Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 22 '22 08:11 melvin-bot[bot]

Didn't have time to do a deep-dive on this myself yet, but I did take the opportunity to do one pass on cleanup of the Composer component in this PR. It's not much, but it's an easy win and a step in the right direction.

Long-term for this specific bug I think we probably want to implement maxLines on iOS as well as Android in RN.

roryabraham avatar Nov 22 '22 08:11 roryabraham

Price doubled ๐Ÿ™Œ

sonialiap avatar Nov 22 '22 09:11 sonialiap

This PR turned out to be not quite ready yet. An upstream fix is needed, but then it will be ready

roryabraham avatar Nov 22 '22 22:11 roryabraham

Following instructions for the weekly update chore:

@roryabraham this is one of the oldest issues in the /App repo. To help us clear out the large backlog of bugs, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is
  • For any that can't, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #bug-zero

tjferriss avatar Nov 23 '22 18:11 tjferriss

Ah, just commented here in thread. Iโ€™m changing the label to Internal and removing Help wanted.

trjExpensify avatar Nov 23 '22 18:11 trjExpensify

@sonialiap, @rushatgabhane, @roryabraham Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Nov 28 '22 08:11 melvin-bot[bot]

Ah, just commented here in thread. Iโ€™m changing the label to Internal and removing Help wanted.

Sorry, I think there was a miscommunication here @trjExpensify. The PR I put up was a step in the right direction, but not a solution to this issue.

Also the upstream fix was merged in our fork, but in the actual react-native-web upstream, the maintainer has stopped accepting pull requests in the VirtualizedList components. I think the plan is to move VirtualizedList into a separate package of React Native. We need to have a conversation about what to do here.

roryabraham avatar Nov 28 '22 19:11 roryabraham