Skip to content

[Due for payment 2026-01-23] [$250] Android - Chat - UI gap shown under emoji picker grid with keyboard #78810

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.92-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: https://test-management.browserstack.com/projects/2219752/test-runs/TR-2626/folder/13176681/41236985/1103226395?sort=%2Bidentifier
Email or phone of affected tester (no customers): jsat+todayo@applausemail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Samsung Galaxy S21 Ultra/Android 15
App Component: Chat Report View

Action Performed:

  1. Open Expensify Android App and log in with valid credentials
  2. Go to any chat
  3. Open the keyboard up
  4. Tap emoji emoji picker to open emoji grid

Expected Result:

No blank space should appear at the bottom of the emoji grid when keyboard is opened

Actual Result:

A blank space appears at the bottom of the emoji grid when keyboard is opened and emoji grid is aligned to the top

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/~022008699842219343211
  • Upwork Job ID: 2008699842219343211
  • Last Price Increase: 2026-01-07
  • Automatic offers:
    • rohit9625 | Contributor | 110032533
Issue OwnerCurrent Issue Owner: @johncschuster

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 3, 2026
  2. melvin-bot commented on Jan 3, 2026

    @melvin-bot

    Triggered auto assignment to @johncschuster (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. rohit9625 commented on Jan 4, 2026

    @rohit9625
    Contributor

    Proposal

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

    A blank space appears at the bottom of the emoji grid when the keyboard is opened, and the emoji grid is aligned to the top

    What is the root cause of that problem?

    The position of the EmojiPicker is calculated based on the anchor position of the EmojiPickerButton that we click to open the EmojiPicker. However, when the keyboard is already visible, i.e., the composer is focused, and we press the EmojiPickerButton, then the calculation of the position of EmojiPicker happens before the keyboard is completely hidden.

    That's why the anchor position of EmojiPickerButton passed here could be in the middle of the transition to the bottom:

    showEmojiPicker({
    onModalHide,
    onEmojiSelected,
    emojiPopoverAnchor,
    anchorOrigin: {
    horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
    vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
    shiftVertical,
    },
    id: emojiPickerID,
    });

    Hence, the EmojiPicker's calculated popover position can be slightly above sometimes, and it also varies device to device(due to how fast the keyboard hides on different devices). So, if the keyboard takes more time to hide, then the popover can be placed at the top of the screen because the initial anchor position of EmojiPickerButton is at the middle of the screen when the keyboard is visible.

    Note: It doesn't happen when the composer is not already focused when pressing the EmojiPickerButton.

    Screen.Recording.2026-01-04.at.11.40.21.AM.mov

    However, we do have logic to dismiss the keyboard before calculating the anchor position for EmojiPicker:

    KeyboardUtils.dismiss(true).then(() =>
    calculateAnchorPosition(emojiPopoverAnchor?.current, anchorOriginValue).then((value) => {
    close(() => {
    onWillShow?.();

    But it doesn't work reliably on Android because the dismiss function relies on the keyboardDidHide event from react-native:

    const dismiss = (shouldSkipSafari?: boolean): Promise<void> => {
    return new Promise((resolve) => {
    if (!isVisible) {
    resolve();
    return;
    }
    const subscription = Keyboard.addListener('keyboardDidHide', () => {
    resolve();
    subscription.remove();
    });
    Keyboard.dismiss();
    });
    };

    And, the keyboardDidHide event triggers as soon as the Keyboard.dismiss() function is called, i.e., before the keyboard is completely hidden. However, the keyboardDidHide event should be triggered only after the keyboard is completely hidden, similar to iOS. Notice the logs timing on the iOS and Android:

    Screen.Recording.2026-01-04.at.12.07.42.PM.mov

    Hence, the issue is reproducible for Android devices only.

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

    We had a similar issue(#70692) in the past where the EmojiPicker was shown at the top of the StatusPage. That's why the dismissKeyboardAndExecute function was created in PR(#71323). This function uses KeyboardEvents from react-native-keyboard-controller for Android(index.android.ts) and resolves immediately for iOS(index.ts) because issue not reproducible for iOS:

    const dismissKeyboardAndExecute = (cb: () => void): Promise<void> => {
    return new Promise((resolve) => {
    if (!isVisible) {
    cb();
    resolve();
    return;
    }
    const keyboardDidHideSubscription = KeyboardEvents.addListener('keyboardDidHide', (e: SimplifiedKeyboardEvent) => {
    if (e.height !== 0) {
    resolve();
    return;
    }
    cb();
    keyboardDidHideSubscription.remove();
    resolve();
    });
    Keyboard.dismiss();
    });
    };

    const dismissKeyboardAndExecute = (cb: () => void): Promise<void> => {
    return new Promise((resolve) => {
    // For iOS and other platforms, execute callback immediately
    cb();
    resolve();
    });
    };

    So, we can simply update the code at the EmojiPickerButton to dismiss the keyboard using the dismissKeyboardAndExecute function before calling showEmojiPicker, similar to EmojiPickerButtonDropdown:

    KeyboardUtils.dismissKeyboardAndExecute(() => {
    showEmojiPicker({
    onModalHide,

    Results:

    Screen.Recording.2026-01-04.at.12.32.11.PM.mov

    Note: There's still some flickering in the EmojiPicker popover when opening it. It seems like a different issue as it also happens for the EmojiPickerButtonDropdown at the StatusPage. This is some rendering issue and should be handled separately because fixing this won't fix the UI gap issue, and vice versa.

    What alternative solutions did you explore? (Optional)

    Alternatively, we can update the dismiss function at here:

    const dismiss = (shouldSkipSafari?: boolean): Promise<void> => {
    return new Promise((resolve) => {
    if (!isVisible) {
    resolve();
    return;
    }
    const subscription = Keyboard.addListener('keyboardDidHide', () => {
    resolve();
    subscription.remove();
    });
    Keyboard.dismiss();
    });
    };

    To use the KeyboardEvents from react-native-keyboard-controller instead of the react-native's event:

    -        const subscription = Keyboard.addListener('keyboardDidHide', () => {
    +        const subscription = KeyboardEvents.addListener('keyboardDidHide', () => {
                 resolve();
                 subscription.remove();
             });

    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.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 7, 2026
  5. changed the title [-]Android - Chat - UI gap shown under emoji picker grid with keyboard[/-] [+][$250] Android - Chat - UI gap shown under emoji picker grid with keyboard[/+] on Jan 7, 2026
  6. melvin-bot commented on Jan 7, 2026

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 7, 2026
  8. melvin-bot commented on Jan 7, 2026

    @melvin-bot

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

  9. twinkle-react commented on Jan 7, 2026

    @twinkle-react

    Proposal

    Please re-state the problem that we are trying to solve in this issue:
    A blank space appears at the bottom of the emoji grid on Android when the keyboard is opened, and the emoji grid is aligned to the top instead of sitting flush above the keyboard.

    What is the root cause of that problem:

    The position of the EmojiPicker is calculated based on the anchor position of the EmojiPickerButton at the time of opening. If the keyboard is already visible, the composer hasn’t settled to its final position yet, causing the popover to be misaligned and leave a blank space at the bottom.

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

    Remeasure the emoji anchor once the keyboard is fully hidden using the existing keyboard state context. This ensures the popover recalculates its position after the composer snaps back down, eliminating the blank space without modifying Onyx/navigation flows or adding timing hacks.

    Code changes to src/components/EmojiPicker/EmojiPicker.tsx:

    @@-import useWindowDimensions from '@hooks/useWindowDimensions';
    +import useWindowDimensions from '@hooks/useWindowDimensions';
    +import useKeyboardState from '@hooks/useKeyboardState';
    @@ function EmojiPicker({viewportOffsetTop, ref}: EmojiPickerProps) {
         const styles = useThemeStyles();
         const StyleUtils = useStyleUtils();
    +    const {isKeyboardActive, isKeyboardAnimatingRef} = useKeyboardState();
    @@
         useEffect(() => {
             const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => {
                 const emojiPopoverAnchor = getEmojiPopoverAnchor();
    @@
             };
         }, [isEmojiPickerVisible, shouldUseNarrowLayout, emojiPopoverAnchorOrigin, getEmojiPopoverAnchor, hideEmojiPicker]);
    +
    +    // Re-anchor after the keyboard finishes hiding so the popover uses the settled composer position.
    +    useEffect(() => {
    +        if (!isEmojiPickerVisible || isKeyboardActive || isKeyboardAnimatingRef.current) {
    +            return;
    +        }
    +        const anchor = getEmojiPopoverAnchor();
    +        if (!anchor?.current) {
    +            return;
    +        }
    +        calculateAnchorPosition(anchor.current, emojiPopoverAnchorOrigin).then((value) => {
    +            setEmojiPopoverAnchorPosition({
    +                horizontal: value.horizontal,
    +                vertical: value.vertical,
    +            });
    +            emojiAnchorDimension.current = {
    +                width: value.width,
    +                height: value.height,
    +            };
    +        });
    +    }, [isEmojiPickerVisible, isKeyboardActive, emojiPopoverAnchorOrigin, getEmojiPopoverAnchor, isKeyboardAnimatingRef]);

    The emoji picker now waits for the keyboard to finish hiding (via KeyboardStateProvider) before recalculating its anchor. This ensures the popover aligns correctly with the composer’s final position, removing the bottom gap while keeping existing focus/refocus and modal behavior intact.

    What alternative solutions did you explore? (Optional)
    N/A

  10. 23 remaining items

  11. rohit9625 commented on Jan 26, 2026

    @rohit9625
    Contributor

    Friendly bump! @johncschuster :)

  12. johncschuster commented on Jan 27, 2026

    @johncschuster
    Contributor

    I'm on this now!

  13. johncschuster commented on Jan 27, 2026

    @johncschuster
    Contributor

    Payment Summary

    Contributor: @rohit9625 paid $250 via Upwork ✅
    Contributor+: @shubham1206agra due $250 via NewDot

  14. johncschuster commented on Jan 27, 2026

    @johncschuster
    Contributor

    @shubham1206agra, can you complete the BZ checklist above and then request payment? Thank you!

  15. shubham1206agra commented on Jan 30, 2026

    @shubham1206agra
    Contributor

    BugZero Checklist:

    Regression Test Proposal

    Test:

    1. Open App
    2. Go to any chat
    3. Tap the composer to open the keyboard
    4. Tap the emoji picker button to open the emoji grid
    5. Verify that there's no visible UI gap under the emoji picker modal

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-44a8-aaea-a13a-81b375f65e24
  16. johncschuster commented on Jan 30, 2026

    @johncschuster
    Contributor

    @shubham1206agra thanks! Please request payment from NewExpensify! (Payment Summary)

  17. garrettmknight commented on Apr 2, 2026

    @garrettmknight
    Contributor

    $250 approved for @shubham1206agra

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions