Skip to content

[Payment due 11-9] [$250] FAB - FAB shows the contrasting color when hovered after changing app theme #72890

Closed

Description

@jponikarchuk

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.2.33-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #72714
Email or phone of affected tester (no customers): sdjoisnjdsonsjndos@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Account > Preferences.
  3. Click Theme.
  4. Select the other theme (If dark, then light. If light, then dark).
  5. Hover over FAB + button.

Expected Result:

FAB will not show the contrasting color when hovered after changing app theme.

Actual Result:

FAB shows the contrasting color when hovered after changing app theme.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021980409101764896340
  • Upwork Job ID: 1980409101764896340
  • Last Price Increase: 2025-10-20
  • Automatic offers:
    • FitseTLT | Reviewer | 109236492

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 17, 2025
  2. melvin-bot commented on Oct 17, 2025

    @melvin-bot

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

  3. dmkt9 commented on Oct 18, 2025

    @dmkt9
    Contributor

    Proposal

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

    FAB shows the contrasting color when hovered after changing app theme.

    What is the root cause of that problem?

    1. backgroundColor is set inside animatedStyle.

      const animatedStyle = useAnimatedStyle(() => {
      const backgroundColor = interpolateColor(sharedValue.get(), [0, 1], [buttonDefaultBG, buttonHoveredBG]);
      return {
      transform: [{rotate: `${sharedValue.get() * 135}deg`}],
      backgroundColor,
      };
      });

    2. When hovering, backgroundColor is directly overridden on top of animatedStyle, and when the hover ends, it resets to the initial.backgroundColor value from animatedStyle. This initial value doesn’t change even when the value inside useAnimatedStyle updates.

      <Animated.View
      style={[styles.floatingActionButton, {borderRadius}, styles.floatingActionButtonSmall, animatedStyle, hovered && {backgroundColor: buttonHoveredBG}]}

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

    When not active, we should explicitly override the backgroundColor from animatedStyle.

    <Animated.View
    style={[styles.floatingActionButton, {borderRadius}, styles.floatingActionButtonSmall, animatedStyle, hovered && {backgroundColor: buttonHoveredBG}]}

    <Animated.View
        style={[
            styles.floatingActionButton,
            {borderRadius},
            styles.floatingActionButtonSmall,
            animatedStyle,
            !isActive && {backgroundColor: hovered ? buttonHoveredBG : buttonDefaultBG},
        ]}

    What alternative solutions did you explore? (Optional)

    Instead of directly overriding on hover, we update the backgroundColor through changes in animatedStyle.

    const animatedStyle = useAnimatedStyle(() => {
    const backgroundColor = interpolateColor(sharedValue.get(), [0, 1], [buttonDefaultBG, buttonHoveredBG]);

    const isHovered = useSharedValue(false);
    const animatedStyle = useAnimatedStyle(() => {
        const backgroundColor = isHovered.get() && !sharedValue.get() ? buttonHoveredBG : interpolateColor(sharedValue.get(), [0, 1], [buttonDefaultBG, buttonHoveredBG]);

    {({hovered}) => (
    <Animated.View
    style={[styles.floatingActionButton, {borderRadius}, styles.floatingActionButtonSmall, animatedStyle, hovered && {backgroundColor: buttonHoveredBG}]}

        {({hovered}) => {
            isHovered.set(hovered);
    
            return (
                <Animated.View
                    style={[styles.floatingActionButton, {borderRadius}, styles.floatingActionButtonSmall, animatedStyle]}
    2025-10-18.15-16-00.mp4
  4. abbasifaizan70 commented on Oct 18, 2025

    @abbasifaizan70
    Contributor

    Proposal

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

    When a user changes the app theme (light ↔ dark) in Account > Preferences > Theme, the FAB + button shows the wrong hover color - it displays the old theme's hover color instead of the new theme's hover color.

    What is the root cause of that problem?

    The animatedStyle worklet (lines 70-77) captures the theme color values (buttonDefaultBG and buttonHoveredBG) when it's first created. These captured values are used in interpolateColor to animate the backgroundColor based on the isActive state. When the theme changes, the component re-renders with new theme colors, but the worklet continues using the old captured colors.

    At line 120, the style array applies both:

    1. animatedStyle - with old theme colors baked into the worklet
    2. hovered && {backgroundColor: buttonHoveredBG} - with new theme colors

    This creates a conflict where hovering applies the new color, but the underlying animated backgroundColor still uses old colors, resulting in the contrasting color bug.

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

    Remove backgroundColor interpolation from animatedStyle and handle backgroundColor separately based on hover state using current theme values.

    src/components/FloatingActionButton.tsx

    Change 1 - Lines 70-77: Remove backgroundColor from animation

     const animatedStyle = useAnimatedStyle(() => {
    -    const backgroundColor = interpolateColor(sharedValue.get(), [0, 1], [buttonDefaultBG, buttonHoveredBG]);
    -
         return {
             transform: [{rotate: `${sharedValue.get() * 135}deg`}],
    -        backgroundColor,
         };
     });

    Change 2 - Line 120: Always set backgroundColor based on current theme

     <Animated.View
         style={[
             styles.floatingActionButton,
             {borderRadius},
             styles.floatingActionButtonSmall,
    +        {backgroundColor: hovered ? buttonHoveredBG : buttonDefaultBG},
             animatedStyle,
    -        hovered && {backgroundColor: buttonHoveredBG}
         ]}
         testID="fab-animated-container"
     >

    This separates concerns: the animation handles rotation, while backgroundColor is controlled by hover state using current theme values.

    Alternative

    Add dependency array [buttonDefaultBG, buttonHoveredBG] to useAnimatedStyle

    This approach attempts to recreate the worklet when theme colors change. However, it still causes the same issue because:

    1. Both animatedStyle and the hover style simultaneously try to control backgroundColor
    2. The style array applies animatedStyle first, then the hover style
    3. The animated backgroundColor from the worklet still conflicts with the hover backgroundColor

    Output Video

    https://www.loom.com/share/735f981268044057a20949c750bdcd41?sid=3fdf75d0-7d32-4bd7-89e7-f565422a0a24

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 20, 2025
  6. changed the title [-]FAB - FAB shows the contrasting color when hovered after changing app theme[/-] [+][$250] FAB - FAB shows the contrasting color when hovered after changing app theme[/+] on Oct 20, 2025
  7. melvin-bot commented on Oct 20, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 20, 2025
  9. melvin-bot commented on Oct 20, 2025

    @melvin-bot

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

  10. 14 remaining items

  11. dmkt9 commented on Oct 25, 2025

    @dmkt9
    Contributor

    The PR is ready.

  12. Christinadobrzyn commented on Oct 28, 2025

    @Christinadobrzyn
    Contributor

    following - #73479

  13. Christinadobrzyn commented on Nov 5, 2025

    @Christinadobrzyn
    Contributor

    The PR was just merged yesterday. Payment will be 11-9

  14. changed the title [-][$250] FAB - FAB shows the contrasting color when hovered after changing app theme[/-] [+][Payment due 11-9] [$250] FAB - FAB shows the contrasting color when hovered after changing app theme[/+] on Nov 5, 2025
  15. Christinadobrzyn commented on Nov 5, 2025

    @Christinadobrzyn
    Contributor

    @FitseTLT do we need a regression test for this?

  16. FitseTLT commented on Nov 5, 2025

    @FitseTLT
    Contributor

    BugZero Checklist:

    • [Contributor] 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: no offending PR

    • [Contributor] 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:

    • [Contributor] 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.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/566711

    Regression Test Proposal

    Precondition:

    • Test on a device with a large screen

    Test:

    1. Go to Account > Preferences.
    2. Click Theme.
    3. Select the other theme (If dark, then light. If light, then dark).
    4. Hover over FAB + button and hover out from it.
    5. Verify that FAB has the proper color of the current selected app theme.

    Do we agree 👍 or 👎

  17. Christinadobrzyn commented on Nov 10, 2025

    @Christinadobrzyn
    Contributor

    Payment summary wasn't deployed for this

    Payment Summary

    Contributor: @dmkt9 paid $250 via Upwork (https://www.upwork.com/nx/wm/offer/109459491) PAID
    Contributor+: @FitseTLT due $250 via Upwork (Paid)

    @dmkt9 how are you paid?

  18. dmkt9 commented on Nov 11, 2025

    @dmkt9
    Contributor

    @Christinadobrzyn Thanks. I still received the payment from Upwork.

  19. Christinadobrzyn commented on Nov 13, 2025

    @Christinadobrzyn
    Contributor

    Thanks @dmkt9! Can you please accept this offer? https://www.upwork.com/nx/wm/offer/109459491

  20. dmkt9 commented on Nov 13, 2025

    @dmkt9
    Contributor

    @Christinadobrzyn I've just requested payment. Thanks.

  21. Christinadobrzyn commented on Nov 13, 2025

    @Christinadobrzyn
    Contributor

    Thanks @dmkt9!

    Payment summary here - #72890 (comment)

    Regression test here - #72890 (comment)

    Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions