Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ Optional. When set to `true`, the context menu is triggered with a single tap in

###### `disabled`

Optional. Currently iOS only. Disable menu interaction.
Optional. Disable menu interaction.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public void setDropdownMenuMode(ContextMenuView view, @Nullable boolean enabled)
view.setDropdownMenuMode(enabled);
}

@ReactProp(name = "disabled")
public void setDisabled(ContextMenuView view, @Nullable boolean disabled) {
view.setDisabled(disabled);
}

@androidx.annotation.Nullable
@Override
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public Action(String title, boolean disabled) {

protected boolean dropdownMenuMode = false;

protected boolean disabled = false;

public ContextMenuView(final Context context) {
super(context);

Expand Down Expand Up @@ -105,6 +107,8 @@ public void setActions(@Nullable ReadableArray actions) {
Menu menu = contextMenu.getMenu();
menu.clear();

if (disabled) { return; }

for (int i = 0; i < actions.size(); i++) {
ReadableMap action = actions.getMap(i);
@Nullable Drawable systemIcon = getResourceWithName(getContext(), action.getString("systemIcon"));
Expand All @@ -128,6 +132,10 @@ public void setDropdownMenuMode(@Nullable boolean enabled) {
this.dropdownMenuMode = enabled;
}

public void setDisabled(@Nullable boolean disabled) {
this.disabled = disabled;
}

@Override
public boolean onMenuItemClick(MenuItem menuItem) {
cancelled = false;
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface ContextMenuProps extends ViewProps {
*/
dropdownMenuMode?: boolean;
/**
* Currently iOS only. Disable menu interaction
* Disable menu interaction
*/
disabled?: boolean;
/**
Expand Down