Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,16 @@ private void createContextMenuSubMenu(Menu menu, ReadableMap action, ReadableArr
spannableTitle.setSpan(new CustomTypefaceSpan("", customFont), 0, title.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
}

Menu parentMenu = menu.addSubMenu(spannableTitle);
// Explicit order (matching createContextMenuAction) so the submenu is inserted at index i
// in the menu's internal item list; addSubMenu(title) alone defaults order to 0, which
// shifts the submenu to the front and makes menu.getItem(i) below target the wrong item.
Menu parentMenu = menu.addSubMenu(Menu.NONE, Menu.NONE, i, spannableTitle);

@Nullable Drawable icon = getResourceWithName(getContext(), action.getString("icon"));
if (action.hasKey("iconColor") && icon != null) {
int color = Color.parseColor(action.getString("iconColor"));
icon.setTint(color);
}
menu.getItem(i).setIcon(icon); // set icon to current item.

for (int j = 0; j < childActions.size(); j++) {
Expand Down