Commit Graph

7 Commits

Author SHA1 Message Date
lodev09
acdd9e4cf4
chore: update example deps 2025-12-28 08:20:08 +08:00
lodev09
ed1346b346
fix(ios): add compile-time check for iOS 26.1+ APIs 2025-12-27 00:42:00 +08:00
lodev09
b156ad77d2
ci: maybe improve build-ios workflow 2025-12-26 01:10:06 +08:00
Jovanni Lo
b09440d548
fix(ios): use native backgroundEffect for blur on iOS 26.1+ (#350)
* fix(ios): use native backgroundEffect for blur on iOS 26.1+

- Extract blur style mapping into BlurUtil
- Refactor setupBackground and setupGrabber into helper methods
- Add sheet getter for cleaner code
- Use native UIBlurEffect on backgroundEffect when only blurTint is set (iOS 26.1+)

* refactor: rename blurTint to backgroundBlur
2025-12-25 17:59:55 +08:00
Jovanni Lo
c88fb1c037
feat(android): improve transition animations and refactor detent calculations (#337)
* feat: update slide animation styles

* fix: move rn-screen observer to preAttached and detached

* feat(android): implement programmatic slide animations for present/dismiss

* refactor(android): cleanup unused animation resources and fix present animation flash

* fix(android): animate footer with sheet during present/dismiss

* refactor(android): sync dim alpha with sheet translation during animations

- Update updateDimAmount() to accept optional sheetTop parameter
- Call updateDimAmount() on each frame during present/dismiss animations
- Remove unused animateDimAlpha() from TrueSheetViewController
- Remove unused animateAlpha() from TrueSheetDimView

* refactor(android): cleanup TrueSheetViewController

- Remove unused imports (Log, ViewCompat)
- Remove unused positionAnimator and setupTransitionTracker
- Use AnimatorListenerAdapter instead of full Animator.AnimatorListener
- Simplify comments and remove debug logs

* fix: move setup methods out of onShowListener

* refactor: make methods consistent

* refactor(android): use alpha + window flags for modal hide/show

- Use alpha fade instead of visibility for hiding sheet during RN Screens modal
- Add FLAG_NOT_TOUCHABLE and FLAG_NOT_FOCUSABLE to prevent interaction when hidden
- Remove unused TrueSheetSlideAnimation style and anim resources

* feat: translate bottomSheetView instead of setupSheetDetents with keyboard

* fix(android): clamp sheet translation during drag to prevent going beyond visible screen

* feat(android): dismiss keyboard when sheet is dragged down to a lower detent

* feat(android): expand to last detent on keyboard show, restore on hide

- Refactor keyboard observer delegate callbacks
- Track pre-keyboard detent and restore on hide
- Skip emitting detent change for keyboard transitions
- Fix 2-detent state map to include STATE_HALF_EXPANDED

* refactor(android): extract TrueSheetDetentCalculator and TrueSheetAnimator

- Extract detent calculations into TrueSheetDetentCalculator class
- Extract present/dismiss animations into TrueSheetAnimator class
- Use interface-based pattern for dynamic prop updates
- Consolidate state variables (InteractionState, KeyboardState)
- Reduce TrueSheetViewController from ~900 to ~650 lines

* refactor(ios): extract TrueSheetDetentCalculator from TrueSheetViewController

- Create TrueSheetDetentCalculator with TrueSheetDetentMeasurements protocol
- Extract detent calculation methods: detentValueForIndex, estimatedPositionForIndex,
  findSegmentForPosition, interpolatedIndexForPosition, interpolatedDetentForPosition
- TrueSheetViewController conforms to protocol for dynamic prop access
- Mirrors Android's interface-based pattern for consistency

* feat(android): skip keyboard handling when sheet is not topmost or hidden by modal

* feat(android): use setupSheetDetents for keyboard handling instead of Y translation

* feat(android): dismiss keyboard when dragged below original position

* chore: run tidy
2025-12-18 00:50:50 +08:00
Jovanni Lo
f3df5e2681
feat: add adaptive grabber color for light/dark mode (#325)
* feat(android): adaptive grabber color based on light/dark mode

* feat: add adaptive option to grabber for light/dark mode support
2025-12-15 05:20:07 +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