Skip to content

menuItems()

function menuItems(menu): 
  | HookExtension<HookEvent<"selection", CustomMenuSelectionEvent>>
  | null;

The text selection menu: react-native-webview's menuItems, suppressMenuItems and onCustomMenuSelection.

items replace the system's items, onSelect gets the one chosen, and on iOS suppress hides system items.

Turn it on when the WebView is created. After that, a change, switching it off included, applies to the next menu.

Its hook makes the WebView from a class of its own. When another hook's webViewClass or webViewFactory, registered earlier, makes it instead, there is no menu and the core warns.

Parameters

Parameter Type Description
menu { items?: readonly MenuItem[]; onSelect?: (event) => void; suppress?: readonly SuppressMenuItem[]; } -
menu.items? readonly MenuItem[] -
menu.onSelect? (event) => void -
menu.suppress? readonly SuppressMenuItem[] iOS

Returns

| HookExtension<HookEvent<"selection", CustomMenuSelectionEvent>> | null

Null when items is unset and, on iOS, suppress is too.