Skip to content

Create super wide RHP modal to display expense reports when accessed via Reports page or report previews#73731

Merged
mountiny merged 75 commits intoExpensify:mainfrom
software-mansion-labs:nav/swrhp
Nov 21, 2025
Merged

Create super wide RHP modal to display expense reports when accessed via Reports page or report previews#73731
mountiny merged 75 commits intoExpensify:mainfrom
software-mansion-labs:nav/swrhp

Conversation

@WojtekBoman
Copy link
Contributor

@WojtekBoman WojtekBoman commented Oct 29, 2025

Explanation of Change

Super Wide RHP

This PR introduces a third width of RHP called Super Wide RHP.

The maximum width of this RHP is 1260px.

This type of RHP is available only for the following pages in the app:

  • SCREENS.EXPENSE_REPORT_RHP (e/:reportID) - it's a new page added to the app. It's responsible for displaying expense reports in super wide / wide RHP in the Inbox tab
  • SCREENS.SEARCH.MONEY_REQUEST_REPORT (search/r/:reportID)

Super wide RHP is displayed for these pages only if the open RHP has more than one visible transaction, otherwise these pages are opened in Wide RHP.

Overlays

There are two levels of nesting in RHP:

  1. RightModalNavigator displays ModalStackNavigators (RHP flows).
  2. ModalStackNavigators contain screens displayed in RHP.

After adding the third RHP width, it became necessary to add a third overlay displayed when we overlap Super Wide RHP -> Wide RHP -> RHP.

There are two levels of nesting in RHP:

  1. Right Modal Navigator displays ModalStackNavigators (RHP flows).
  2. ModalStackNavigators contain screens displayed in RHP.

This information is important for correctly adding a new overlay.

When a new overlay is added, it is needed to be adjusted in 2 files:

  • src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx

    Here, an overlay occupying the space outside the screen displayed in RHP must be added, when clicking on this overlay, the screen in RHP is closed.

  • src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx

    In case 2 or more RHPs of different widths are displayed, the RHP should also be added here.

    In RightModalNavigator, an overlay is shown from the left edge of the screen to the edge of the screen displayed as the modal. In ModalStackNavigator, the overlay should be displayed below the currently displayed modal. This way, when opening another modal, you can see that there's also an overlay underneath it.

More information about how overlays are displayed and their positioning can be found directly in the comments in the files mentioned above.

Fixed Issues

$ #71821
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Initial conditions:
Create a report containing at least two expenses.

Test 1

  1. Go to the Reports page in the Reports tab.
  2. Click on the report you created.
  3. Verify that it opens as a super wide RHP, no style bugs appear, the overlay works correctly, the backButton returns you back, and there are no other issues.

Test 2

  1. Add two more reports: one empty, and one containing a single expense.
  2. Go to the Reports page in the Reports tab.
  3. Click on any report.
  4. Switch between the reports you created using the arrows in the top-right corner.
  5. Verify that:
  • the report with one transaction displays as a wide RHP,
  • the empty report also displays as a wide RHP (but without a receipt),
  • when switching between reports, all styles update correctly,
  • and the RHP sizes change depending on the number of transactions (0, 1, >1).

Test 3

  1. Go to the Reports page in the Reports tab.
  2. Open a report with more than one transaction.
  3. Click on one of the expenses.
  4. Verify that a wide RHP opens and overlays are displayed correctly.
  5. Close the wide RHP by clicking on the overlay or using the backButton.
  6. Verify that the wide RHP closed correctly, the overlay disappeared, and the UI returned to the super wide RHP.

Test 4

  1. Go to the Inbox page and find a report with multiple expenses.
  2. Click on it.
  3. Verify that the SWRHP opens, nothing is broken, and everything functions correctly.

Test 5

  1. Go to the Reports page in the Reports tab.
  2. Open a report with more than one transaction.
  3. Click on one of the expenses.
  4. Click the More button in the wide RHP and choose an option that opens an RHP (e.g., Info).
  5. Verify that the RHP opened correctly, overlays reflect the proper structure, and nothing is broken.

Test 6

  1. Go to the Reports page in the Reports tab.
  2. Open a report with more than one transaction.
  3. Click on one of the expenses.
  4. Click the link below the wide RHP title that leads back to the parent report.
  5. Verify that the wide RHP correctly returns back to the parent super wide RHP.

Offline tests

QA Steps

Same as tests

  • 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 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.
  • 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.

Screenshots/Videos

Android: Native
Screen.Recording.2025-11-20.at.10.16.43.mp4
Android: mWeb Chrome
Screen.Recording.2025-11-18.at.09.01.46.mov
iOS: Native
Screen.Recording.2025-11-17.at.21.47.55.mp4
Screen.Recording.2025-11-17.at.21.45.42.mp4
iOS: mWeb Safari
Screen.Recording.2025-11-17.at.21.51.27.mp4
MacOS: Chrome / Safari
Screen.Recording.2025-11-18.at.16.47.43.mov
MacOS: Desktop

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

