diff --git a/GLOBAL_MODAL_GUIDE.md b/GLOBAL_MODAL_GUIDE.md new file mode 100644 index 00000000..28e96cf5 --- /dev/null +++ b/GLOBAL_MODAL_GUIDE.md @@ -0,0 +1,193 @@ +# Global Modal System with Gorhom Bottom Sheet + +This guide explains how to use the global modal system implemented in this project. + +## Overview + +The global modal system allows you to trigger a bottom sheet modal from anywhere in your app programmatically, and render any component inside it. + +## Architecture + +The system consists of three main parts: + +1. **GlobalModalProvider** (`providers/GlobalModalProvider.tsx`) - Context provider that manages modal state +2. **GlobalModal** (`components/GlobalModal.tsx`) - The actual modal component rendered at root level +3. **useGlobalModal** hook - Hook to interact with the modal from anywhere + +## Setup (Already Configured) + +The system is already integrated into your app: + +```tsx +// In app/_layout.tsx + + + {/* Your app content */} + + + +``` + +## Usage + +### Basic Usage + +```tsx +import { useGlobalModal } from "@/providers/GlobalModalProvider"; +import { View, Text } from "react-native"; + +function MyComponent() { + const { showModal, hideModal } = useGlobalModal(); + + const handleOpenModal = () => { + showModal( + + Hello from Modal! + + ); + }; + + return ( +