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

[$250] Android -Distance - Distance tab is gray and not highlighted in green when swiping to Distance #51297

Open
2 of 8 tasks
lanitochka17 opened this issue Oct 22, 2024 · 10 comments
Assignees
Labels
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 Help Wanted Apply this label when an issue is open to proposals by contributors

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-22
Issue OwnerCurrent Issue Owner: @rayane-djouah
@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-djouah
Copy link
Contributor

Reviewing 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

6 participants