Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-11-14] [$250] Android -Distance - Distance tab is gray and not highlighted in green when swiping to Distance #51297

Closed
2 of 8 tasks
lanitochka17 opened this issue Oct 22, 2024 · 25 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 22, 2024

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.52-2
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): applausetester+kh1610015@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch ND or hybrid app.
  2. Open FAB > Submit expense
  3. Go to Manual
  4. Swipe to Scan, then swipe to Distance

Expected Result:

Distance tab will be highlighted in green when swiping to Distance tab (production behavior)

Actual Result:

Distance tab is gray and not highlighted in green when swiping to Distance tab
The tab is only green when it is tapped on
This issue also happens in Scan tab when it is swiped from Distance to Scan

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence
Bug6642503_1729625702598.1729625430866_Screen_Recording_20241023_033004.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021848826866073504646
  • Upwork Job ID: 1848826866073504646
  • Last Price Increase: 2024-10-29
  • Automatic offers:
    • rayane-djouah | Reviewer | 104667585
Issue OwnerCurrent Issue Owner: @mallenexpensify
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

Copy link

melvin-bot bot commented Oct 22, 2024

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

Copy link
Contributor

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

@yuwenmemon
Copy link
Contributor

Demoting this as it's pretty minor.

@yuwenmemon yuwenmemon added Daily KSv2 Hourly KSv2 Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor and removed Hourly KSv2 DeployBlockerCash This issue or pull request should block deployment Daily KSv2 labels Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

@melvin-bot melvin-bot bot changed the title Android -Distance - Distance tab is gray and not highlighted in green when swiping to Distance [$250] Android -Distance - Distance tab is gray and not highlighted in green when swiping to Distance Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

Triggered auto assignment to @mallenexpensify (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 melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

@twilight2294
Copy link
Contributor

Proposal

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

What is the root cause of that problem?

when we calculate opacity for android device, we wrongly compare with isActive prop which is meant for web platforms, on native devices we rely on Index values of the current tag to select the opacity of the selected tab

outputRange: inputRange.map((i) => (affectedTabs.includes(tabIndex) && i === tabIndex && isActive ? activeValue : inactiveValue)),
.

isActive is meant for web platforms and we define it here in the web file below:

return affectedTabs.includes(tabIndex) && isActive ? activeValue : inactiveValue;

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

We should remove the isActive check in native file as it is meant for web platforms only:

const getOpacity: GetOpacity = ({routesLength, tabIndex, active, affectedTabs, position}) => {
    const activeValue = active ? 1 : 0;
    const inactiveValue = active ? 0 : 1;

    if (routesLength > 1) {
        const inputRange = Array.from({length: routesLength}, (v, i) => i);

        return position?.interpolate({
            inputRange,
            outputRange: inputRange.map((i) => (affectedTabs.includes(tabIndex) && i === tabIndex ? activeValue : inactiveValue)),
        });
    }
    return activeValue;
};
Screen.Recording.2024-10-23.at.3.03.21.AM.mov

What alternative solutions did you explore? (Optional)

@Krishna2323
Copy link
Contributor

Krishna2323 commented Oct 22, 2024

Edited by proposal-police: This proposal was edited at 2024-10-22 21:49:27 UTC.

Proposal


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

Android -Distance - Distance tab is gray and not highlighted in green when swiping to Distance

What is the root cause of that problem?

  • In this PR we removed the useCallback hook and now the getBackgroundColor is called unnecessarily whenever the tab items are mapped.

const activeOpacity = getOpacity({routesLength: state.routes.length, tabIndex: index, active: true, affectedTabs: affectedAnimatedTabs, position, isActive});
const inactiveOpacity = getOpacity({routesLength: state.routes.length, tabIndex: index, active: false, affectedTabs: affectedAnimatedTabs, position, isActive});
const backgroundColor = getBackgroundColor({routesLength: state.routes.length, tabIndex: index, affectedTabs: affectedAnimatedTabs, theme, position, isActive});

  • Without useCallback, the getBackgroundColor and getOpacity functions are recreated on every render. This can cause unnecessary recalculations of the background and opacity interpolations, which might cause issues with how Android handles these animations.

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


  • We can just create functions which will call getOpacity & getBackgroundColor at the top level of the component (outside the map function).
  • It will work with of without useCallback hook.

What alternative solutions did you explore? (Optional)

Result

@rayane-d
Copy link
Contributor

Reviewing 👀

@rayane-d
Copy link
Contributor

Able to reproduce on the latest main 👍

android_native.mp4

Copy link

melvin-bot bot commented Oct 29, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mallenexpensify
Copy link
Contributor

Removed Help Wanted for a min... @rayane-djouah , what do you think of the proposals above?

@rayane-d
Copy link
Contributor

@twilight2294's proposal looks good to me.

In #51020, we appropriately modified the getBackgroundColor logic to differentiate between web and native platforms, using interpolation based on position variable for native and using isActive variable check for web. However, for getOpacity, we mistakenly combined both approaches (interpolation based on position variable and isActive variable check), which led to inconsistencies. Removing the isActive check from the native implementation, as suggested by @twilight2294, should resolve the issue.

🎀👀🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2024
Copy link

melvin-bot bot commented Oct 30, 2024

Current assignee @yuwenmemon is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Oct 30, 2024

📣 @rayane-djouah 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Oct 30, 2024

📣 @twilight2294 You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@mallenexpensify
Copy link
Contributor

I'm back from OOO on Nov 14th, not assigning another BZ because the PR is on staging so payment will likely be the day or two after I'm back. If one is needed please add or post in #contributor-plus to ask for one to be added, thx.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 7, 2024
@melvin-bot melvin-bot bot changed the title [$250] Android -Distance - Distance tab is gray and not highlighted in green when swiping to Distance [HOLD for payment 2024-11-14] [$250] Android -Distance - Distance tab is gray and not highlighted in green when swiping to Distance Nov 7, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 7, 2024
Copy link

melvin-bot bot commented Nov 7, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Nov 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.58-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-11-14. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 7, 2024

@rayane-djouah @mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@rayane-d
Copy link
Contributor

BugZero Checklist:

  • Classify the bug:

    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
  • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: https://github.com/Expensify/App/pull/51020/files#r1844652072

  • If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • @mallenexpensify Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

#### Precondition:

- N/A

#### Test:

1. Open the Floating Action Button (FAB) and select "Submit expense."
2. Click on "Manual".
3. Swipe to the "Scan" tab, then continue swiping to the "Distance" tab.
4. Verify that the "Distance" tab is highlighted in green upon arrival.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Nov 18, 2024
@mallenexpensify
Copy link
Contributor

mallenexpensify commented Nov 18, 2024

Contributor: @twilight2294 paid $250 via Upwork
Contributor+: @rayane-djouah paid $250 via Upwork

Test case created, thx @rayane-djouah

@twilight2294 can you please accept the job and reply here once you have?
https://www.upwork.com/jobs/~021848826866073504646

@melvin-bot melvin-bot bot removed the Overdue label Nov 18, 2024
@twilight2294
Copy link
Contributor

@twilight2294 can you please accept the job and reply here once you have?

I accepted, thanks you

@mallenexpensify
Copy link
Contributor

Thanks @twilight2294 , you've been paid, payment post above has been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants