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
3.6k stars 2.93k forks source link

[$250] Android-Navigation bar shows purple color on "Submit an expense,get $250" page in offline mode #53444

Open IuliiaHerets opened 17 hours ago

IuliiaHerets commented 17 hours 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!


Version Number: 9.0.70-0 Reproducible in staging?: Y Reproducible in production?: N If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y Email or phone of affected tester (no customers): applausetester+kh1311020@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  1. Launch ND or hybrid app.
  2. Go offline.
  3. Open FAB > Submit expense.
  4. Enter amount > Next.
  5. Tap "Submit an expense, get $250" banner.

Expected Result:

The device navigation bar will not have purple color.

Actual Result:

The device navigation bar shows purple color on "Submit an expense, get $250" page.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/66b944f1-4b26-49d1-a820-bfbf9ba1ca36

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021864014658060063799
  • Upwork Job ID: 1864014658060063799
  • Last Price Increase: 2024-12-03
Issue OwnerCurrent Issue Owner: @dominictb
github-actions[bot] commented 17 hours ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
IuliiaHerets commented 17 hours ago

Production

https://github.com/user-attachments/assets/ef4ed487-7e07-42d6-bf0c-ab51082ab3c6

melvin-bot[bot] commented 11 hours ago

Triggered auto assignment to @MarioExpensify (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

melvin-bot[bot] commented 11 hours ago

💬 A slack conversation has been started in #expensify-open-source

github-actions[bot] commented 11 hours ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
MarioExpensify commented 11 hours ago

Hardly a deploy blocker. Demoting it.

mohammedmatar commented 10 hours ago

Proposal

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

The problem we're addressing is that the navigation bar color on the ReferralDetailsPage changes unexpectedly when the device goes offline. This creates an inconsistent user experience and doesn't align with the intended design of the page.

What is the root cause of that problem?

The root cause is that the navigation bar color is not being set explicitly for offline scenarios. When the device goes offline, it seems that a default or fallback styling is applied to the navigation bar, causing the unexpected color change.

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

To solve this issue, I've made the following changes:

  1. Updated the usage of the HeaderPageLayout component in ReferralDetailsPage to include the explicit background color for the header:
// ReferralDetailsPage.tsx
headerContainerStyles={[
    styles.staticHeaderImage,
    styles.justifyContentEnd,
    StyleUtils.getBackgroundColorStyle(colors.pink800)
]}.
  1. Modified the theme configuration for SCREENS.REFERRAL_DETAILS to set the backgroundColor[light theme] to colors.productLight100:
    // themes/light.ts
    backgroundColor: colors.productLight100
    }
  2. Modified the theme configuration for SCREENS.REFERRAL_DETAILS to set the backgroundColor[dark theme] to colors.productDark100:
    // themes/dark.ts
    backgroundColor: colors.productDark100
    }

    These changes ensure that the header background color is explicitly set to pink800, while the overall page background is set to productLight100[light theme] & colors.productDark100[dark theme]. This should maintain the correct color scheme even when the device goes offline.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

To prevent reintroducing this issue in the future, we should implement the following automated tests:

  1. Test correct rendering of navigation bar and header colors in online state.
  2. Verify color consistency when the app is in offline state.
  3. Check color stability during transitions between online and offline states.
  4. Test color consistency across different content types (e.g., REFER_FRIEND, SHARE_CODE).
  5. Verify correct colors when navigating to and from the ReferralDetailsPage.
  6. If applicable, test color consistency across different themes (e.g., light and dark mode).
  7. Check color stability during device orientation changes.

What alternative solutions did you explore? (Optional)

I considered using the StatusBar component and useNavBarSettings hook to manage the navigation bar color independently. However, the current solution using headerContainerStyles and updating the theme configuration is more in line with the existing codebase structure and doesn't require additional hooks or components.

The implemented solution maintains consistency with how other pages in the app handle background colors and should resolve the issue of unexpected color changes when offline.

melvin-bot[bot] commented 10 hours ago

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

melvin-bot[bot] commented 10 hours ago

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

Krishna2323 commented 4 hours ago

Edited by proposal-police: This proposal was edited at 2024-12-03 23:56:41 UTC.

Proposal

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

Android-Navigation bar shows purple color on "Submit an expense,get $250" page in offline mode

