### Install React Navigation Dependencies Source: https://sheet.lodev09.com/guides/navigation Install the necessary React Navigation package before integrating TrueSheet. ```bash npm install @react-navigation/native ``` -------------------------------- ### Basic Sheet Navigator Setup Source: https://sheet.lodev09.com/guides/navigation Set up the Sheet Navigator for basic usage, defining a base screen and sheet screens with options. ```javascript import { NavigationContainer } from '@react-navigation/native'; import { createTrueSheetNavigator, useTrueSheetNavigation, } from '@lodev09/react-native-true-sheet/navigation'; const Sheet = createTrueSheetNavigator(); function App() { return ( {/* Base screen (first screen is the default) */} {/* Sheet screens */} ); } ``` -------------------------------- ### Install True Sheet with Expo Source: https://sheet.lodev09.com/blog/release-3-0 Use this command to install True Sheet if you are working with an Expo project. ```bash npx expo install @lodev09/react-native-true-sheet ``` -------------------------------- ### Configure Jest Mocks for TrueSheet Source: https://sheet.lodev09.com/guides/jest Add these mocks to your Jest setup file to enable testing of TrueSheet components. Ensure your Jest configuration includes the setup file and transforms the package correctly. ```javascript // jest.setup.js // Main component jest.mock('@lodev09/react-native-true-sheet', () => require('@lodev09/react-native-true-sheet/mock') ); // Navigation (if using) jest.mock('@lodev09/react-native-true-sheet/navigation', () => require('@lodev09/react-native-true-sheet/navigation/mock') ); // Reanimated (if using) jest.mock('@lodev09/react-native-true-sheet/reanimated', () => require('@lodev09/react-native-true-sheet/reanimated/mock') ); ``` ```json { "jest": { "setupFilesAfterEnv": ["/jest.setup.js"], "transformIgnorePatterns": [ "node_modules/(?!(react-native|@react-native|@lodev09/react-native-true-sheet)/)" ] } } ``` -------------------------------- ### Install True Sheet v3.4.0 for Android Source: https://sheet.lodev09.com/blog/android-stacking Use this command to install the latest version of True Sheet, which includes the new Android dimming and stacking features. ```bash yarn add @lodev09/react-native-true-sheet@^3.4.0 ``` -------------------------------- ### Setup TrueSheetProvider for Web Source: https://sheet.lodev09.com/guides/web Wrap your entire application with TrueSheetProvider to enable TrueSheet functionality on the web. This component is a pass-through on native platforms. ```javascript import { TrueSheetProvider } from '@lodev09/react-native-true-sheet' const App = () => { return ( ) } ``` -------------------------------- ### Add TrueSheet Skill to Project Source: https://sheet.lodev09.com/usage Install the TrueSheet Usage skill into your project using the npx command. This skill provides AI coding agents with knowledge about TrueSheet. ```bash npx skills add lodev09/react-native-true-sheet ``` -------------------------------- ### Clean and Reinstall iOS Dependencies Source: https://sheet.lodev09.com/migration Navigate to the ios directory, remove old build artifacts and pods, then reinstall dependencies using pod install. ```bash cd ios rm -rf Pods Podfile.lock build pod install cd .. ``` -------------------------------- ### Add True Sheet Package Source: https://sheet.lodev09.com/blog/release-3-9 Install True Sheet version 3.9.0 or later using yarn. ```bash yarn add @lodev09/react-native-true-sheet@^3.9.0 ``` -------------------------------- ### Install True Sheet 3.10 Source: https://sheet.lodev09.com/blog/release-3-10 Add True Sheet version 3.10 or later to your project using Yarn. ```bash yarn add @lodev09/react-native-true-sheet@^3.10.0 ``` -------------------------------- ### Install True Sheet with Yarn Source: https://sheet.lodev09.com/blog/release-3-0 Use this command to add True Sheet version 3.0.0 or higher to your project when using Yarn. ```bash yarn add @lodev09/react-native-true-sheet@^3.0.0 ``` -------------------------------- ### Expo Router Layout Setup Source: https://sheet.lodev09.com/guides/navigation Integrate TrueSheet with Expo Router by using `withLayoutContext` to create a navigator. This setup allows defining sheet screens with specific options like detents and corner radius. ```typescript app/ ├── _layout.tsx # TrueSheet navigator ├── index.tsx # Base content └── details.tsx # Sheet screen ``` ```typescript // app/_layout.tsx import { withLayoutContext } from 'expo-router'; import { createTrueSheetNavigator, type TrueSheetNavigationEventMap, type TrueSheetNavigationOptions, type TrueSheetNavigationState, } from '@lodev09/react-native-true-sheet/navigation'; import type { ParamListBase } from '@react-navigation/native'; const { Navigator } = createTrueSheetNavigator(); const Sheet = withLayoutContext< TrueSheetNavigationOptions, typeof Navigator, TrueSheetNavigationState, TrueSheetNavigationEventMap >(Navigator); export default function SheetLayout() { return ( ); } ``` -------------------------------- ### Handling TrueSheet Lifecycle Events Source: https://sheet.lodev09.com/reference/events This example demonstrates how to use various lifecycle events of TrueSheet, including onWillPresent, onDidPresent, onDetentChange, onWillDismiss, and onDidDismiss. It logs event details to the console for debugging and understanding the sheet's behavior. ```javascript const App = () => { const handleDismiss = () => { console.log('Bye bye') } const handleOnWillPresent = (e: WillPresentEvent) => { console.log(e.nativeEvent) // { index: 0, position: 123.5, detent: 0.5 } console.log('Sheet is about to be presented') } const handleOnDidPresent = (e: DidPresentEvent) => { console.log(e.nativeEvent) // { index: 0, position: 123.5, detent: 0.5 } } const handleDetentChange = (e: DetentChangeEvent) => { console.log(e.nativeEvent) // { index: 1, position: 234.5, detent: 0.8 } } return (