From c1712edbda2ace9ccacef771b7ffaa9db1a13017 Mon Sep 17 00:00:00 2001 From: G Date: Mon, 27 May 2024 15:55:31 +0000 Subject: [PATCH] separate modal and backdrop, currently only loading modal is done. testing still need to happen --- src/components/modals/LoadingModal.tsx | 28 ++++++++++++++++++++++++++++ src/contexts/Overlay.tsx | 21 +++++++++++++-------- 2 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 src/components/modals/LoadingModal.tsx diff --git a/src/components/modals/LoadingModal.tsx b/src/components/modals/LoadingModal.tsx new file mode 100644 index 0000000..c8d7aa5 --- /dev/null +++ b/src/components/modals/LoadingModal.tsx @@ -0,0 +1,28 @@ +import Box from "@components/bases/Box"; +import { ActivityIndicator, Text } from "react-native"; + +const LoadingModal = () => { + return ( + + + Veuillez patienter + + ); +}; + +export default LoadingModal; diff --git a/src/contexts/Overlay.tsx b/src/contexts/Overlay.tsx index 54ac5de..9e4b4a1 100644 --- a/src/contexts/Overlay.tsx +++ b/src/contexts/Overlay.tsx @@ -1,3 +1,4 @@ +import LoadingModal from "@components/modals/LoadingModal"; import { createContext, useContext, useState } from "react"; import { View } from "react-native"; @@ -12,14 +13,17 @@ export const OverlayContext = createContext({ }); export const OverlayProvider = ({ children }: { children: React.ReactNode }) => { - const [overlayVisible, setOverlayVisible] = useState(false); + const [showBackdrop, setShowBackdrop] = useState(true); + const [loadingModalVisible, setLoadingModalVisible] = useState(true); const showOverlay = () => { - setOverlayVisible(true); + setShowBackdrop(true); + setLoadingModalVisible(true); }; const hideOverlay = () => { - setOverlayVisible(false); + setShowBackdrop(false); + setLoadingModalVisible(false); }; return ( @@ -30,8 +34,9 @@ export const OverlayProvider = ({ children }: { children: React.ReactNode }) => }} > {children} - {/* */} - {overlayVisible && } + {showBackdrop && } + + {loadingModalVisible && } ); }; @@ -40,15 +45,15 @@ export const useOverlayContext = () => { return useContext(OverlayContext); }; -const OverlayComponent = () => { +const OverlayBackdrop = () => { return (