最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

react native - How do I replace a webView menuItem when one of the menu is clicked? - Stack Overflow

programmeradmin6浏览0评论

When a menu item is selected, e.g highlight, I want to replace show colours to be selected within the same context menu. the defaultMenuItems should be replaced with the highlightMenuItems

const defaultMenuItems = [
    {
      label: "Tweet",
      key: "tweet",
    },
    {
      label: "Save",
      key: "save",
    },
    {
      label: "Highlight",
      key: "highlight",
    },
    {
      label: "Copy",
      key: "copy",
    },
  ];

  const highlightMenuItems = [
    {
      key: "red",
      label: "Red",
    },
    {
      key: "green",
      label: "Green",
    },
    {
      key: "blue",
      label: "Blue",
    },
  ];

  return (
    <WebView
      style={styles.container}
      source={{ uri: "; }}
      menuItems={defaultMenuItems}
      onCustomMenuSelection={handleCustomMenuSelection}
    />
  );
发布评论

评论列表(0)

  1. 暂无评论