iamskok / gatsby-remark-code-buttons

Buttons for code snippets 🔘
https://gatsby-dev-blog-starter.netlify.com/blog/building-your-first-react-app
19 stars 9 forks source link

Expected `onClick` listener to be a function, instead got a value of `string` type. #12

Open linneaherman opened 4 years ago

linneaherman commented 4 years ago

When trying to use this plugin I get the error mentioned in the title when clicking on the copy-button.

Full error:

index.js:1 Warning: Expected `onClick` listener to be a function, instead got a value of `string` type.
    in div (created by Ast)
    in div (created by Ast)
    in Ast (at PostContent.tsx:27)
    in section (created by Context.Consumer)
    in PostFullContent (at PostContent.tsx:25)
    in PostContent (at post.tsx:324)
    in article (created by Context.Consumer)
    in EmotionCssPropInternal (at post.tsx:274)
    in div (created by Context.Consumer)
    in EmotionCssPropInternal (at post.tsx:271)
    in main (created by Context.Consumer)
    in EmotionCssPropInternal (at post.tsx:265)
    in div (created by Context.Consumer)
    in StyledWrapper (at Wrapper.tsx:9)
    in Wrapper (created by Context.Consumer)
    in EmotionCssPropInternal (at post.tsx:257)
    in div (at layouts/index.tsx:17)
    in IndexLayout (at post.tsx:199)
    in PageTemplate (created by HotExportedPageTemplate)
    in AppContainer (created by HotExportedPageTemplate)
    in HotExportedPageTemplate (created by PageRenderer)
    in PageRenderer (at query-result-store.js:86)
    in PageQueryStore (at root.js:56)
    in RouteHandler (at root.js:78)
    in div (created by FocusHandlerImpl)
    in FocusHandlerImpl (created by Context.Consumer)
    in FocusHandler (created by RouterImpl)
    in RouterImpl (created by Context.Consumer)
    in Location (created by Context.Consumer)
    in Router (at root.js:73)
    in ScrollHandler (at root.js:69)
    in RouteUpdates (at root.js:68)
    in EnsureResources (at root.js:66)
    in LocationHandler (at root.js:124)
    in LocationProvider (created by Context.Consumer)
    in Location (at root.js:123)
    in Root (at root.js:132)
    in StaticQueryStore (at root.js:138)
    in _default (at app.js:115)

here is my list of plugins in gatsby-config.js:

plugins: [

    'gatsby-plugin-sitemap',
    {
      resolve: 'gatsby-plugin-sharp',
      options: {
        quality: 100,
        stripMetadata: true,
      },
    },
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        name: 'content',
        path: path.join(__dirname, 'src', 'content'),
      },
    },
    {
      resolve: 'gatsby-transformer-remark',
      options: {
        plugins: [
          {
            resolve: 'gatsby-remark-responsive-iframe',
            options: {
              wrapperStyle: 'margin-bottom: 1rem',
            },
          },
          {
            resolve: "gatsby-remark-code-buttons",
            options: {
              tooltipText: 'Copy to clipboard',
              toasterText: "Copied to clipboard",
              toasterDuration: 5000,
            },
          },
          'gatsby-remark-prismjs',
          'gatsby-remark-copy-linked-files',
          'gatsby-remark-smartypants',
          'gatsby-remark-abbr',
          {
            resolve: 'gatsby-remark-katex',
            options: {
              // Add any KaTeX options from https://github.com/KaTeX/KaTeX/blob/master/docs/options.md here
              strict: 'ignore'
            }
          },
          {
            resolve: 'gatsby-remark-images',
            options: {
              maxWidth: 2000,
              quality: 100,
            },
          },
        ],
      },
    },
    'gatsby-transformer-json',
    'gatsby-plugin-emotion',
    'gatsby-plugin-typescript',
    'gatsby-transformer-sharp',
    'gatsby-plugin-react-helmet',
    'gatsby-transformer-yaml',
    'gatsby-plugin-feed',
    {
      resolve: 'gatsby-plugin-postcss',
      options: {
        postCssPlugins: [require('postcss-color-function'), require('cssnano')()],
      },
    },
    },
  ]
jonnysmillie commented 2 years ago

Interested to see if anyone has a fix for this or knows why it happens.