Skip to content

[$250] Android - Expense - Keyboard blinks briefly after changing currency #78591

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.89-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #78004
Email or phone of affected tester (no customers): isjdsoijsojnsiojisndj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Samsung Galaxy S25 FE / Android 16
App Component: Money Requests

Action Performed:

  1. Launch Expensify app.
  2. Open FAB > Create expense > Manual.
  3. Tap currency.
  4. Select any currency.

Expected Result:

Keyboard will not blink after changing currency.

Actual Result:

Keyboard blinks briefly after changing currency.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022006118768936896413
  • Upwork Job ID: 2006118768936896413
  • Last Price Increase: 2025-12-30
Issue OwnerCurrent Issue Owner: @abzokhattab

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 30, 2025
  2. melvin-bot commented on Dec 30, 2025

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #78004

  3. melvin-bot commented on Dec 30, 2025

    @melvin-bot

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

  4. melvin-bot commented on Dec 30, 2025

    @melvin-bot

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

  5. github-actions commented on Dec 30, 2025

    @github-actions
    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.
  6. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Dec 30, 2025
  7. 10 remaining items

  8. yatin-italy commented on Dec 30, 2025

    @yatin-italy

    Proposal

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

    On Android devices, the keyboard behaves erratically (flashes or blinks) when returning to the Amount entry step after selecting a currency during Expense creation. This disrupts the user experience, creates visual noise, and makes the app feel unpolished.

    What is the root cause of that problem?

    The current implementation uses a setTimeout with a fixed delay (CONST.ANIMATED_TRANSITION + 100) to restore focus to the input after the currency picker modal closes.

    • Timing Mismatch: The fixed delay does not reliably match the completion of the modal closing animation or the Android keyboard’s dismissal animation.
    • Race Conditions: If the modal closes faster or slower than expected, or if the keyboard dismissal overlaps with the focus request, the system conflicts between hiding and showing the keyboard, causing the flash.

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

    We will decouple focus restoration from fixed delays and instead use event-driven coordination:

    1. Modify IOURequestStepCurrencyModal:

      • Update CurrencyPickerProps to accept an onModalHide (or onDismiss) callback.
      • Pass this callback to the underlying Modal component’s onModalHide prop to ensure code runs only after the modal is fully removed from the screen.
    2. Update IOURequestStepAmount:

      • Remove the existing setTimeout and isCurrencyPickerVisible dependency in useFocusEffect.

      • Define a stable onCurrencyModalHide callback.

      • Inside the callback:

        • Check Keyboard State: Optionally verify if any keyboard dismissal is pending.
        • InteractionManager: Wrap the focus() call in InteractionManager.runAfterInteractions() to ensure no other JS animations interfere.
        • Execute Focus: Call textInput.current.focus().
    3. Optional Animation Refinement:

      • Ensure the modal’s transition does not conflict with the keyboard (e.g., fade vs. slide). The default RIGHT_DOCKED is acceptable; focus is on timing rather than changing animation style.

    What alternative solutions did you explore? (Optional)

    • Increasing the fixed setTimeout delay, which is unreliable across devices and animations.
    • Using requestAnimationFrame loops, which is less predictable and can introduce jank.
    • The chosen event-driven approach ensures reliable, animation-synced focus restoration without hard-coded timing.
  9. ChinmayKarnik commented on Jan 1, 2026

    @ChinmayKarnik

    🚨 Edited by proposal-police: This proposal was edited at 2026-01-01 05:25:58 UTC.

    Proposal

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

    On Android devices, when a user selects a currency during expense creation, the keyboard briefly blinks/flashes. This creates a jarring visual experience where the keyboard appears to dismiss and immediately reappear during the screen transition.

    What is the root cause of that problem?

    After analyzing the current codebase, I found the issue occurs in the currency selection flow between two screens: IOURequestStepAmount.tsx (the amount entry screen) and IOURequestStepCurrency.tsx (the currency picker screen).

    The flow works as follows:

    1. User taps currency on the amount screen
    2. Navigates to IOURequestStepCurrency screen via navigateToCurrencySelectionPage()
    3. User selects a currency, triggering confirmCurrencySelection()
    4. Screen navigates back to amount page

    The root cause is in src/pages/iou/request/step/IOURequestStepCurrency.tsx at line 51-58. The confirmCurrencySelection function calls Keyboard.dismiss() but doesn't wait for the Promise to resolve before initiating navigation:

    const confirmCurrencySelection = (option: CurrencyListItem) => {
        Keyboard.dismiss();  // Promise returned but not awaited
        if (pageIndex !== CONST.IOU.PAGE_INDEX.CONFIRM) {
            setMoneyRequestCurrency(transactionID, option.currencyCode, action === CONST.IOU.ACTION.EDIT);
        }
        Navigation.setNavigationActionToMicrotaskQueue(() => navigateBack(option.currencyCode));
    };

    This creates a race condition. While the keyboard is still in the process of dismissing, navigation back to the amount screen begins. When IOURequestStepAmount.tsx regains focus, its useFocusEffect hook (lines 140-149) automatically focuses the text input after CONST.ANIMATED_TRANSITION milliseconds. This focus happens while the previous keyboard dismissal is still in progress, causing both animations to overlap visually.

    The issue is specifically about asynchronous operation timing, not about modal vs screen architecture or requiring event-driven callbacks.

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

    The fix needs to be applied in src/pages/iou/request/step/IOURequestStepCurrency.tsx in the confirmCurrencySelection function. We need to ensure the keyboard dismissal completes before proceeding with state updates and navigation.

    Current implementation (lines 51-58):

    const confirmCurrencySelection = (option: CurrencyListItem) => {
        Keyboard.dismiss();
        if (pageIndex !== CONST.IOU.PAGE_INDEX.CONFIRM) {
            setMoneyRequestCurrency(transactionID, option.currencyCode, action === CONST.IOU.ACTION.EDIT);
        }
        Navigation.setNavigationActionToMicrotaskQueue(() => navigateBack(option.currencyCode));
    };

    Proposed fix:

    const confirmCurrencySelection = (option: CurrencyListItem) => {
        Keyboard.dismiss().then(() => {
            if (pageIndex !== CONST.IOU.PAGE_INDEX.CONFIRM) {
                setMoneyRequestCurrency(transactionID, option.currencyCode, action === CONST.IOU.ACTION.EDIT);
            }
            Navigation.setNavigationActionToMicrotaskQueue(() => navigateBack(option.currencyCode));
        });
    };

    By chaining the operations after the Promise resolution, we guarantee that:

    • The keyboard animation completes fully before navigation begins
    • The screen transition happens with a clean slate
    • When the amount input regains focus, the keyboard shows smoothly without conflicting with any ongoing dismissal animation

    This is a focused change that requires no modifications to other files, no new props or callbacks, and maintains the existing architecture. The fix addresses the asynchronous timing issue directly at its source.

    What alternative solutions did you explore?

    I verified the current codebase to ensure the fix targets the correct location. The currency selection is implemented as a full screen navigation (using StepScreenWrapper), not a modal component. This means solutions involving modal lifecycle callbacks like onModalHide would not apply to the current implementation.

    I also considered modifying the auto-focus behavior in IOURequestStepAmount.tsx to add a longer delay or conditional logic when returning from currency selection. However, this would introduce coupling between the two screens and wouldn't solve the underlying timing issue - it would only make it less visible. The proper approach is to fix the sequencing where the problem originates.

    Adding a fixed timeout instead of using the Promise would also work in most cases, but it would be fragile and device-dependent. Different Android devices have different keyboard animation speeds, so a hardcoded delay might be too short for some devices and unnecessarily long for others. Using the Promise ensures we wait exactly as long as needed on any device.

    The proposed solution is the most direct and maintainable approach - it fixes the race condition at its source with minimal code change and no architectural modifications.

  10. github-actions commented on Jan 1, 2026

    @github-actions
    Contributor

    ⚠️ @ChinmayKarnik Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  11. ChinmayKarnik commented on Jan 1, 2026

    @ChinmayKarnik

    ⚠️ @ChinmayKarnik Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

    I've updated my proposal after verifying the actual code in the current codebase. The issue is in IOURequestStepCurrency.tsx (line 51-58) in the confirmCurrencySelection function, where Keyboard.dismiss() is called without awaiting its Promise before navigation. This differs from other proposals which reference different code paths or architectural patterns that don't exist in the current implementation.

  12. rohit9625 commented on Jan 1, 2026

    @rohit9625
    Contributor

    Was anyone able to reproduce this issue consistenly or not because I think a recently merged PR fixed this issue?

  13. tsa321 commented on Jan 2, 2026

    @tsa321
    Contributor

    Proposal

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

    When user close RHP modal when keyboard is opened, the Keyboard blinks briefly

    What is the root cause of that problem?

    The issue is not limited to the currency selection page; it also occurs in the global chat search:

    Chat search bug:
    test_d.mp4

    The root cause is because:

    visible={modalVisibility}

    The modal (React Native Modal) is closed too early while the keyboard close animation is still running.

    this is because:

    setIsTransitioning(false);

    we set the transition as ended/finished without considering the keyboard animation.

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

    When closing the modal / set visible to false:

    visible={modalVisibility}

    we should wait for the keyboard to fully close before setting isTransitioning to false, So the React Native modal content remains available while the keyboard close animation is still in progress.

    We could modify this code:

    setIsTransitioning(false);

    to be:

    KeyboardUtils.dismiss().then(() => {
          setIsTransitioning(false);
    });

    This will fix the global chat search keyboard blinking issue.


    On the money request step amount page, the native keyboard appears, so we need to adjust this timer:

    focusTimeoutRef.current = setTimeout(() => textInput.current?.focus(), CONST.ANIMATED_TRANSITION + 100);

    to account for the keyboard close animation as well. We increase the additional timer from 100 to 200.

    Result in money request step:
    moneyrequest.mp4
    Result global chat search:
    globalsearch.mp4

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  14. tsa321 commented on Jan 2, 2026

    @tsa321
    Contributor

    Was anyone able to reproduce this issue consistenly or not because I think a recently merged PR fixed this issue?

    Still reproducible for me on latest main:

    test:
    test_d.mp4
  15. rohit9625 commented on Jan 2, 2026

    @rohit9625
    Contributor

    What is the emulator and Android version on which you can reproduce this issue, @tsa321?

  16. tsa321 commented on Jan 2, 2026

    @tsa321
    Contributor

    @rohit9625 using pixel 9 android 16, api 36

  17. rohit9625 commented on Jan 2, 2026

    @rohit9625
    Contributor

    Okay, got it. I tried with API 36.0 and can reproduce the issue consistently. However, on API 36.1, I can't reproduce this issue. I think this is an Android bug and because Android 16 introduces predictive back gesture, so that might be causing the issue in initial release of Android 16. I think it's still in beta and will be resolved in the final version of Android 16.

    So, does it still make sense to find solutions for this issue, @tgolen? If yes, the solution should be for react-native library.

    I also saw that a log message, which was appearing as an error on Android API 16.0, is shown as a warning on API 16.1

  18. tgolen commented on Jan 2, 2026

    @tgolen
    Contributor

    Thanks for investigating it. It sounds to me like it's not valuable to work on a fix at this time. I'll go ahead and close this. If it can be reproduced in more versions, then we should probably take a look.

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.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions