diff --git a/src/contexts/ModalsManagerContext.tsx b/src/contexts/ModalsManagerContext.tsx
index abe286e..5d83af6 100644
--- a/src/contexts/ModalsManagerContext.tsx
+++ b/src/contexts/ModalsManagerContext.tsx
@@ -1,4 +1,4 @@
-import { createContext, useContext, useState } from "react";
+import { createContext, useContext, useEffect, useState } from "react";
import { View } from "react-native";
export interface ImodalsManagerContext {
@@ -26,6 +26,13 @@ export const ModalsManagerProvider = ({ children }: { children: React.ReactNode
setShowBackdrop(false);
};
+ useEffect(() => {
+ return () => {
+ setShowBackdrop(false);
+ setModalElement(null);
+ };
+ }, []);
+
return (
{children}
- {showBackdrop && }
- {modalElement && modalElement}
+
+ {modalElement && (
+ <>
+
+ {modalElement}
+ >
+ )}
);
};
@@ -44,6 +56,8 @@ export const useModalsManagerContext = () => {
return useContext(ModalsManagerContext);
};
+export const OVERLAY_BACKDROP_Z_INDEX = 10;
+
const OverlayBackdrop = () => {
return (
{
height: "100%",
// justifyContent: "center",
// alignItems: "center",
- zIndex: 10,
+ zIndex: OVERLAY_BACKDROP_Z_INDEX,
backgroundColor: "black",
opacity: 0.5,
position: "absolute",