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.57k stars 2.92k forks source link

iOS - Distance - Scan tab shows black background after swiping left to go to Distance #52831

Closed IuliiaHerets closed 3 days ago

IuliiaHerets commented 5 days 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.64-4 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y Email or phone of affected tester (no customers): applausetester+29302390@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  1. Launch ND or hybrid app.
  2. Go to FAB > Submit expense.
  3. Go to Scan.
  4. Swipe left to go to Distance.
  5. Tap on Scan tab.
  6. Swipe left to go to Distance.

Expected Result:

Scan tab will not have black background after swiping left to go to Distance.

Actual Result:

Scan tab shows black background after swiping left to go to Distance.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/0d97ef22-5e74-42e2-a327-4289db28e895

IMG_8385

View all open jobs on GitHub

melvin-bot[bot] commented 5 days ago

Triggered auto assignment to @stephanieelliott (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.

QichenZhu commented 5 days ago

Proposal

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

Scan tab shows a black background after swiping left to Distance, clicking Scan, and swiping left to Distance again.

What is the root cause of that problem?

On native platforms, the background color is calculated using the sum of position and offset, which are internal animation values.

https://github.com/Expensify/App/blob/d49d52dd3d9b3688c52a9fbbc93e988c826d209f/src/components/TabSelector/getBackground/index.native.ts#L7

https://github.com/react-navigation/react-navigation/blob/5da190167882859bb3356a84de42be3ca540ef99/packages/react-native-tab-view/src/PagerViewAdapter.tsx#L134

Screenshot 2024-11-21 at 1 04 40 PM

These values weren’t meant for external use and didn't update properly during page switches, so we added a patch to fix this.

https://github.com/Expensify/App/blob/056d6541d875378e0c2d2b6add5609cb9f49532f/patches/react-native-tab-view%2B3.5.2.patch#L18-L22

In this patch, position is correctly set, but offset is unchanged.

If position is the index of the last tab and offset > 0, their sum goes out of range, so the background interpolates to the wrong color.

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

Set both position and offset when a page is selected.

https://github.com/Expensify/App/blob/056d6541d875378e0c2d2b6add5609cb9f49532f/patches/react-native-tab-view%2B3.5.2.patch#L21

position.setValue(index);
offset.setValue(0);

What alternative solutions did you explore? (Optional)

Avoid using internal animation values in TabSelector, which has already been done on web platforms in https://github.com/Expensify/App/pull/51020. The drawback is that the background won’t change gradually during tab sliding.

stephanieelliott commented 3 days ago

This is practically undetectable and only happens in dark mode. Seeing as it does not affect functionality I think this is not worth prioritizing.