What is the root cause of that problem?

        <HeaderPageLayout
            title={translate('common.referral')}
            backgroundColor={theme.PAGE_THEMES[SCREENS.REFERRAL_DETAILS].backgroundColor}
            testID={ReferralDetailsPage.displayName}
            onBackButtonPress={() => {
                if (backTo) {
                    Navigation.goBack(backTo as Route);
                    return;
                }
                Navigation.goBack();
            }}
        >
            <Section
                icon={PaymentHands}
                title={contentHeader}
                subtitle={contentBody}
                iconHeight={232}
                iconWidth={589}
                isCentralPane
                titleStyles={[styles.textHeadline, styles.mv2]}
                iconContainerStyles={[styles.staticHeaderImage, styles.justifyContentCenter, {backgroundColor: colors.pink800}, styles.flex1, styles.alignItemsEnd]}
                containerStyles={[styles.pt0, styles.overflowHidden]}
                cardLayout={CARD_LAYOUT.ICON_ON_TOP}
                subtitleStyles={styles.mb6}
            >
                {!shouldShowClipboard && (
                    <View style={[styles.sectionMenuItemTopDescription, styles.ph3]}>
                        <ContextMenuItem
                            isAnonymousAction
                            text={translate('referralProgram.copyReferralLink')}
                            icon={Expensicons.Copy}
                            successIcon={Expensicons.Checkmark}
                            successText={translate('qrCodes.copied')}
                            onPress={() => Clipboard.setString(referralLink)}
                        />
                    </View>
                )}
                <MenuItem
                    wrapperStyle={[styles.mb4, styles.sectionMenuItemTopDescription]}
                    ref={popoverAnchor}
                    title={translate('requestorStep.learnMore')}
                    icon={Expensicons.QuestionMark}
                    shouldShowRightIcon
                    iconRight={Expensicons.NewWindow}
                    disabled={isExecuting}
                    shouldBlockSelection
                    onPress={singleExecution(() => Link.openExternalLink(CONST.REFERRAL_PROGRAM.LEARN_MORE_LINK))}
                    onSecondaryInteraction={(e) => ReportActionContextMenu.showContextMenu(CONST.CONTEXT_MENU_TYPES.LINK, e, CONST.REFERRAL_PROGRAM.LEARN_MORE_LINK, popoverAnchor.current)}
                />
            </Section>
        </HeaderPageLayout>

TEST BRANCH

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?


What alternative solutions did you explore? (Optional)

Krishna2323 commented 4 hours ago

@Expensify/design, could you please help confirm the expected behavior? Thanks!

Current If we only fix status bar Using section component
Monosnap Android Emulator - Pixel_8_Pro_API_34_2:5554 2024-12-04 05-29-09 Monosnap Android Emulator - Pixel_8_Pro_API_34_2:5554 2024-12-04 05-30-13 Monosnap Android Emulator - Pixel_8_Pro_API_34_2:5554 2024-12-04 05-28-33
Krishna2323 commented 4 hours ago

Sorry for comments above, I misunderstood the issue.

nkdengineer commented 47 minutes ago

Edited by proposal-police: This proposal was edited at 2024-12-04 04:03:37 UTC.

Proposal

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

Navigation bar shows purple color on "Submit an expense,get $250" page in offline mode

What is the root cause of that problem?

When the user is offline, isSafeAreaBottomPaddingApplied becomes true

https://github.com/Expensify/App/blob/0eec30d00c131d3f9caacf1de6afd33c83bc351e/src/components/ScreenWrapper.tsx#L255

Which makes the wrap view have a padding-bottom is the safe area padding-bottom https://github.com/Expensify/App/blob/0eec30d00c131d3f9caacf1de6afd33c83bc351e/src/components/ScreenWrapper.tsx#L273

Then purple color is displayed at the bottom because the wrap view's background color

https://github.com/Expensify/App/blob/0eec30d00c131d3f9caacf1de6afd33c83bc351e/src/pages/ReferralDetailsPage.tsx#L64

https://github.com/Expensify/App/blob/0eec30d00c131d3f9caacf1de6afd33c83bc351e/src/components/HeaderPageLayout.tsx#L78

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

We should not apply the padding-bottom to the wrap view here of includeSafeAreaPaddingBottom is false

  1. Remove the isSafeAreaBottomPaddingApplied and replace this with includeSafeAreaPaddingBottom

https://github.com/Expensify/App/blob/0eec30d00c131d3f9caacf1de6afd33c83bc351e/src/components/ScreenWrapper.tsx#L255

  1. If includeSafeAreaPaddingBottom we need to add the safeAreaPaddingBottomStyle to the container of the offline indicator
<OfflineIndicator
    style={[offlineIndicatorStyle]}
    containerStyles={
        includeSafeAreaPaddingBottom
            ? []
            : [styles.offlineIndicatorMobile, {paddingBottom: paddingBottom + 30}]
    }
/>

https://github.com/Expensify/App/blob/0eec30d00c131d3f9caacf1de6afd33c83bc351e/src/components/ScreenWrapper.tsx#L308

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA

What alternative solutions did you explore? (Optional)