diff --git a/packages/react-json-tree/src/expandCollapseButtons.tsx b/packages/react-json-tree/src/expandCollapseButtons.tsx index 0f140e26..eff07219 100644 --- a/packages/react-json-tree/src/expandCollapseButtons.tsx +++ b/packages/react-json-tree/src/expandCollapseButtons.tsx @@ -6,7 +6,7 @@ import { faCheck, } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import React, { ReactNode, useState } from 'react'; +import React, { ReactNode, useEffect, useState } from 'react'; import { ExpandCollapseAll } from '.'; import { useExpandCollapseAllContext } from './expandCollapseContext'; import { StylingFunction } from 'react-base16-styling'; @@ -131,6 +131,12 @@ function CopyToClipboardButton({copyToClipboardIcon, copiedToClipboardIcon, valu setIsCopied(true) } + useEffect(() => { + if(isCopied){ + setTimeout(() => setIsCopied(false), 6000) + } + }, [isCopied]) + if(isCopied){ return (
{copiedToClipboardIcon || }