Skip to content

feat(android): support displayInline - #1266

Open
zewish wants to merge 1 commit into
react-native-menu:masterfrom
zewish:master
Open

zewish wants to merge 1 commit into
react-native-menu:masterfrom
zewish:master

Conversation

@zewish

@zewish zewish commented Nov 25, 2026 •

Copy link
Copy Markdown

Overview

Fixes dividers for #1134 and connected to #271.

Found this while building a menu with a group of checkable items. On iOS displayInline shows the group right in the menu and it looks great. On Android it's ignored, so the same group ends up in a sub menu.

<MenuView
  actions={[
    { id: 'rename', title: 'Rename' },
    {
      title: 'Sort by',
      displayInline: true,
      subactions: [
        { id: 'name', title: 'Name', state: 'on' },
        { id: 'date', title: 'Date', state: 'off' },
      ],
    },
    { id: 'delete', title: 'Delete', attributes: { destructive: true } },
  ]}
>
  <Text>Open menu</Text>
</MenuView>

Old behavior:

  • "Sort by" opens a sub menu

New behavior:

  • "Sort by" is a title and its items are right below it, with dividers around the group
Old Old (sub menu) New
Light before-light-menu before-light-submenu after-light-menu
Dark before-dark-menu before-dark-submenu after-dark-menu

The rounded corners come from the theme of our app.

NOTE: Android menus that already use displayInline: true will look different, because they showed a sub menu until now. iOS is not affected since it already supports this.

Implementation details:

  • Dividers need Android API 28+. Older versions get the same menu without them.

Test Plan

  1. Run the example app on Android and open the "Test" menu
  2. "Inline Actions" is a title with two items below it and dividers around them
  3. Press one of the two items - onPressAction gets its id

Tested in our app on an Android 16 emulator in light and dark mode (screenshots above) and on an Android 8 emulator.

@zewish
zewish requested a review from Naturalclar as a code owner November 25, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant