Skip to content

Latest commit

Β 

History

History
90 lines (64 loc) Β· 3.44 KB

File metadata and controls

90 lines (64 loc) Β· 3.44 KB

Agent Instructions

Rules

  1. YOU MUST NOT do builds unless you are told to.
  2. YOU MUST NOT commit changes yourself until I explicitly tell you to.
  3. YOU MUST NOT create summary documents unless you are told to.
  4. YOU MUST NOT add code comments that are obvious.

Project Overview

React Native Fabric (New Architecture) bottom sheet library for iOS and Android.

  • Fabric - No bridge, direct C++ communication
  • Codegen - Auto-generates native interfaces from TypeScript specs
  • C++ Shared Code - State and shadow nodes shared between platforms

Project Structure

src/
β”œβ”€β”€ fabric/         # Native component specs (codegen input)
β”œβ”€β”€ specs/          # TurboModule spec
β”œβ”€β”€ reanimated/     # Reanimated integration
β”œβ”€β”€ navigation/     # React Navigation integration
β”œβ”€β”€ mocks/          # Testing mocks
β”œβ”€β”€ __tests__/      # Unit tests
β”œβ”€β”€ TrueSheet.tsx   # Main React component
└── *.web.tsx       # Web implementations

ios/
β”œβ”€β”€ TrueSheetView.mm           # Host view (Fabric component)
β”œβ”€β”€ TrueSheetViewController.mm # Sheet presentation controller
β”œβ”€β”€ TrueSheetModule.mm         # TurboModule
β”œβ”€β”€ TrueSheet*View.mm          # Container/Content/Header/Footer views
β”œβ”€β”€ core/                      # BlurView, DetentCalculator, GrabberView
β”œβ”€β”€ events/                    # Drag, Focus, Lifecycle, State events
└── utils/                     # Blur, Gesture, Layout, Window utilities

android/.../truesheet/
β”œβ”€β”€ TrueSheetView.kt           # Host view
β”œβ”€β”€ TrueSheetViewController.kt # BottomSheet controller
β”œβ”€β”€ TrueSheetModule.kt         # TurboModule
β”œβ”€β”€ TrueSheet*View.kt          # Container/Content/Header/Footer views
β”œβ”€β”€ TrueSheet*ViewManager.kt   # View managers
β”œβ”€β”€ core/                      # BottomSheetView, CoordinatorLayout, etc.
β”œβ”€β”€ events/                    # Drag, Focus, Lifecycle, State events
└── utils/                     # Keyboard, Screen utilities

common/cpp/.../TrueSheetSpec/  # Shared C++ state and shadow nodes

View Hierarchy

Both platforms: TrueSheetView (hidden host) β†’ Controller β†’ ContainerView β†’ Header/Content/Footer

  • iOS: Uses UISheetPresentationController for native sheet behavior
  • Android: Uses CoordinatorLayout + BottomSheetBehavior with a DimView behind the sheet

Common Tasks

Adding a new prop

  1. Add to src/fabric/TrueSheetViewNativeComponent.ts
  2. Build the app (runs codegen)
  3. Implement in TrueSheetView.mm (iOS) and TrueSheetViewManager.kt (Android)

Adding a new event

  1. Add DirectEventHandler to native component spec
  2. Create event class in ios/events/ and android/.../events/
  3. Emit from native view

Creating a Pull Request

When creating a PR, use the template from .github/PULL_REQUEST_TEMPLATE.md.

After creating a PR, always update CHANGELOG.md. Do this immediately after creating the PR, before moving on to other tasks.

Changelog

Add entry to Unreleased section in CHANGELOG.md for user-facing changes:

  • πŸŽ‰ New features - New functionality
  • πŸ› Bug fixes - Bug fixes
  • πŸ’‘ Others - Refactors, internal changes

Format: - **Platform**: Description. ([#123](https://github.com/lodev09/react-native-true-sheet/pull/123) by [@username](https://github.com/username))

Sort entries by platform: iOS first, then Android, then Web, then cross-platform or unscoped entries last.