@lodev09/react-native-true-sheet 4.0.0-beta.1 → 4.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -4
- package/android/build.gradle +22 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +24 -7
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +211 -182
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +5 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +14 -19
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +106 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +2 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +18 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +82 -39
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +275 -88
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +26 -1
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +75 -3
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +56 -34
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +15 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/KeyboardUtils.kt +1 -1
- package/android/src/main/java/com/lodev09/truesheet/utils/TouchEventDeduper.kt +31 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +19 -7
- package/android/src/main/jni/TrueSheetSpec.h +1 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +0 -8
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +52 -29
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +6 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +6 -4
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +7 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +46 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +36 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +4 -35
- package/ios/TrueSheetContainerView.h +14 -7
- package/ios/TrueSheetContainerView.mm +10 -7
- package/ios/TrueSheetContentView.h +31 -15
- package/ios/TrueSheetContentView.mm +148 -188
- package/ios/TrueSheetFooterView.h +6 -0
- package/ios/TrueSheetFooterView.mm +48 -2
- package/ios/TrueSheetModule.h +2 -7
- package/ios/TrueSheetModule.mm +7 -16
- package/ios/TrueSheetOverlayView.h +32 -0
- package/ios/TrueSheetOverlayView.mm +161 -0
- package/ios/TrueSheetView.mm +171 -29
- package/ios/TrueSheetViewController.h +10 -0
- package/ios/TrueSheetViewController.mm +256 -74
- package/ios/core/TrueSheetGrabberView.mm +13 -3
- package/ios/core/TrueSheetOverlayContainerView.h +31 -0
- package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
- package/ios/events/TrueSheetLifecycleEvents.h +2 -0
- package/ios/events/TrueSheetLifecycleEvents.mm +8 -0
- package/ios/tvos/TrueSheetStubs.mm +12 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.h +1 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.mm +24 -2
- package/lib/module/TrueSheet.js +149 -34
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +122 -53
- package/lib/module/TrueSheet.web.js.map +1 -1
- package/lib/module/TrueSheetOverlay.js +30 -0
- package/lib/module/TrueSheetOverlay.js.map +1 -0
- package/lib/module/TrueSheetOverlay.web.js +35 -0
- package/lib/module/TrueSheetOverlay.web.js.map +1 -0
- package/lib/module/TrueSheetPeek.web.js +3 -3
- package/lib/module/TrueSheetPeek.web.js.map +1 -1
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +5 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +10 -0
- package/lib/module/mocks/index.js.map +1 -1
- package/lib/module/mocks/navigation.js +31 -21
- package/lib/module/mocks/navigation.js.map +1 -1
- package/lib/module/mocks/navigationExpoRouter.js +21 -0
- package/lib/module/mocks/navigationExpoRouter.js.map +1 -0
- package/lib/module/mocks/reanimated.js +1 -1
- package/lib/module/mocks/reanimated.js.map +1 -1
- package/lib/module/navigation/{TrueSheetView.js → TrueSheetNavigatorContent.js} +14 -12
- package/lib/module/navigation/TrueSheetNavigatorContent.js.map +1 -0
- package/lib/module/navigation/actions.js +50 -0
- package/lib/module/navigation/actions.js.map +1 -0
- package/lib/module/navigation/base-types.js +2 -0
- package/lib/module/navigation/base-types.js.map +1 -0
- package/lib/module/navigation/{TrueSheetRouter.js → createTrueSheetRouter.js} +11 -24
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -0
- package/lib/module/navigation/expo-router/base-types.js +2 -0
- package/lib/module/navigation/expo-router/base-types.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +50 -0
- package/lib/module/navigation/expo-router/index.js.map +1 -0
- package/lib/module/navigation/expo-router/types.js +4 -0
- package/lib/module/navigation/expo-router/types.js.map +1 -0
- package/lib/module/navigation/index.js +43 -2
- package/lib/module/navigation/index.js.map +1 -1
- package/lib/module/navigation/navigator.js +10 -0
- package/lib/module/navigation/navigator.js.map +1 -0
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js +2 -2
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js.map +1 -1
- package/lib/module/navigation/screen/TrueSheetScreen.js +2 -2
- package/lib/module/navigation/screen/TrueSheetScreen.js.map +1 -1
- package/lib/module/navigation/screen/useSheetScreenState.js +5 -4
- package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -1
- package/lib/module/navigation/useTrueSheetNavigation.js +1 -1
- package/lib/module/navigation/useTrueSheetNavigation.js.map +1 -1
- package/lib/module/web/dom.js +10 -0
- package/lib/module/web/dom.js.map +1 -0
- package/lib/module/web/vaul/constants.js +4 -0
- package/lib/module/web/vaul/constants.js.map +1 -1
- package/lib/module/web/vaul/context.js.map +1 -1
- package/lib/module/web/vaul/helpers.js +10 -4
- package/lib/module/web/vaul/helpers.js.map +1 -1
- package/lib/module/web/vaul/index.js +35 -2
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +6 -0
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +72 -1
- package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +4 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +4 -0
- package/lib/typescript/src/mocks/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/navigation.d.ts +5 -1
- package/lib/typescript/src/mocks/navigation.d.ts.map +1 -1
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +22 -0
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -0
- package/lib/typescript/src/mocks/reanimated.d.ts.map +1 -1
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts +5 -0
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts.map +1 -0
- package/lib/typescript/src/navigation/actions.d.ts +71 -0
- package/lib/typescript/src/navigation/actions.d.ts.map +1 -0
- package/lib/typescript/src/navigation/base-types.d.ts +9 -0
- package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +3 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts +37 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/index.d.ts +42 -3
- package/lib/typescript/src/navigation/index.d.ts.map +1 -1
- package/lib/typescript/src/navigation/navigator.d.ts +7 -0
- package/lib/typescript/src/navigation/navigator.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts +1 -1
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts +1 -1
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/types.d.ts +3 -4
- package/lib/typescript/src/navigation/screen/types.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +5 -6
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +65 -5
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts +1 -1
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts.map +1 -1
- package/lib/typescript/src/web/dom.d.ts +7 -0
- package/lib/typescript/src/web/dom.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/context.d.ts +1 -0
- package/lib/typescript/src/web/vaul/context.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/helpers.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/index.d.ts +7 -1
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/package.json +32 -9
- package/react-native.config.js +1 -0
- package/src/TrueSheet.tsx +184 -46
- package/src/TrueSheet.types.ts +77 -1
- package/src/TrueSheet.web.tsx +135 -64
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/TrueSheetPeek.web.tsx +4 -3
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +5 -0
- package/src/index.ts +1 -0
- package/src/mocks/index.ts +7 -0
- package/src/mocks/navigation.ts +32 -25
- package/src/mocks/navigationExpoRouter.ts +41 -0
- package/src/mocks/reanimated.ts +8 -9
- package/src/navigation/{TrueSheetView.tsx → TrueSheetNavigatorContent.tsx} +24 -17
- package/src/navigation/actions.ts +78 -0
- package/src/navigation/base-types.ts +20 -0
- package/src/navigation/createTrueSheetRouter.ts +194 -0
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/index.ts +90 -0
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +68 -2
- package/src/navigation/navigator.ts +18 -0
- package/src/navigation/screen/ReanimatedTrueSheetScreen.tsx +2 -2
- package/src/navigation/screen/TrueSheetScreen.tsx +2 -2
- package/src/navigation/screen/types.ts +4 -6
- package/src/navigation/screen/useSheetScreenState.ts +10 -15
- package/src/navigation/types.ts +99 -16
- package/src/navigation/useTrueSheetNavigation.ts +1 -1
- package/src/web/dom.ts +9 -0
- package/src/web/vaul/constants.ts +4 -0
- package/src/web/vaul/context.ts +1 -0
- package/src/web/vaul/helpers.ts +13 -6
- package/src/web/vaul/index.tsx +46 -1
- package/lib/module/navigation/TrueSheetRouter.js.map +0 -1
- package/lib/module/navigation/TrueSheetView.js.map +0 -1
- package/lib/module/navigation/createTrueSheetNavigator.js +0 -63
- package/lib/module/navigation/createTrueSheetNavigator.js.map +0 -1
- package/lib/typescript/src/navigation/TrueSheetRouter.d.ts +0 -57
- package/lib/typescript/src/navigation/TrueSheetRouter.d.ts.map +0 -1
- package/lib/typescript/src/navigation/TrueSheetView.d.ts +0 -10
- package/lib/typescript/src/navigation/TrueSheetView.d.ts.map +0 -1
- package/lib/typescript/src/navigation/createTrueSheetNavigator.d.ts +0 -35
- package/lib/typescript/src/navigation/createTrueSheetNavigator.d.ts.map +0 -1
- package/src/navigation/TrueSheetRouter.ts +0 -234
- package/src/navigation/createTrueSheetNavigator.tsx +0 -93
package/src/web/vaul/index.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import { isIOS, isMobileFirefox } from './browser';
|
|
|
12
12
|
import {
|
|
13
13
|
BORDER_RADIUS,
|
|
14
14
|
CLOSE_THRESHOLD,
|
|
15
|
+
DISMISS_ATTEMPT_THRESHOLD,
|
|
15
16
|
DRAG_CLASS,
|
|
16
17
|
NESTED_DISPLACEMENT,
|
|
17
18
|
SCROLL_LOCK_TIMEOUT,
|
|
@@ -93,6 +94,12 @@ export type DialogProps = {
|
|
|
93
94
|
* @default true
|
|
94
95
|
*/
|
|
95
96
|
dismissible?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Called when the user tries to close a non-dismissible drawer — dragging down
|
|
99
|
+
* at the first snap point, pressing escape, or tapping the handle of a
|
|
100
|
+
* single-snap-point drawer. Overlay clicks don't count, mirroring iOS.
|
|
101
|
+
*/
|
|
102
|
+
onDismissAttempt?: () => void;
|
|
96
103
|
/**
|
|
97
104
|
* When `false` the drawer can't be dragged by the user. Programmatic snap-point
|
|
98
105
|
* changes still animate. Defaults to `true`.
|
|
@@ -218,6 +225,7 @@ export function Root({
|
|
|
218
225
|
closeThreshold = CLOSE_THRESHOLD,
|
|
219
226
|
scrollLockTimeout = SCROLL_LOCK_TIMEOUT,
|
|
220
227
|
dismissible = true,
|
|
228
|
+
onDismissAttempt,
|
|
221
229
|
draggable = true,
|
|
222
230
|
handleOnly = false,
|
|
223
231
|
fadeFromIndex = snapPoints && snapPoints.length - 1,
|
|
@@ -274,6 +282,7 @@ export function Root({
|
|
|
274
282
|
const isAllowedToDrag = React.useRef<boolean>(false);
|
|
275
283
|
const nestedOpenChangeTimer = React.useRef<NodeJS.Timeout | null>(null);
|
|
276
284
|
const pointerStart = React.useRef(0);
|
|
285
|
+
const dismissAttempted = React.useRef(false);
|
|
277
286
|
const keyboardIsOpen = React.useRef(false);
|
|
278
287
|
const shouldAnimate = React.useRef(!defaultOpen);
|
|
279
288
|
const previousDiffFromInitial = React.useRef(0);
|
|
@@ -517,7 +526,17 @@ export function Root({
|
|
|
517
526
|
const noCloseSnapPointsPreCondition = snapPoints && !dismissible && !isDraggingInDirection;
|
|
518
527
|
|
|
519
528
|
// Disallow dragging down to close when first snap point is the active one and dismissible prop is set to false.
|
|
520
|
-
if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0)
|
|
529
|
+
if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) {
|
|
530
|
+
// The drawer stays put. Remember a deliberate pull that would otherwise
|
|
531
|
+
// have dragged it (content at its top) so release() can report it.
|
|
532
|
+
if (
|
|
533
|
+
-draggedDistance > DISMISS_ATTEMPT_THRESHOLD &&
|
|
534
|
+
(isAllowedToDrag.current || shouldDrag(event.target, isDraggingInDirection))
|
|
535
|
+
) {
|
|
536
|
+
dismissAttempted.current = true;
|
|
537
|
+
}
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
521
540
|
|
|
522
541
|
// We need to capture last time when drag with scroll was triggered and have a timeout between
|
|
523
542
|
const absDraggedDistance = Math.abs(draggedDistance);
|
|
@@ -778,6 +797,21 @@ export function Root({
|
|
|
778
797
|
unfreezeScrollables();
|
|
779
798
|
setIsDragging(false);
|
|
780
799
|
dragEndTime.current = new Date();
|
|
800
|
+
|
|
801
|
+
if (dismissAttempted.current) {
|
|
802
|
+
dismissAttempted.current = false;
|
|
803
|
+
if (isOpen) onDismissAttempt?.();
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// The press that started this "drag" may have dismissed the drawer (e.g. a
|
|
807
|
+
// back button acting on pointerdown). Snapping now would overwrite the
|
|
808
|
+
// dismiss transform that closeDrawer just wrote and freeze the sheet in
|
|
809
|
+
// place until it unmounts.
|
|
810
|
+
if (!isOpen) {
|
|
811
|
+
if (pointerEvent) onReleaseProp?.(pointerEvent, false);
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
|
|
781
815
|
const swipeAmount = getTranslate(drawerRef.current, direction);
|
|
782
816
|
|
|
783
817
|
// Drag overshoot below the lowest snap point translates the detached
|
|
@@ -966,6 +1000,7 @@ export function Root({
|
|
|
966
1000
|
onTouchDrag: (event, pointerEvent) => drag(event, pointerEvent),
|
|
967
1001
|
onTouchRelease: (event, pointerEvent) => release(event, pointerEvent),
|
|
968
1002
|
dismissible,
|
|
1003
|
+
onDismissAttempt,
|
|
969
1004
|
shouldAnimate,
|
|
970
1005
|
handleOnly,
|
|
971
1006
|
isOpen,
|
|
@@ -1121,6 +1156,7 @@ export const Content = React.forwardRef<HTMLDivElement, ContentProps>(
|
|
|
1121
1156
|
snapPoints,
|
|
1122
1157
|
setActiveSnapPoint,
|
|
1123
1158
|
dismissible,
|
|
1159
|
+
onDismissAttempt,
|
|
1124
1160
|
container,
|
|
1125
1161
|
handleOnly,
|
|
1126
1162
|
shouldAnimate,
|
|
@@ -1453,6 +1489,8 @@ export const Content = React.forwardRef<HTMLDivElement, ContentProps>(
|
|
|
1453
1489
|
activeSnapPointIndex > 0
|
|
1454
1490
|
) {
|
|
1455
1491
|
setActiveSnapPoint(snapPoints![0]!);
|
|
1492
|
+
} else {
|
|
1493
|
+
onDismissAttempt?.();
|
|
1456
1494
|
}
|
|
1457
1495
|
}
|
|
1458
1496
|
}}
|
|
@@ -1594,6 +1632,7 @@ export const Handle = React.forwardRef<HTMLDivElement, HandleProps>(
|
|
|
1594
1632
|
activeSnapPoint,
|
|
1595
1633
|
setActiveSnapPoint,
|
|
1596
1634
|
dismissible,
|
|
1635
|
+
onDismissAttempt,
|
|
1597
1636
|
handleOnly,
|
|
1598
1637
|
isOpen,
|
|
1599
1638
|
onPress,
|
|
@@ -1637,6 +1676,12 @@ export const Handle = React.forwardRef<HTMLDivElement, HandleProps>(
|
|
|
1637
1676
|
return;
|
|
1638
1677
|
}
|
|
1639
1678
|
|
|
1679
|
+
// Mirrors native: a single-detent sheet's handle tap is a dismiss.
|
|
1680
|
+
if (isLastSnapPoint && snapPoints.length === 1) {
|
|
1681
|
+
onDismissAttempt?.();
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1640
1685
|
const currentSnapIndex = snapPoints.findIndex((point) => point === activeSnapPoint);
|
|
1641
1686
|
if (currentSnapIndex === -1) return; // activeSnapPoint not found in snapPoints
|
|
1642
1687
|
const nextSnapPoint = snapPoints[currentSnapIndex + 1];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["nanoid","StackRouter","StackActions","TrueSheetActions","resize","index","type","dismiss","remove","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","length","TrueSheetRouter","routerOptions","baseRouter","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","Math","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/TrueSheetRouter.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAIEC,WAAW,EAEXC,YAAY,QAEP,wBAAwB;AA0B/B,OAAO,MAAMC,gBAAgB,GAAG;EAC9B,GAAGD,YAAY;EACfE,MAAM,EAAGC,KAAa,KAA2B;IAAEC,IAAI,EAAE,QAAQ;IAAED;EAAM,CAAC,CAAC;EAC3EE,OAAO,EAAEA,CAAA,MAA4B;IAAED,IAAI,EAAE;EAAU,CAAC,CAAC;EACzDE,MAAM,EAAEA,CAAA,MAA4B;IAAEF,IAAI,EAAE;EAAS,CAAC;AACxD,CAAC;AAED,MAAMG,eAAe,GAAGA,CACtBC,KAAQ,EACRC,aAAiC,EACjCC,cAA8D,KACf;EAC/C,IAAI,CAACD,aAAa,EAAE;IAClB,OAAOD,KAAK;EACd;EAEA,MAAMG,YAAY,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,KAAKN,aAAa,CAAC;EAEvE,IAAI,CAACE,YAAY,EAAE;IACjB,MAAMK,SAAS,GAAG;MAChBC,GAAG,EAAE,GAAGR,aAAa,IA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3,"names":["TrueSheetScreen","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ReanimatedTrueSheetScreen","getReanimatedScreen","require","DEFAULT_DETENTS","clampDetentIndex","index","detentsLength","Math","min","max","TrueSheetView","state","navigation","descriptors","baseRoute","sheetRoutes","routes","baseDescriptor","key","children","render","map","route","descriptor","options","screenNavigation","detentIndex","detents","reanimated","positionChangeHandler","sheetProps","resolvedIndex","resizeIndex","length","ReanimatedScreen","routeKey","closing","resizeKey","emit"],"sourceRoot":"../../../src","sources":["navigation/TrueSheetView.tsx"],"mappings":";;AAOA,SAASA,eAAe,QAAmC,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtE,IAAIC,yBAA2E,GAAG,IAAI;AAEtF,MAAMC,mBAAmB,GAAGA,CAAA,KAAiD;EAC3E,IAAI,CAACD,yBAAyB,EAAE;IAC9BA,yBAAyB,GACvBE,OAAO,CAAC,oCAAoC,CAAC,CAACF,yBAAyB;EAC3E;EACA,OAAOA,yBAAyB;AAClC,CAAC;AAED,MAAMG,eAAoC,GAAG,CAAC,MAAM,CAAC;AAErD,MAAMC,gBAAgB,GAAGA,CAACC,KAAa,EAAEC,aAAqB,KAC5DC,IAAI,CAACC,GAAG,CAACH,KAAK,EAAEE,IAAI,CAACE,GAAG,CAACH,aAAa,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAQjD,OAAO,MAAMI,aAAa,GAAGA,CAAC;EAAEC,KAAK;EAAEC,UAAU;EAAEC;AAAgC,CAAC,KAAK;EACvF;EACA,MAAM,CAACC,SAAS,EAAE,GAAGC,WAAW,CAAC,GAAGJ,KAAK,CAACK,MAAM;EAEhD,MAAMC,cAAc,GAAGH,SAAS,GAAGD,WAAW,CAACC,SAAS,CAACI,GAAG,CAAC,GAAG,IAAI;EAEpE,oBACEnB,KAAA,CAAAF,SAAA;IAAAsB,QAAA,GAEGF,cAAc,EAAEG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QAC7Ba,IAAI,EAAE1B,UAAU,CAAC0B,IAAK;QACtBT,qBAAqB,EAAEA,qBAAsB;QAAA,GACzCC,UAAU;QAAAX,QAAA,EAEbC,MAAM,CAAC;MAAC,GAXJE,KAAK,CAACJ,GAYI,CAAC;IAEtB,CAAC,CAAC;EAAA,CACF,CAAC;AAEP,CAAC","ignoreList":[]}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { createNavigatorFactory, useNavigationBuilder } from '@react-navigation/core';
|
|
4
|
-
import { TrueSheetRouter } from "./TrueSheetRouter.js";
|
|
5
|
-
import { TrueSheetView } from "./TrueSheetView.js";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const TrueSheetNavigator = ({
|
|
8
|
-
id,
|
|
9
|
-
initialRouteName,
|
|
10
|
-
children,
|
|
11
|
-
layout,
|
|
12
|
-
screenListeners,
|
|
13
|
-
screenOptions,
|
|
14
|
-
screenLayout
|
|
15
|
-
}) => {
|
|
16
|
-
const {
|
|
17
|
-
state,
|
|
18
|
-
descriptors,
|
|
19
|
-
navigation,
|
|
20
|
-
NavigationContent
|
|
21
|
-
} = useNavigationBuilder(TrueSheetRouter, {
|
|
22
|
-
id,
|
|
23
|
-
initialRouteName,
|
|
24
|
-
children,
|
|
25
|
-
layout,
|
|
26
|
-
screenListeners,
|
|
27
|
-
screenOptions,
|
|
28
|
-
screenLayout
|
|
29
|
-
});
|
|
30
|
-
return /*#__PURE__*/_jsx(NavigationContent, {
|
|
31
|
-
children: /*#__PURE__*/_jsx(TrueSheetView, {
|
|
32
|
-
state: state,
|
|
33
|
-
navigation: navigation,
|
|
34
|
-
descriptors: descriptors
|
|
35
|
-
})
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Creates a TrueSheet navigator.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```tsx
|
|
44
|
-
* const Sheet = createTrueSheetNavigator();
|
|
45
|
-
*
|
|
46
|
-
* function App() {
|
|
47
|
-
* return (
|
|
48
|
-
* <Sheet.Navigator>
|
|
49
|
-
* <Sheet.Screen name="Home" component={HomeScreen} />
|
|
50
|
-
* <Sheet.Screen
|
|
51
|
-
* name="Details"
|
|
52
|
-
* component={DetailsSheet}
|
|
53
|
-
* options={{ detents: [0.5, 1] }}
|
|
54
|
-
* />
|
|
55
|
-
* </Sheet.Navigator>
|
|
56
|
-
* );
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export const createTrueSheetNavigator = config => {
|
|
61
|
-
return createNavigatorFactory(TrueSheetNavigator)(config);
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=createTrueSheetNavigator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createNavigatorFactory","useNavigationBuilder","TrueSheetRouter","TrueSheetView","jsx","_jsx","TrueSheetNavigator","id","initialRouteName","children","layout","screenListeners","screenOptions","screenLayout","state","descriptors","navigation","NavigationContent","createTrueSheetNavigator","config"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetNavigator.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EAKtBC,oBAAoB,QACf,wBAAwB;AAE/B,SAASC,eAAe,QAAqC,sBAAmB;AAChF,SAASC,aAAa,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUhD,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,EAAE;EACFC,gBAAgB;EAChBC,QAAQ;EACRC,MAAM;EACNC,eAAe;EACfC,aAAa;EACbC;AACuB,CAAC,KAAK;EAC7B,MAAM;IAAEC,KAAK;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAkB,CAAC,GAAGhB,oBAAoB,CAMhFC,eAAe,EAAE;IACjBK,EAAE;IACFC,gBAAgB;IAChBC,QAAQ;IACRC,MAAM;IACNC,eAAe;IACfC,aAAa;IACbC;EACF,CAAC,CAAC;EAEF,oBACER,IAAA,CAACY,iBAAiB;IAAAR,QAAA,eAChBJ,IAAA,CAACF,aAAa;MAACW,KAAK,EAAEA,KAAM;MAACE,UAAU,EAAEA,UAAW;MAACD,WAAW,EAAEA;IAAY,CAAE;EAAC,CAChE,CAAC;AAExB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,wBAAwB,GAgBnCC,MAAe,IACqB;EACpC,OAAOnB,sBAAsB,CAACM,kBAAkB,CAAC,CAACa,MAAM,CAAC;AAC3D,CAAC","ignoreList":[]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { type CommonActions, type ParamListBase, type Router, type StackActionType, type StackRouterOptions } from '@react-navigation/core';
|
|
2
|
-
import type { TrueSheetNavigationState } from './types';
|
|
3
|
-
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
4
|
-
export type TrueSheetActionType = StackActionType | ReturnType<typeof CommonActions.goBack> | {
|
|
5
|
-
type: 'RESIZE';
|
|
6
|
-
index: number;
|
|
7
|
-
source?: string;
|
|
8
|
-
target?: string;
|
|
9
|
-
} | {
|
|
10
|
-
type: 'DISMISS';
|
|
11
|
-
source?: string;
|
|
12
|
-
target?: string;
|
|
13
|
-
} | {
|
|
14
|
-
type: 'REMOVE';
|
|
15
|
-
source?: string;
|
|
16
|
-
target?: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const TrueSheetActions: {
|
|
19
|
-
resize: (index: number) => TrueSheetActionType;
|
|
20
|
-
dismiss: () => TrueSheetActionType;
|
|
21
|
-
remove: () => TrueSheetActionType;
|
|
22
|
-
replace(name: string, params?: object): {
|
|
23
|
-
readonly type: "REPLACE";
|
|
24
|
-
readonly payload: {
|
|
25
|
-
readonly name: string;
|
|
26
|
-
readonly params: object | undefined;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
push(name: string, params?: object): {
|
|
30
|
-
readonly type: "PUSH";
|
|
31
|
-
readonly payload: {
|
|
32
|
-
readonly name: string;
|
|
33
|
-
readonly params: object | undefined;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
pop(count?: number): {
|
|
37
|
-
readonly type: "POP";
|
|
38
|
-
readonly payload: {
|
|
39
|
-
readonly count: number;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
popToTop(): {
|
|
43
|
-
readonly type: "POP_TO_TOP";
|
|
44
|
-
};
|
|
45
|
-
popTo(name: string, params?: object, options?: {
|
|
46
|
-
merge?: boolean;
|
|
47
|
-
}): {
|
|
48
|
-
readonly type: "POP_TO";
|
|
49
|
-
readonly payload: {
|
|
50
|
-
readonly name: string;
|
|
51
|
-
readonly params: object | undefined;
|
|
52
|
-
readonly merge: boolean | undefined;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export declare const TrueSheetRouter: (routerOptions: StackRouterOptions) => Router<TrueSheetNavigationState<ParamListBase>, TrueSheetActionType>;
|
|
57
|
-
//# sourceMappingURL=TrueSheetRouter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TrueSheetRouter.d.ts","sourceRoot":"","sources":["../../../../src/navigation/TrueSheetRouter.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,MAAM,EAEX,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAC3B,eAAe,GACf,UAAU,CAAC,OAAO,aAAa,CAAC,MAAM,CAAC,GACvC;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,eAAO,MAAM,gBAAgB;oBAEX,MAAM,KAAG,mBAAmB;mBAC/B,mBAAmB;kBACpB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;aA+FO,CAAC;;;;;;;;;CA9FxC,CAAC;AA8BF,eAAO,MAAM,eAAe,GAC1B,eAAe,kBAAkB,KAChC,MAAM,CAAC,wBAAwB,CAAC,aAAa,CAAC,EAAE,mBAAmB,CAiKrE,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ParamListBase } from '@react-navigation/core';
|
|
2
|
-
import type { TrueSheetDescriptorMap, TrueSheetNavigationHelpers, TrueSheetNavigationState } from './types';
|
|
3
|
-
interface TrueSheetViewProps {
|
|
4
|
-
state: TrueSheetNavigationState<ParamListBase>;
|
|
5
|
-
navigation: TrueSheetNavigationHelpers;
|
|
6
|
-
descriptors: TrueSheetDescriptorMap;
|
|
7
|
-
}
|
|
8
|
-
export declare const TrueSheetView: ({ state, navigation, descriptors }: TrueSheetViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=TrueSheetView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TrueSheetView.d.ts","sourceRoot":"","sources":["../../../../src/navigation/TrueSheetView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAkBjB,UAAU,kBAAkB;IAC1B,KAAK,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAC/C,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;CACrC;AAED,eAAO,MAAM,aAAa,GAAI,oCAAoC,kBAAkB,4CAoEnF,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type NavigatorTypeBagBase, type ParamListBase, type StaticConfig, type TypedNavigator } from '@react-navigation/core';
|
|
2
|
-
import type { TrueSheetNavigationEventMap, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetNavigatorProps } from './types';
|
|
3
|
-
declare const TrueSheetNavigator: ({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, }: TrueSheetNavigatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
/**
|
|
5
|
-
* Creates a TrueSheet navigator.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* const Sheet = createTrueSheetNavigator();
|
|
10
|
-
*
|
|
11
|
-
* function App() {
|
|
12
|
-
* return (
|
|
13
|
-
* <Sheet.Navigator>
|
|
14
|
-
* <Sheet.Screen name="Home" component={HomeScreen} />
|
|
15
|
-
* <Sheet.Screen
|
|
16
|
-
* name="Details"
|
|
17
|
-
* component={DetailsSheet}
|
|
18
|
-
* options={{ detents: [0.5, 1] }}
|
|
19
|
-
* />
|
|
20
|
-
* </Sheet.Navigator>
|
|
21
|
-
* );
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const createTrueSheetNavigator: <const ParamList extends ParamListBase, const NavigatorID extends string | undefined = undefined, const TypeBag extends NavigatorTypeBagBase = {
|
|
26
|
-
ParamList: ParamList;
|
|
27
|
-
NavigatorID: NavigatorID;
|
|
28
|
-
State: TrueSheetNavigationState<ParamList>;
|
|
29
|
-
ScreenOptions: TrueSheetNavigationOptions;
|
|
30
|
-
EventMap: TrueSheetNavigationEventMap;
|
|
31
|
-
NavigationList: { [RouteName in keyof ParamList]: TrueSheetNavigationProp<ParamList, RouteName, NavigatorID>; };
|
|
32
|
-
Navigator: typeof TrueSheetNavigator;
|
|
33
|
-
}, const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>>(config?: Config) => TypedNavigator<TypeBag, Config>;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=createTrueSheetNavigator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTrueSheetNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigation/createTrueSheetNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAEV,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,QAAA,MAAM,kBAAkB,GAAI,2FAQzB,uBAAuB,4CAsBzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,wBAAwB,GACnC,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACxD,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG;IAC3C,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC3C,aAAa,EAAE,0BAA0B,CAAC;IAC1C,QAAQ,EAAE,2BAA2B,CAAC;IACtC,cAAc,EAAE,GACb,SAAS,IAAI,MAAM,SAAS,GAAG,uBAAuB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,GAC3F,CAAC;IACF,SAAS,EAAE,OAAO,kBAAkB,CAAC;CACtC,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAElE,SAAS,MAAM,KACd,cAAc,CAAC,OAAO,EAAE,MAAM,CAEhC,CAAC"}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { nanoid } from 'nanoid/non-secure';
|
|
2
|
-
import {
|
|
3
|
-
type CommonActions,
|
|
4
|
-
type ParamListBase,
|
|
5
|
-
type Router,
|
|
6
|
-
StackRouter,
|
|
7
|
-
type StackActionType,
|
|
8
|
-
StackActions,
|
|
9
|
-
type StackRouterOptions,
|
|
10
|
-
} from '@react-navigation/core';
|
|
11
|
-
|
|
12
|
-
import type { TrueSheetNavigationState } from './types';
|
|
13
|
-
|
|
14
|
-
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
15
|
-
|
|
16
|
-
export type TrueSheetActionType =
|
|
17
|
-
| StackActionType
|
|
18
|
-
| ReturnType<typeof CommonActions.goBack>
|
|
19
|
-
| {
|
|
20
|
-
type: 'RESIZE';
|
|
21
|
-
index: number;
|
|
22
|
-
source?: string;
|
|
23
|
-
target?: string;
|
|
24
|
-
}
|
|
25
|
-
| {
|
|
26
|
-
type: 'DISMISS';
|
|
27
|
-
source?: string;
|
|
28
|
-
target?: string;
|
|
29
|
-
}
|
|
30
|
-
| {
|
|
31
|
-
type: 'REMOVE';
|
|
32
|
-
source?: string;
|
|
33
|
-
target?: string;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const TrueSheetActions = {
|
|
37
|
-
...StackActions,
|
|
38
|
-
resize: (index: number): TrueSheetActionType => ({ type: 'RESIZE', index }),
|
|
39
|
-
dismiss: (): TrueSheetActionType => ({ type: 'DISMISS' }),
|
|
40
|
-
remove: (): TrueSheetActionType => ({ type: 'REMOVE' }),
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const ensureBaseRoute = <T extends { routes: { name: string }[] }>(
|
|
44
|
-
state: T,
|
|
45
|
-
baseRouteName: string | undefined,
|
|
46
|
-
routeParamList: Record<string, object | undefined> | undefined
|
|
47
|
-
): T & { index: number; routes: T['routes'] } => {
|
|
48
|
-
if (!baseRouteName) {
|
|
49
|
-
return state as T & { index: number; routes: T['routes'] };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const hasBaseRoute = state.routes.some((r) => r.name === baseRouteName);
|
|
53
|
-
|
|
54
|
-
if (!hasBaseRoute) {
|
|
55
|
-
const baseRoute = {
|
|
56
|
-
key: `${baseRouteName}-${nanoid()}`,
|
|
57
|
-
name: baseRouteName,
|
|
58
|
-
params: routeParamList?.[baseRouteName],
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
...state,
|
|
63
|
-
index: state.routes.length,
|
|
64
|
-
routes: [baseRoute, ...state.routes],
|
|
65
|
-
} as T & { index: number; routes: T['routes'] };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return state as T & { index: number; routes: T['routes'] };
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const TrueSheetRouter = (
|
|
72
|
-
routerOptions: StackRouterOptions
|
|
73
|
-
): Router<TrueSheetNavigationState<ParamListBase>, TrueSheetActionType> => {
|
|
74
|
-
const baseRouter = StackRouter(routerOptions) as unknown as Router<
|
|
75
|
-
TrueSheetNavigationState<ParamListBase>,
|
|
76
|
-
TrueSheetActionType
|
|
77
|
-
>;
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
...baseRouter,
|
|
81
|
-
type: 'true-sheet',
|
|
82
|
-
|
|
83
|
-
getInitialState(options) {
|
|
84
|
-
const state = baseRouter.getInitialState(options);
|
|
85
|
-
const baseRouteName = routerOptions.initialRouteName ?? options.routeNames[0];
|
|
86
|
-
const stateWithBaseRoute = ensureBaseRoute(state, baseRouteName, options.routeParamList);
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
...stateWithBaseRoute,
|
|
90
|
-
stale: false,
|
|
91
|
-
type: 'true-sheet',
|
|
92
|
-
key: `true-sheet-${nanoid()}`,
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
getStateForAction(state, action, options) {
|
|
97
|
-
switch (action.type) {
|
|
98
|
-
case 'RESIZE': {
|
|
99
|
-
const routeIndex =
|
|
100
|
-
action.target === state.key && action.source
|
|
101
|
-
? state.routes.findIndex((r) => r.key === action.source)
|
|
102
|
-
: state.index;
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
...state,
|
|
106
|
-
routes: state.routes.map((route, i) =>
|
|
107
|
-
i === routeIndex
|
|
108
|
-
? {
|
|
109
|
-
...route,
|
|
110
|
-
resizeIndex: action.index,
|
|
111
|
-
resizeKey: (route.resizeKey ?? 0) + 1,
|
|
112
|
-
}
|
|
113
|
-
: route
|
|
114
|
-
),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
case 'GO_BACK':
|
|
119
|
-
case 'DISMISS': {
|
|
120
|
-
return this.getStateForAction(state, StackActions.pop(1), options);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
case 'POP': {
|
|
124
|
-
// Only base screen remains - let parent navigator handle it
|
|
125
|
-
if (state.routes.length <= 1) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const count =
|
|
130
|
-
'payload' in action && typeof action.payload?.count === 'number'
|
|
131
|
-
? action.payload.count
|
|
132
|
-
: 1;
|
|
133
|
-
|
|
134
|
-
// Calculate how many routes we can actually pop (don't pop base screen)
|
|
135
|
-
const maxPopCount = state.routes.length - 1;
|
|
136
|
-
const actualCount = Math.min(count, maxPopCount);
|
|
137
|
-
|
|
138
|
-
// Base screen - let parent navigator handle it
|
|
139
|
-
if (actualCount <= 0) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Target index is the route we want to stay on (land on after pop)
|
|
144
|
-
// closingIndex is the first route to be dismissed (the one after target)
|
|
145
|
-
const targetIndex = state.routes.length - 1 - actualCount;
|
|
146
|
-
const closingIndex = targetIndex + 1;
|
|
147
|
-
|
|
148
|
-
// Mark only the bottom-most route to pop as closing
|
|
149
|
-
// The sheet's dismiss() will handle dismissing sheets above it first
|
|
150
|
-
return {
|
|
151
|
-
...state,
|
|
152
|
-
index: closingIndex,
|
|
153
|
-
routes: state.routes.map((route, i) =>
|
|
154
|
-
i === closingIndex ? { ...route, closing: true } : route
|
|
155
|
-
),
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
case 'POP_TO_TOP': {
|
|
160
|
-
const popCount = state.routes.length - 1;
|
|
161
|
-
return this.getStateForAction(state, StackActions.pop(popCount), options);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
case 'POP_TO': {
|
|
165
|
-
const targetName =
|
|
166
|
-
'payload' in action && typeof action.payload?.name === 'string'
|
|
167
|
-
? action.payload.name
|
|
168
|
-
: null;
|
|
169
|
-
|
|
170
|
-
if (!targetName) {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const targetIndex = state.routes.findIndex((r) => r.name === targetName);
|
|
175
|
-
|
|
176
|
-
// Target not found or is the current route
|
|
177
|
-
if (targetIndex === -1 || targetIndex >= state.index) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const popCount = state.routes.length - 1 - targetIndex;
|
|
182
|
-
return this.getStateForAction(state, StackActions.pop(popCount), options);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
case 'REMOVE': {
|
|
186
|
-
// Actually remove the closing route and all routes above it
|
|
187
|
-
const routeKey = action.source;
|
|
188
|
-
const routeIndex = routeKey
|
|
189
|
-
? state.routes.findIndex((r) => r.key === routeKey)
|
|
190
|
-
: state.routes.findIndex((r) => r.closing);
|
|
191
|
-
|
|
192
|
-
if (routeIndex === -1) {
|
|
193
|
-
return state;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Remove the route and all routes above it (they were dismissed together)
|
|
197
|
-
const routes = state.routes.filter((_, i) => i < routeIndex);
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
...state,
|
|
201
|
-
index: Math.min(state.index, routes.length - 1),
|
|
202
|
-
routes,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
default:
|
|
207
|
-
return baseRouter.getStateForAction(state, action, options);
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
getRehydratedState(partialState, { routeNames, routeParamList, routeGetIdList }) {
|
|
212
|
-
if (partialState.stale === false) {
|
|
213
|
-
return partialState;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const state = baseRouter.getRehydratedState(partialState, {
|
|
217
|
-
routeNames,
|
|
218
|
-
routeParamList,
|
|
219
|
-
routeGetIdList,
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
const baseRouteName = routerOptions.initialRouteName ?? routeNames[0];
|
|
223
|
-
const stateWithBaseRoute = ensureBaseRoute(state, baseRouteName, routeParamList);
|
|
224
|
-
|
|
225
|
-
return {
|
|
226
|
-
...stateWithBaseRoute,
|
|
227
|
-
type: 'true-sheet',
|
|
228
|
-
key: `true-sheet-${nanoid()}`,
|
|
229
|
-
};
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
actionCreators: TrueSheetActions,
|
|
233
|
-
};
|
|
234
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createNavigatorFactory,
|
|
3
|
-
type NavigatorTypeBagBase,
|
|
4
|
-
type ParamListBase,
|
|
5
|
-
type StaticConfig,
|
|
6
|
-
type TypedNavigator,
|
|
7
|
-
useNavigationBuilder,
|
|
8
|
-
} from '@react-navigation/core';
|
|
9
|
-
|
|
10
|
-
import { TrueSheetRouter, type TrueSheetRouterOptions } from './TrueSheetRouter';
|
|
11
|
-
import { TrueSheetView } from './TrueSheetView';
|
|
12
|
-
import type {
|
|
13
|
-
TrueSheetActionHelpers,
|
|
14
|
-
TrueSheetNavigationEventMap,
|
|
15
|
-
TrueSheetNavigationOptions,
|
|
16
|
-
TrueSheetNavigationProp,
|
|
17
|
-
TrueSheetNavigationState,
|
|
18
|
-
TrueSheetNavigatorProps,
|
|
19
|
-
} from './types';
|
|
20
|
-
|
|
21
|
-
const TrueSheetNavigator = ({
|
|
22
|
-
id,
|
|
23
|
-
initialRouteName,
|
|
24
|
-
children,
|
|
25
|
-
layout,
|
|
26
|
-
screenListeners,
|
|
27
|
-
screenOptions,
|
|
28
|
-
screenLayout,
|
|
29
|
-
}: TrueSheetNavigatorProps) => {
|
|
30
|
-
const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder<
|
|
31
|
-
TrueSheetNavigationState<ParamListBase>,
|
|
32
|
-
TrueSheetRouterOptions,
|
|
33
|
-
TrueSheetActionHelpers<ParamListBase>,
|
|
34
|
-
TrueSheetNavigationOptions,
|
|
35
|
-
TrueSheetNavigationEventMap
|
|
36
|
-
>(TrueSheetRouter, {
|
|
37
|
-
id,
|
|
38
|
-
initialRouteName,
|
|
39
|
-
children,
|
|
40
|
-
layout,
|
|
41
|
-
screenListeners,
|
|
42
|
-
screenOptions,
|
|
43
|
-
screenLayout,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<NavigationContent>
|
|
48
|
-
<TrueSheetView state={state} navigation={navigation} descriptors={descriptors} />
|
|
49
|
-
</NavigationContent>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Creates a TrueSheet navigator.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```tsx
|
|
58
|
-
* const Sheet = createTrueSheetNavigator();
|
|
59
|
-
*
|
|
60
|
-
* function App() {
|
|
61
|
-
* return (
|
|
62
|
-
* <Sheet.Navigator>
|
|
63
|
-
* <Sheet.Screen name="Home" component={HomeScreen} />
|
|
64
|
-
* <Sheet.Screen
|
|
65
|
-
* name="Details"
|
|
66
|
-
* component={DetailsSheet}
|
|
67
|
-
* options={{ detents: [0.5, 1] }}
|
|
68
|
-
* />
|
|
69
|
-
* </Sheet.Navigator>
|
|
70
|
-
* );
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export const createTrueSheetNavigator = <
|
|
75
|
-
const ParamList extends ParamListBase,
|
|
76
|
-
const NavigatorID extends string | undefined = undefined,
|
|
77
|
-
const TypeBag extends NavigatorTypeBagBase = {
|
|
78
|
-
ParamList: ParamList;
|
|
79
|
-
NavigatorID: NavigatorID;
|
|
80
|
-
State: TrueSheetNavigationState<ParamList>;
|
|
81
|
-
ScreenOptions: TrueSheetNavigationOptions;
|
|
82
|
-
EventMap: TrueSheetNavigationEventMap;
|
|
83
|
-
NavigationList: {
|
|
84
|
-
[RouteName in keyof ParamList]: TrueSheetNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
85
|
-
};
|
|
86
|
-
Navigator: typeof TrueSheetNavigator;
|
|
87
|
-
},
|
|
88
|
-
const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,
|
|
89
|
-
>(
|
|
90
|
-
config?: Config
|
|
91
|
-
): TypedNavigator<TypeBag, Config> => {
|
|
92
|
-
return createNavigatorFactory(TrueSheetNavigator)(config);
|
|
93
|
-
};
|