From 9eefc1642a5562409b99c3bed981826a05801839 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 14 Feb 2021 13:56:51 +0100 Subject: [PATCH] fix(SnackbarProvider): resolve context error --- phone/src/apps/notes/NotesApp.tsx | 2 -- phone/src/ui/components/SnackbarProvider.tsx | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx index 30563a9..8a880e8 100644 --- a/phone/src/apps/notes/NotesApp.tsx +++ b/phone/src/apps/notes/NotesApp.tsx @@ -15,8 +15,6 @@ import { useNoteDetail } from './hooks/useNoteDetail'; import useStyles from './notes.styles'; import InjectDebugData from '../../os/debug/InjectDebugData'; -import { useSnackbar } from '../../ui/hooks/useSnackbar'; -import { useTranslation } from 'react-i18next'; InjectDebugData([ { diff --git a/phone/src/ui/components/SnackbarProvider.tsx b/phone/src/ui/components/SnackbarProvider.tsx index 17dc955..40a6b03 100644 --- a/phone/src/ui/components/SnackbarProvider.tsx +++ b/phone/src/ui/components/SnackbarProvider.tsx @@ -2,7 +2,7 @@ import React, { createContext, useState, useEffect, useRef } from 'react'; import { IAlert } from '../hooks/useSnackbar'; -export const SnackbarContext = createContext({ addAlert: (a: IAlert) => {} }); +export const SnackbarContext = createContext(null); function SnackbarProvider({ children }) { const [alert, setAlert] = useState(null); @@ -13,7 +13,7 @@ function SnackbarProvider({ children }) { clearTimeout(timer.current) timer.current = setTimeout(() => { setAlert(null) - }, 2500); + }, 1000); } return () => clearTimeout(timer.current) }, [alert]);