Skip to content

Conversation

@perunt
Copy link
Contributor

@perunt perunt commented Jul 16, 2025

Explanation of Change

  • Switched to InvertedFlatList for better chat-like scrolling behavior
  • Updated scroll methods from scrollToEnd to scrollToBottom to match inverted list behavior
  • Simplified view hierarchy and improved layout structure

Fixed Issues

$ #64085 (comment)
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Precondition:

  • Have at least a workspace
  1. Launch Expensify app
  2. Open FAB > Create report
  3. Send a message in the empty report
  4. Long tap on the message > Edit comment
  5. Tap outside the composer to close the keyboard
  6. Tap on the edit composer
  7. Note that the report view does not scroll down to reveal the edit composer
  8. Type @ or :sm in the edit composer

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • If new assets were added or existing ones were modified, I verified that:
  • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
  • The assets load correctly across all supported platforms.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-07-16.at.14.38.09.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari Screenshot 2025-07-16 at 14 47 28
MacOS: Desktop image

@perunt perunt marked this pull request as ready for review July 17, 2025 09:55
@perunt perunt requested a review from a team as a code owner July 17, 2025 09:55
@melvin-bot melvin-bot bot requested review from shubham1206agra and removed request for a team July 17, 2025 09:55
@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2025

@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@perunt
Copy link
Contributor Author

perunt commented Jul 17, 2025

@shubham1206agra I replaced FlatList with our custom InvertedFlatList for better chat-like scrolling behavior. So now it uses the same scroll element across the fresh report and regular chat

@perunt
Copy link
Contributor Author

perunt commented Jul 25, 2025

@shubham1206agra
Copy link
Contributor

Screen.Recording.2025-07-29.at.5.44.03.PM.mov

@perunt The comment is getting hidden behind menu.

@chrispader
Copy link
Contributor

@shubham1206agra since @perunt is OOO right now, i'll try to give this PR a look within the next few days.

@perunt
Copy link
Contributor Author

perunt commented Aug 11, 2025

I'm back on this. I see that this issue reproduces with the closed keyboard only. Now I see that this happens since we have messages positioned at the top and not at the bottom as in the rest of the app. Will fix it

@perunt
Copy link
Contributor Author

perunt commented Aug 12, 2025

@shubham1206agra, now it works as expected

@shubham1206agra
Copy link
Contributor

shubham1206agra commented Aug 12, 2025

Screen.Recording.2025-08-12.at.9.07.23.PM.mov

@perunt BUG: Sometimes, I am unable to scroll to the bottom in mWeb Safari

Edit - This is repro on main

@Kureev
Copy link
Contributor

Kureev commented Nov 3, 2025

@chrispader the suggestion behaves correctly (e.g. always on top, aligned above the composer)

@chrispader
Copy link
Contributor

@trjExpensify @mountiny @shubham1206agra in this case, are we good to continue with the review and merge of this PR?

@shubham1206agra
Copy link
Contributor

Screen.Recording.2025-11-03.at.7.17.26.PM.mov

The problem with the PR is that the impact of changes goes beyond the flow we are trying to address, and now we can see such bugs, like missing keyboard animation, inconsistent padding when opening modal in different cases, etc. So, my suggestion is to revert #54764 safely before doing anything (I know it's difficult, but we should create an issue for this first and hold this PR on that)

cc @mountiny

@mountiny
Copy link
Contributor

mountiny commented Nov 3, 2025

I just think we should mimic how it works in Slack, that is sometimes the content also moves down when the keyboard closes under the bottom sheet modal which avoids the jumps in the video from Shubham
https://github.com/user-attachments/assets/5c297287-a09d-4b1b-be4a-5f5e1e750e4a

@mountiny
Copy link
Contributor

mountiny commented Nov 3, 2025

I think it would make sense to try to revert the changes from the Kiryls Pr if we agree we would like to align more on the Slack keyboard behaviour which imho is very smooth and good UI/ UX

@mountiny
Copy link
Contributor

mountiny commented Nov 3, 2025

cc @trjExpensify @Expensify/design for buddy check, not sure if this would need bigger slack post or no

@dubielzyk-expensify
Copy link
Contributor

From my end (UX), the content underneath the modal shouldn't be altered in any way. The problem that I see is that RN doesn't give you the stuff that native gives you for free (which is what the Slack video shows). We have a lack of animations in the video above but the behavior in the video from a positioning standpoint isn't bad, it's just the animation and lag imo.

@trjExpensify
Copy link
Contributor

the content underneath the modal shouldn't be altered in any way.

I agree, I don't know or recall why that was done. 👍

@JmillsExpensify
Copy link
Contributor

Agreed. I don't recall why/when that was done, nor do I think the content underneath the modal should be altered anyway.

@dannymcclain
Copy link
Contributor

I'm with all of you as well.

@mountiny
Copy link
Contributor

mountiny commented Nov 4, 2025

Thanks for chiming in everyone, so the next steps would be that @chrispader would try to revert the PR from Kiryl. Then we could adjust this PR to the desired behaviour

