Commit Graph

9 Commits

Author SHA1 Message Date
lodev09
acdd9e4cf4
chore: update example deps 2025-12-28 08:20:08 +08:00
lodev09
8a42e3caac
chore: tidy clean script 2025-12-12 04:17:11 +08:00
lodev09
045333aec2
chore: pretty clean script 2025-12-12 03:23:55 +08:00
Jovanni Lo
4606a1bee9
refactor: reorganize examples with shared package (#306)
* feat(expo-example): update to match example app structure

- Add promise-based present/dismiss to TrueSheet.web.tsx
- Remove tabs navigation, use stack-based routing
- Add screens: Map, Standard, Modal, Test
- Add shared components and sheet components
- Add utils (constants, times, random)
- Add react-native-maps dependency

* feat(expo-example): add Map component and SheetStack with withLayoutContext

- Add platform-specific Map component (native MapView, web View fallback)
- Add sheet-stack route using expo-router's withLayoutContext
- Integrate createTrueSheetNavigator with expo-router file-based routing

* refactor: create shared example-shared package for common components

- Create @truesheet/example-shared workspace package
- Move common components (Button, Header, Footer, etc.) to shared
- Move sheet components (BasicSheet, PromptSheet, etc.) to shared
- Move utils (constants, times, random) to shared
- Update example and expo-example to re-export from shared

* chore: reorganize examples into examples/ folder

- Move example/ to examples/bare/
- Move expo-example/ to examples/expo/
- Move example-shared/ to examples/shared/
- Update workspace paths in root package.json
- Rename packages to @truesheet/bare-example, @truesheet/expo-example
- Update script names (example -> bare, expo)

* chore: update config paths for examples folder reorganization

* chore: rename examples to example and update package names to @example/*

* chore: move screen components to shared package

- Add MapScreen, ModalScreen, StandardScreen, TestScreen to shared
- Make screens navigation-agnostic with callback props
- Add MapComponent prop to MapScreen for platform-specific map
- Create Map component in bare example
- Update expo and bare examples to use shared screens

* chore: import screens directly from @example/shared/screens

* chore: import components and utils directly from @example/shared

* chore: remove unused sheets index files

* chore: move Map component to shared package

* chore: remove unused constants folder from expo example

* chore: remove unused ReanimatedExample component

* chore: update scripts for new example folder structure

* chore: exclude example folder from jest test paths

* chore: add expo prebuild step to clean script

* fix: update config paths for new example folder structure

* chore: categorize steps in clean script

* fix: use workspace:* for example dependencies

- Change @lodev09/react-native-true-sheet from * to workspace:* in bare and expo examples
- Fixes duplicate view registration error caused by npm version being installed alongside workspace
- Silence clean.sh script output while preserving error visibility
2025-12-12 03:08:20 +08:00
lodev09
928ad31482
chore: change prettier lint to warn 2025-11-30 23:26:04 +08:00
Jovanni Lo
7d969d29b9
feat: add support for Header (#233)
* feat(android): add immediate state update with screen width on initialization

- Add getScreenWidth() utility method to ScreenUtils for consistent screen calculations
- Update TrueSheetView to immediately update state when stateWrapper is set
- Ensures initial container width is available before controller emits size changes
- Improves initial render performance and prevents layout shift

* fix(ios): move state update to didLayoutSubviews for more accurate size

- Reset _lastStateSize in prepareForRecycle
- Updated example sheets

* fix(android): fix proper container height calculation

* feat: add native header view component

- Add TrueSheetHeaderView native component for iOS and Android
- Add header prop to TrueSheet component
- Subtract header height from container height in state for proper content layout
- Update documentation for header feature

* refactor(android): better content height lifecycle

* fix(android): handle header size changes

* feat(ios): add header height to auto detent calculation

- Add headerHeight property to TrueSheetViewController
- Include header height in totalHeight for auto detent calculation
- Implement containerViewHeaderDidChangeSize delegate in TrueSheetView
- Add headerHeight method to TrueSheetContainerView
- Simplify scroll view pinning by passing header view directly
- Re-apply scroll view pinning when header is added/removed
- Update TrueSheetHeaderView registration in package.json codegenConfig
- Update AGENTS.md with current project structure
- Simplify migration.mdx examples

* fix(ios): always re-apply scroll view pinning on header change

* fix(ios): properly re-pin scroll view when header changes

- Rename pinScrollView to scrollViewPinningEnabled for clarity
- Track scrollViewPinningSet flag to handle header mount/unmount
- Re-apply scroll view pinning when header is mounted/unmounted
- Fix unpinView to remove constraints from parent view
- Call headerDidChangeSize delegate on header mount/unmount

* feat: add all ViewProps to sheet

* docs: move scrolling caution to troubleshooting and add minHeight workaround

* fix(android): fix proper ...rest props

* docs: update migration

* fix(android): reconfigure sheet when header size changes

* fix(android): footer touch events when sheet is fully expanded
2025-11-26 23:24:33 +08:00
Jovanni Lo
248b64de25
feat: move Fabric state wrapper to host view (#230)
* feat: move state wrapper from container view to host view

* fix(ios): call updateStateIfNeeded on every state update

* fix(ios): handle device rotation and only track width changes

* feat(android): align state update flow with iOS

* chore: improve clean script with colors
2025-11-26 03:32:22 +08:00
lodev09
2afafcf344
chore: update clean script 2025-03-06 05:47:39 +08:00
Jovanni Lo
74ef9b49b1
Feat: Drag events & Reanimated support (#124)
* fix(ios): correct sizeInfo on present

* chore(ios): decrease min ios version

* feat(ios): add drag events

* chore: update builder-bob

* chore(android): put back gesture handler and add todo

* chore: disable new-arch, clip android background, update example

* feat(android): implement drag events

* chore: update clean script

* feat: implement reanimated (not yet working)

* chore: tidy

* feat(ios): support reanimated events

* refactor(ios): use synthetic data for events

* refactor(android): events

* fix(ios): correct size when changing size programmatically

* refactor(android): consistency with ios

* docs: add reanimated guide

* refactor(android): normalize event dispatcher

* refactor(android): organize code

* chore: tidy
2025-02-10 10:08:30 +08:00