Skip to content

An opinionated toast component for React.

Pause timer if toast appears when the document is hidden (#426)

Oleksii Teplenko3f4ec530074f
diff --git a/src/hooks.tsx b/src/hooks.tsx
index e5dd2db..ef0d524 100644
--- a/src/hooks.tsx
+++ b/src/hooks.tsx
@@ -1,7 +1,7 @@
import React from 'react';
export const useIsDocumentHidden = () => {
- const [isDocumentHidden, setIsDocumentHidden] = React.useState(false);
+ const [isDocumentHidden, setIsDocumentHidden] = React.useState(document.hidden);
React.useEffect(() => {
const callback = () => {