🚧 @trjExpensify has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@mountiny
Copy link
Contributor

@ZhenjaHorbach Feel free to start on some early testing!

setShouldRenderThirdOverlay(true);
Animated.timing(thirdOverlayProgress, {
toValue: 1,
duration: 300,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's better to use constants for that

Comment on lines +138 to +149
{!isSmallScreenWidth && shouldRenderSecondaryOverlay && route.name === SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT && !!isWideRhpFocused && !isFocused ? (
<Overlay
progress={secondOverlayProgress}
positionLeftValue={modalStackOverlayWideRHPWidth}
/>
) : null}
{!isSmallScreenWidth && shouldRenderSecondaryOverlay && route.name === SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT && !isWideRhpFocused && !isFocused ? (
<Overlay
progress={secondOverlayProgress}
positionLeftValue={modalStackOverlaySuperWideRHPWidth}
/>
) : null}
Copy link
Contributor

@ZhenjaHorbach ZhenjaHorbach Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{!isSmallScreenWidth &&
    shouldRenderSecondaryOverlay &&
    route.name === SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT &&
    !isFocused && (
        <Overlay
            progress={secondOverlayProgress}
            positionLeftValue={
                isWideRhpFocused
                    ? modalStackOverlayWideRHPWidth
                    : modalStackOverlaySuperWideRHPWidth
            }
        />
    )}

right: 0,
position: 'absolute',
overflow: 'hidden',
width: shouldUseNarrowLayout ? '100%' : (animatedWidth as unknown as number),
Copy link
Contributor

@ZhenjaHorbach ZhenjaHorbach Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's bad practice to use unknown

// Progress of the secondary overlay, the one covering wider RHP screen
secondOverlayProgress: Animated.Value;

// Progress of the secondary overlay, the one covering wider RHP screen
Copy link
Contributor

@ZhenjaHorbach ZhenjaHorbach Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Progress of the tertiary overlay, the one covering wider RHP screen

// If the secondary overlay should be rendered. This value takes into account the delay of closing transition.
shouldRenderSecondaryOverlay: boolean;

// If the secondary overlay should be rendered. This value takes into account the delay of closing transition.
Copy link
Contributor

@ZhenjaHorbach ZhenjaHorbach Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// If the tertiary overlay should be rendered. This value takes into account the delay of closing transition.

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure we add unit tests for all the hooks and helper methods added here but since we are trying to push this one ahead for release for customers asap, lets get this to staging. Jason, @ZhenjaHorbach and design team have all tested it and generally the flows work good, no major issues found so lets see if QA can find any

Comment on lines +170 to +172
const {shouldUseNarrowLayout: shouldUseNarrowLayoutByDefault, isSmallScreenWidth} = useResponsiveLayout();
const {superWideRHPRouteKeys} = useContext(WideRHPContext);
const shouldUseNarrowLayout = shouldUseNarrowLayoutByDefault && (superWideRHPRouteKeys.length === 0 || isSmallScreenWidth);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this should be abstracted out

<Animated.View style={styles.wideRHPMoneyRequestReceiptViewContainer}>
<ScrollView contentContainerStyle={styles.wideRHPMoneyRequestReceiptViewScrollViewContainer}>
<MoneyRequestReceiptView
allReports={allReports}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but I dont understand why this component should be getting full reports collection

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the components needs parent and chat report so we could have just passed the two, I believe @adamgrzybowski is in blame so ideally SWM can take a look at this

Comment on lines +744 to +746
markReportIDAsMultiTransactionExpense(reportID);
} else {
unmarkReportIDAsMultiTransactionExpense(reportID);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these be added to the useCallback deps?

);
};

function getCurrentWideRHPKeys(allWideRHPKeys: string[], lastVisibleRHPRouteKey: string | undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add plain English explanation for this one, please?

if (!lastRHPRoute) {
return [];
}
const getIsSuperWideRHPBelowFocusedScreen = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add a comment here explaining what the value represents/ what it is for in plain english

[allSuperWideRHPRouteKeys],
);

const getIsWideRHPBelowFocusedScreen = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add a comment here explaining what the value represents/ what it is for in plain english

}

const newKey = route.key;
// If the key is in the array, don't add it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If the key is in the array, don't add it.
// If the key is in the array, don't add it.

@mountiny mountiny merged commit ccf5583 into Expensify:main Nov 21, 2025
31 checks passed
@mountiny
Copy link
Contributor

A better safe than sorry revert PR here

@mountiny mountiny mentioned this pull request Nov 21, 2025
54 tasks
@trjExpensify
Copy link
Contributor

I'm going to have to start calling you WARP. ZeroTrust

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.2.62-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@dangrous
Copy link
Contributor

dangrous commented Nov 21, 2025

Is #75750 a bug or new behavior? Almost certainly comes from here. Thanks!

EDIT: Yep - it's this commit, if that's useful - e7bbab5

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.2.62-5 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

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.