@joekaufmanexpensify
Copy link
Contributor

@chrispader are you actively working on that? What are the next steps?

@Kureev
Copy link
Contributor

Kureev commented Nov 10, 2025

I'm working on that atm. Seems the next step would be to try to revert the original PR. I'll try to start tomorrow morning

@Kureev
Copy link
Contributor

Kureev commented Nov 17, 2025

After reviewing Slack's behavior and comparing it with our current implementation, I think we should align with Slack's approach instead of introducing a separate inline TextField inside the message list.

Right now, Expensify replaces the message with a second TextField when editing. That feels unintuitive, adds extra UI complexity, and results in odd interactions when the keyboard + composer overlap the editable area.

Slack keeps the message list unchanged and simply reuses the main composer for editing. The edited message appears above the composer, and the content shifts only when editing is active. This flow feels simpler, more predictable, and avoids layout issues.

If we want a consistent UX, I’d suggest we switch to the same strategy:

  • No additional TextField inside the list
  • Reuse the composer for editing
  • Surface the “message being edited” indicator above the composer
  • Let design weigh in on whether the edited message should float above the composer (Slack doesn’t strictly enforce this, so it may be optional)

cc @chrispader

ScreenRecording_11-17-2025.15-31-52_1.MP4

@Kureev
Copy link
Contributor

Kureev commented Nov 17, 2025

cc @Expensify/design

@chrispader
Copy link
Contributor

If we want, we could still move the currently edited message into view. Slack doesn't do it, but i'm not sure what i personally prefer in terms of UX.

Re-using the composer for editing would definitely make handling layout much easier and removes all sorts of bugs, like layout shifts or janky behavior, when the state for editing messages changes at different times for different parts of the UI.

@dannymcclain
Copy link
Contributor

I think I'm down to reuse the composer for editing—that makes sense to me. But I feel like I kinda need to see it to fully understand 🫣

But that might also resolve this behavior I've thought was weird for a long time: being able to edit multiple messages at once. I just don't really understand why we'd ever need this functionality—I've never seen it anywhere else.
CleanShot 2025-11-17 at 09 01 04@2x

@chrispader
Copy link
Contributor

chrispader commented Nov 17, 2025

But that might also resolve this behavior I've thought was weird for a long time: being able to edit multiple messages at once. I just don't really understand why we'd ever need this functionality—I've never seen it anywhere else.

I agree, this is not really a good practice. I don't think there is a use-case where a user would need to edit multiple messages at once, rather than consecutively

@dannymcclain if we go for this approach, do you think you could sketch some designs for the composer in the new "editing message" state?

@dannymcclain
Copy link
Contributor

if we go for this approach, do you think you could sketch some designs for the composer in the new "editing message" state?

I feel like we could make it look identical to the current editing style, right? Just instead of being inline with the message you're editing, it would be at the bottom (where the composer always lives).

@dubielzyk-expensify
Copy link
Contributor

I don't disagree that the inline thing isn't weird, but also Slack does the inline composer for certain areas:

CleanShot 2025-11-18 at 10 11 01@2x

I think I'd prefer to fix the bug outlined instead of tweaking the editing behavior. Mostly because if you edit a message I think it might be nice to give an indication of what message you're editing etc and it just ends up in a new area where we need to think about the implications and testing.

cc @Expensify/product-pr in case they have any strong feelings.

@dannymcclain
Copy link
Contributor

I think I'd prefer to fix the bug outlined instead of tweaking the editing behavior.

Totally fair. I'm good with this approach as well. 👍

@chrispader
Copy link
Contributor

chrispader commented Nov 19, 2025

I don't disagree that the inline thing isn't weird, but also Slack does the inline composer for certain areas:

Yes, i see that they do the inline message editing on web/desktop, where we usually have more screen real estate. On native, it feels more intuitive to re-use the composer for editing messages.

I think ideally, we would have inline message editing on web/desktop and on native we would edit a message through the composer, but i understand that this would add additional complexity and would require a major refactor of the composer component.

Personally, i would prefer just using the regular composer for all, which makes all the scrolling/positioning easier and also prevents the issue with multiple active 'editing inputs' mentioned by @dannymcclain

@mountiny
Copy link
Contributor

I am afraid this has been extensively discussed in the past and I believe we wanted to keep the multiple edit composers in place. I dont think we should just change this without P/S and broader discussion in slack also given the cross paltform philosophy so it should behave same on web and on native.

What is holding us back from reverting that original PR behaviour and proceeding with the UX we agreed on without changing this, it feels like separate topic to me and slows us down

@mountiny
Copy link
Contributor

mountiny commented Jan 1, 2026

@chrispader @Kureev Can we close this PR? Are we proceeding in different branch?

@chrispader
Copy link
Contributor

@chrispader @Kureev Can we close this PR? Are we proceeding in different branch?

@mountiny yes, i think this can be closed as we're continuing to work on this in #76741

@mountiny mountiny closed this Jan 8, 2026
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.

10 participants