Skip to content

[Android] Wrong menu position in Menu component #4493

@alex-fournier

Description

@alex-fournier

Current behaviour

In Menu component, the menu is not positioned as expected when visible. For example with anchorPosition="bottom", the menu comes over the anchor.

Expected behaviour

The menu should appear under anchor.

How to reproduce?

https://snack.expo.dev/@alexfournier/ludicrous-green-churros

Tested with two physical devices: Google Pixel 7 and Samsung Galaxy S24.

actual expected
actual expected

What have you tried so far?

When passing the correct status bar height using statusBarHeight, it works fine. I think this piece of code is not working as expected as it returns 0 on my two devices:

// src/constants.tsx
const estimatedStatusBarHeight =
  NativeModules.NativeUnimoduleProxy?.modulesConstants?.ExponentConstants
    ?.statusBarHeight ?? 0;

Your Environment

software version
android 14
react-native 0.74.5
react-native-paper 5.12.5
node 20.10.0
npm or yarn 1.22.19
expo sdk 51.0.32

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions