@lodev09/react-native-true-sheet 4.0.0-beta.2 → 4.0.0-beta.20
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 +50 -16
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +302 -184
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +5 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +21 -110
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +116 -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 +119 -50
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +360 -163
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +54 -12
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetView.kt +22 -9
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +84 -5
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +104 -39
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDimView.kt +3 -0
- 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 +15 -2
- package/android/src/main/java/com/lodev09/truesheet/utils/ScreenUtils.kt +0 -12
- 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 +1 -9
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +110 -30
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +30 -7
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +2 -2
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +9 -8
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +9 -3
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +3 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +4 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.h +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +43 -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 +33 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewComponentDescriptor.h +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +7 -40
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.h +3 -7
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.cpp +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.h +4 -5
- package/ios/TrueSheetContainerView.h +27 -7
- package/ios/TrueSheetContainerView.mm +31 -11
- package/ios/TrueSheetContentView.h +43 -15
- package/ios/TrueSheetContentView.mm +211 -189
- package/ios/TrueSheetFooterView.h +6 -0
- package/ios/TrueSheetFooterView.mm +93 -17
- 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 +212 -55
- package/ios/TrueSheetViewController.h +31 -3
- package/ios/TrueSheetViewController.mm +393 -94
- package/ios/core/TrueSheetBlurView.h +0 -2
- package/ios/core/TrueSheetBlurView.mm +3 -36
- package/ios/core/TrueSheetDetentCalculator.h +7 -1
- package/ios/core/TrueSheetDetentCalculator.mm +27 -4
- package/ios/core/TrueSheetGrabberView.mm +13 -3
- package/ios/core/TrueSheetKeyboardObserver.mm +2 -0
- 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 +173 -39
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +218 -243
- package/lib/module/TrueSheet.web.js.map +1 -1
- package/lib/module/TrueSheetBackground.js +15 -0
- package/lib/module/TrueSheetBackground.js.map +1 -0
- 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 +20 -15
- package/lib/module/TrueSheetPeek.web.js.map +1 -1
- package/lib/module/detentBackgrounds.js +21 -0
- package/lib/module/detentBackgrounds.js.map +1 -0
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +14 -10
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +18 -2
- package/lib/module/mocks/index.js.map +1 -1
- package/lib/module/mocks/navigationExpoRouter.js.map +1 -1
- package/lib/module/navigation/base-types.js +2 -0
- package/lib/module/navigation/base-types.js.map +1 -0
- package/lib/module/navigation/createTrueSheetRouter.js +0 -9
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -1
- 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 +10 -7
- package/lib/module/navigation/expo-router/index.js.map +1 -1
- 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.map +1 -1
- package/lib/module/navigation/screen/useSheetScreenState.js +1 -0
- package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -1
- package/lib/module/web/constants.js +1 -1
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/layout.js +168 -0
- package/lib/module/web/layout.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 +1 -0
- package/lib/module/web/vaul/helpers.js.map +1 -1
- package/lib/module/web/vaul/index.js +44 -6
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/module/web/vaul/use-snap-points.js +6 -8
- package/lib/module/web/vaul/use-snap-points.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 +135 -34
- 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/TrueSheetBackground.d.ts +3 -0
- package/lib/typescript/src/TrueSheetBackground.d.ts.map +1 -0
- 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 +8 -4
- package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -1
- package/lib/typescript/src/detentBackgrounds.d.ts +10 -0
- package/lib/typescript/src/detentBackgrounds.d.ts.map +1 -0
- 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 +11 -7
- 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/navigationExpoRouter.d.ts +3 -3
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -1
- 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 +2 -13
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -1
- 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 +8 -6
- package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -1
- 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 +3 -4
- package/lib/typescript/src/navigation/index.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +2 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +41 -5
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- package/lib/typescript/src/web/constants.d.ts +1 -1
- package/lib/typescript/src/web/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/layout.d.ts +19 -0
- package/lib/typescript/src/web/layout.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 +1 -0
- 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/lib/typescript/src/web/vaul/use-snap-points.d.ts.map +1 -1
- package/package.json +17 -8
- package/react-native.config.js +1 -0
- package/src/TrueSheet.tsx +206 -48
- package/src/TrueSheet.types.ts +142 -35
- package/src/TrueSheet.web.tsx +270 -290
- package/src/TrueSheetBackground.tsx +17 -0
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/TrueSheetPeek.web.tsx +25 -23
- package/src/detentBackgrounds.ts +24 -0
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +14 -10
- package/src/index.ts +1 -0
- package/src/mocks/index.ts +17 -2
- package/src/mocks/navigationExpoRouter.ts +6 -5
- package/src/navigation/base-types.ts +20 -0
- package/src/navigation/createTrueSheetRouter.ts +5 -33
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/index.ts +28 -30
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +6 -7
- package/src/navigation/screen/useSheetScreenState.ts +2 -0
- package/src/navigation/types.ts +75 -22
- package/src/web/constants.ts +1 -1
- package/src/web/layout.ts +196 -0
- package/src/web/vaul/constants.ts +4 -0
- package/src/web/vaul/context.ts +1 -0
- package/src/web/vaul/helpers.ts +5 -0
- package/src/web/vaul/index.tsx +67 -5
- package/src/web/vaul/use-snap-points.ts +6 -14
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
import type { TrueSheetProps } from './TrueSheet.types';
|
|
3
|
+
|
|
4
|
+
export const TrueSheetBackground = ({
|
|
5
|
+
background,
|
|
6
|
+
backgroundStyle,
|
|
7
|
+
}: Pick<TrueSheetProps, 'background' | 'backgroundStyle'>) => (
|
|
8
|
+
<View
|
|
9
|
+
pointerEvents="none"
|
|
10
|
+
style={[
|
|
11
|
+
StyleSheet.absoluteFill,
|
|
12
|
+
{ backgroundColor: StyleSheet.flatten(backgroundStyle)?.backgroundColor },
|
|
13
|
+
]}
|
|
14
|
+
>
|
|
15
|
+
{background}
|
|
16
|
+
</View>
|
|
17
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StyleSheet, type ViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import TrueSheetOverlayViewNativeComponent from './fabric/TrueSheetOverlayViewNativeComponent';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Renders its children in a native layer above every presented sheet — for
|
|
7
|
+
* toasts, dialogs, and other content a sheet must not cover.
|
|
8
|
+
* Fills the window; touches that miss its children pass through to the views beneath.
|
|
9
|
+
*/
|
|
10
|
+
export const TrueSheetOverlay = ({ style, ...rest }: ViewProps) => (
|
|
11
|
+
<TrueSheetOverlayViewNativeComponent {...rest} style={[styles.overlay, style]} />
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const styles = StyleSheet.create({
|
|
15
|
+
// Sized to the window from native — absolute so it takes no layout space.
|
|
16
|
+
// Children render in a native container, so the host itself must never
|
|
17
|
+
// catch touches (Android forces it visible on layout).
|
|
18
|
+
overlay: {
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
top: 0,
|
|
21
|
+
left: 0,
|
|
22
|
+
pointerEvents: 'none',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
import { useLayoutEffect, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { StyleSheet, View, type ViewProps } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders its children in a layer above every presented sheet — for
|
|
8
|
+
* toasts, dialogs, and other content a sheet must not cover.
|
|
9
|
+
* Fills the window; touches that miss its children pass through to the views beneath.
|
|
10
|
+
*/
|
|
11
|
+
export const TrueSheetOverlay = ({ style, ...rest }: ViewProps) => {
|
|
12
|
+
// Portal target appended to the body so it stacks above the sheets' portal
|
|
13
|
+
const [container] = useState(() =>
|
|
14
|
+
typeof document !== 'undefined' ? document.createElement('div') : null
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
if (!container) return;
|
|
19
|
+
|
|
20
|
+
container.style.cssText = 'position:fixed;inset:0;pointer-events:none';
|
|
21
|
+
document.body.appendChild(container);
|
|
22
|
+
return () => {
|
|
23
|
+
container.remove();
|
|
24
|
+
};
|
|
25
|
+
}, [container]);
|
|
26
|
+
|
|
27
|
+
if (!container) return null;
|
|
28
|
+
|
|
29
|
+
return createPortal(
|
|
30
|
+
<View pointerEvents="box-none" {...rest} style={[StyleSheet.absoluteFill, style]} />,
|
|
31
|
+
container
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { createContext, type RefObject, useContext,
|
|
1
|
+
import { createContext, type RefObject, useContext, useLayoutEffect, useRef } from 'react';
|
|
2
2
|
import { type LayoutChangeEvent, View, type ViewProps } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { getDOMElement } from './web/dom';
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
|
-
*
|
|
5
|
+
* Registers a peek with the owning TrueSheet so it can measure the peek live.
|
|
8
6
|
* @internal
|
|
9
7
|
*/
|
|
10
8
|
export interface TrueSheetPeekContextValue {
|
|
11
9
|
contentRef: RefObject<View | null>;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
attachPeek: (view: View) => void;
|
|
11
|
+
detachPeek: (view: View) => void;
|
|
12
|
+
measurePeek: (view: View) => void;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export const TrueSheetPeekContext = createContext<TrueSheetPeekContextValue | null>(null);
|
|
@@ -19,14 +18,19 @@ export const TrueSheetPeekContext = createContext<TrueSheetPeekContextValue | nu
|
|
|
19
18
|
* Distance from the top of the content view to the bottom of the peek view,
|
|
20
19
|
* so the peek view's offset within the content (padding, views above it)
|
|
21
20
|
* counts toward the peek detent. Both rects live in the drawer's transformed
|
|
22
|
-
* subtree, so an in-flight translate cancels out of the delta.
|
|
21
|
+
* subtree, so an in-flight translate cancels out of the delta. Rounded so the
|
|
22
|
+
* sub-pixel noise of a mid-transition measurement doesn't register as a
|
|
23
|
+
* change — the content re-measures every frame while the snap animates, and
|
|
24
|
+
* a new value would restart the snap.
|
|
23
25
|
* @internal
|
|
24
26
|
*/
|
|
25
27
|
export const measurePeekContentHeight = (
|
|
26
28
|
peekElement: HTMLElement,
|
|
27
29
|
contentElement: HTMLElement
|
|
28
30
|
): number =>
|
|
29
|
-
|
|
31
|
+
Math.round(
|
|
32
|
+
peekElement.getBoundingClientRect().bottom - contentElement.getBoundingClientRect().top
|
|
33
|
+
);
|
|
30
34
|
|
|
31
35
|
/**
|
|
32
36
|
* Wrapper component that marks its children as the sheet's peek content.
|
|
@@ -36,25 +40,23 @@ export const measurePeekContentHeight = (
|
|
|
36
40
|
*/
|
|
37
41
|
export const TrueSheetPeek = ({ onLayout, ...rest }: ViewProps) => {
|
|
38
42
|
const context = useContext(TrueSheetPeekContext);
|
|
39
|
-
const
|
|
43
|
+
const viewRef = useRef<View>(null);
|
|
40
44
|
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
45
|
+
// Attach by instance rather than sharing a ref — during a screen swap the
|
|
46
|
+
// incoming peek mounts before the outgoing one unmounts, and a shared ref
|
|
47
|
+
// would be nulled by the outgoing unmount.
|
|
48
|
+
useLayoutEffect(() => {
|
|
49
|
+
const view = viewRef.current;
|
|
50
|
+
if (!context || !view) return;
|
|
44
51
|
|
|
45
|
-
|
|
52
|
+
context.attachPeek(view);
|
|
53
|
+
return () => context.detachPeek(view);
|
|
54
|
+
}, [context]);
|
|
46
55
|
|
|
47
56
|
const handleLayout = (event: LayoutChangeEvent) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const bottom =
|
|
53
|
-
peekElement && contentElement
|
|
54
|
-
? measurePeekContentHeight(peekElement, contentElement)
|
|
55
|
-
: event.nativeEvent.layout.height;
|
|
56
|
-
|
|
57
|
-
context.setPeekContentHeight(bottom);
|
|
57
|
+
const view = viewRef.current;
|
|
58
|
+
if (context && view) {
|
|
59
|
+
context.measurePeek(view);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
onLayout?.(event);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DetentBackground } from './TrueSheet.types';
|
|
2
|
+
|
|
3
|
+
export function normalizeDetentBackground(entry: DetentBackground | null | undefined) {
|
|
4
|
+
return typeof entry === 'string' ? { color: entry } : entry;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getDetentBackgroundIndex(
|
|
8
|
+
height: number,
|
|
9
|
+
detentHeights: readonly number[],
|
|
10
|
+
displayedIndex: number
|
|
11
|
+
): number {
|
|
12
|
+
if (detentHeights.length === 0) return -1;
|
|
13
|
+
|
|
14
|
+
let nextIndex = Math.max(0, Math.min(displayedIndex, detentHeights.length - 1));
|
|
15
|
+
let distance = Math.abs(height - detentHeights[nextIndex]!);
|
|
16
|
+
for (let index = 0; index < detentHeights.length; index++) {
|
|
17
|
+
const nextDistance = Math.abs(height - detentHeights[index]!);
|
|
18
|
+
if (nextDistance < distance) {
|
|
19
|
+
nextIndex = index;
|
|
20
|
+
distance = nextDistance;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return nextIndex;
|
|
24
|
+
}
|
|
@@ -6,7 +6,7 @@ export interface NativeProps extends ViewProps {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
// interfaceOnly: shadow node/state/descriptor are custom (common/cpp) so the
|
|
9
|
-
// content can be bounded to the container when a ScrollView is
|
|
9
|
+
// content can be bounded to the container when a ScrollView is detected
|
|
10
10
|
export default codegenNativeComponent<NativeProps>('TrueSheetContentView', {
|
|
11
11
|
interfaceOnly: true,
|
|
12
12
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
import { codegenNativeComponent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface NativeProps extends ViewProps {
|
|
5
|
+
// No props needed - sized to the window from native
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// interfaceOnly: shadow node/state/descriptor are custom (common/cpp) so the
|
|
9
|
+
// overlay is sized to the window
|
|
10
|
+
export default codegenNativeComponent<NativeProps>('TrueSheetOverlayView', {
|
|
11
|
+
interfaceOnly: true,
|
|
12
|
+
});
|
|
@@ -27,15 +27,12 @@ type AccessibilityOptionsType = Readonly<{
|
|
|
27
27
|
paneTitle?: WithDefault<string, 'Bottom sheet'>;
|
|
28
28
|
}>;
|
|
29
29
|
|
|
30
|
-
type BlurOptionsType = Readonly<{
|
|
31
|
-
intensity?: WithDefault<Double, -1>;
|
|
32
|
-
interaction?: WithDefault<boolean, true>;
|
|
33
|
-
}>;
|
|
34
|
-
|
|
35
30
|
type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden';
|
|
36
31
|
|
|
37
32
|
type ScrollableOptionsType = Readonly<{
|
|
33
|
+
contentInsetAdjustment?: WithDefault<'automatic' | 'safe-area' | 'footer' | 'never', 'automatic'>;
|
|
38
34
|
keyboardScrollOffset?: WithDefault<Double, 0>;
|
|
35
|
+
keyboardOffset?: WithDefault<Double, 0>;
|
|
39
36
|
scrollingExpandsSheet?: WithDefault<boolean, true>;
|
|
40
37
|
topScrollEdgeEffect?: WithDefault<ScrollEdgeEffect, 'hidden'>;
|
|
41
38
|
bottomScrollEdgeEffect?: WithDefault<ScrollEdgeEffect, 'hidden'>;
|
|
@@ -46,6 +43,7 @@ type FooterOptionsType = Readonly<{
|
|
|
46
43
|
// the field name, so a second `position` would redefine TrueSheetViewPosition
|
|
47
44
|
footerPosition?: WithDefault<'relative' | 'absolute', 'relative'>;
|
|
48
45
|
keyboardOffset?: WithDefault<Double, 0>;
|
|
46
|
+
avoidKeyboard?: WithDefault<boolean, true>;
|
|
49
47
|
}>;
|
|
50
48
|
|
|
51
49
|
type HeaderOptionsType = Readonly<{
|
|
@@ -68,6 +66,12 @@ export interface PositionChangeEventPayload {
|
|
|
68
66
|
export interface NativeProps extends ViewProps {
|
|
69
67
|
// Array properties
|
|
70
68
|
detents?: ReadonlyArray<Double>;
|
|
69
|
+
detentBackgrounds?: ReadonlyArray<
|
|
70
|
+
Readonly<{
|
|
71
|
+
color?: ProcessedColorValue | null;
|
|
72
|
+
blur?: string;
|
|
73
|
+
}>
|
|
74
|
+
>;
|
|
71
75
|
|
|
72
76
|
// Number properties - use 0 as default to avoid nil insertion
|
|
73
77
|
maxContentHeight?: WithDefault<Double, 0>;
|
|
@@ -107,13 +111,10 @@ export interface NativeProps extends ViewProps {
|
|
|
107
111
|
'none'
|
|
108
112
|
>;
|
|
109
113
|
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
placement?: WithDefault<'automatic' | 'leading' | 'center' | 'trailing', 'automatic'>;
|
|
115
|
+
placementOffset?: WithDefault<Double, 16>;
|
|
112
116
|
insetAdjustment?: WithDefault<'automatic' | 'never', 'automatic'>;
|
|
113
117
|
|
|
114
|
-
// Blur options
|
|
115
|
-
blurOptions?: BlurOptionsType;
|
|
116
|
-
|
|
117
118
|
// Boolean properties - match defaults from TrueSheet.types.ts
|
|
118
119
|
grabber?: WithDefault<boolean, true>;
|
|
119
120
|
grabberOptions?: GrabberOptionsType;
|
|
@@ -122,6 +123,8 @@ export interface NativeProps extends ViewProps {
|
|
|
122
123
|
draggable?: WithDefault<boolean, true>;
|
|
123
124
|
dimmed?: WithDefault<boolean, true>;
|
|
124
125
|
initialDetentAnimated?: WithDefault<boolean, true>;
|
|
126
|
+
// React tag of the scrollable component within the content (see scrollableRef)
|
|
127
|
+
scrollableHandle?: WithDefault<Int32, -1>;
|
|
125
128
|
scrollableOptions?: ScrollableOptionsType;
|
|
126
129
|
headerOptions?: HeaderOptionsType;
|
|
127
130
|
footerOptions?: FooterOptionsType;
|
|
@@ -133,6 +136,7 @@ export interface NativeProps extends ViewProps {
|
|
|
133
136
|
onDidPresent?: DirectEventHandler<DetentInfoEventPayload>;
|
|
134
137
|
onWillDismiss?: DirectEventHandler<null>;
|
|
135
138
|
onDidDismiss?: DirectEventHandler<null>;
|
|
139
|
+
onDismissAttempt?: DirectEventHandler<null>;
|
|
136
140
|
onDetentChange?: DirectEventHandler<DetentInfoEventPayload>;
|
|
137
141
|
onDragBegin?: DirectEventHandler<DetentInfoEventPayload>;
|
|
138
142
|
onDragChange?: DirectEventHandler<DetentInfoEventPayload>;
|
package/src/index.ts
CHANGED
package/src/mocks/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React, { createElement, isValidElement, type ReactNode } from 'react';
|
|
|
2
2
|
import { View, type ViewProps } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import type { TrueSheetProps, TrueSheetStaticMethods } from '../TrueSheet.types';
|
|
5
|
+
import { TrueSheetBackground } from '../TrueSheetBackground';
|
|
5
6
|
|
|
6
7
|
interface TrueSheetState {
|
|
7
8
|
shouldRenderNativeView: boolean;
|
|
@@ -54,8 +55,15 @@ export class TrueSheet extends React.Component<TrueSheetProps, TrueSheetState> {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
render() {
|
|
57
|
-
const { children, style } = this.props;
|
|
58
|
-
return React.createElement(
|
|
58
|
+
const { children, style, background, backgroundStyle } = this.props;
|
|
59
|
+
return React.createElement(
|
|
60
|
+
View,
|
|
61
|
+
{ style },
|
|
62
|
+
React.createElement(TrueSheetBackground, { background, backgroundStyle }),
|
|
63
|
+
this.renderHeader(),
|
|
64
|
+
children,
|
|
65
|
+
this.renderFooter()
|
|
66
|
+
);
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
|
|
@@ -66,6 +74,13 @@ export function TrueSheetPeek({ children, ...rest }: ViewProps) {
|
|
|
66
74
|
return React.createElement(View, rest, children);
|
|
67
75
|
}
|
|
68
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Mock TrueSheetOverlay component for testing.
|
|
79
|
+
*/
|
|
80
|
+
export function TrueSheetOverlay({ children, ...rest }: ViewProps) {
|
|
81
|
+
return React.createElement(View, rest, children);
|
|
82
|
+
}
|
|
83
|
+
|
|
69
84
|
/**
|
|
70
85
|
* Mock TrueSheetProvider for testing.
|
|
71
86
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ParamListBase } from '
|
|
2
|
-
|
|
3
|
-
import type { TrueSheetNavigationProp } from '../navigation/types';
|
|
1
|
+
import type { ParamListBase } from '../navigation/expo-router/base-types';
|
|
2
|
+
import type { TrueSheetNavigationProp } from '../navigation/expo-router/types';
|
|
4
3
|
import {
|
|
5
4
|
TrueSheetActions,
|
|
6
5
|
useTrueSheetNavigation as useTrueSheetNavigationMock,
|
|
@@ -22,8 +21,10 @@ export const Sheet = Object.assign(
|
|
|
22
21
|
* Mock useTrueSheetNavigation hook for testing.
|
|
23
22
|
*/
|
|
24
23
|
export const useTrueSheetNavigation = jest.fn(
|
|
24
|
+
// Double cast: the shared mock is typed against React Navigation, this entry
|
|
25
|
+
// against Expo Router's vendored copy — identical shapes, unrelated declarations
|
|
25
26
|
<T extends ParamListBase = ParamListBase>(): TrueSheetNavigationProp<T> =>
|
|
26
|
-
useTrueSheetNavigationMock() as TrueSheetNavigationProp<T>
|
|
27
|
+
useTrueSheetNavigationMock() as unknown as TrueSheetNavigationProp<T>
|
|
27
28
|
);
|
|
28
29
|
|
|
29
30
|
export { TrueSheetActions };
|
|
@@ -37,4 +38,4 @@ export type {
|
|
|
37
38
|
TrueSheetNavigationProp,
|
|
38
39
|
TrueSheetNavigationState,
|
|
39
40
|
TrueSheetScreenProps,
|
|
40
|
-
} from '../navigation/types';
|
|
41
|
+
} from '../navigation/expo-router/types';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base navigation types for the React Navigation entry point.
|
|
3
|
+
*
|
|
4
|
+
* The Expo Router entry has its own copy sourced from `expo-router/react-navigation`
|
|
5
|
+
* (see `./expo-router/base-types`) because Expo Router apps never install
|
|
6
|
+
* `@react-navigation/*` — importing it there would silently resolve to `any`.
|
|
7
|
+
*/
|
|
8
|
+
export type {
|
|
9
|
+
DefaultNavigatorOptions,
|
|
10
|
+
Descriptor,
|
|
11
|
+
NavigationAction,
|
|
12
|
+
NavigationHelpers,
|
|
13
|
+
NavigationProp,
|
|
14
|
+
NavigationState,
|
|
15
|
+
ParamListBase,
|
|
16
|
+
RouteProp,
|
|
17
|
+
Router,
|
|
18
|
+
StackActionHelpers,
|
|
19
|
+
StackRouterOptions,
|
|
20
|
+
} from '@react-navigation/core';
|
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
NavigationState,
|
|
4
|
-
ParamListBase,
|
|
5
|
-
Router,
|
|
6
|
-
StackRouterOptions,
|
|
7
|
-
} from '@react-navigation/core';
|
|
8
|
-
|
|
9
|
-
import { TrueSheetActions, type TrueSheetActionType } from './actions';
|
|
10
|
-
import type { TrueSheetNavigationState } from './types';
|
|
11
|
-
|
|
12
|
-
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The base `StackRouter` factory to wrap, typed generically over the state and
|
|
16
|
-
* action types the wrapper threads through — `StackRouter` is structural and
|
|
17
|
-
* never touches the sheet-specific fields.
|
|
18
|
-
* Injected by each entry point so the shared router never imports
|
|
19
|
-
* `@react-navigation/*` at runtime (Expo Router apps don't install it).
|
|
20
|
-
*/
|
|
21
|
-
export type StackRouterFactory = <
|
|
22
|
-
State extends NavigationState<ParamListBase>,
|
|
23
|
-
Action extends NavigationAction,
|
|
24
|
-
>(
|
|
25
|
-
options: TrueSheetRouterOptions
|
|
26
|
-
) => Router<State, Action>;
|
|
1
|
+
import { TrueSheetActions } from './actions';
|
|
2
|
+
import type { TrueSheetRouter, TrueSheetRouterFactory, TrueSheetRouterOptions } from './types';
|
|
27
3
|
|
|
28
4
|
const uid = () => Math.random().toString(36).slice(2, 10);
|
|
29
5
|
|
|
@@ -56,13 +32,9 @@ const ensureBaseRoute = <T extends { routes: { name: string }[] }>(
|
|
|
56
32
|
};
|
|
57
33
|
|
|
58
34
|
export const createTrueSheetRouter =
|
|
59
|
-
(stackRouter:
|
|
60
|
-
(
|
|
61
|
-
routerOptions
|
|
62
|
-
): Router<TrueSheetNavigationState<ParamListBase>, TrueSheetActionType> => {
|
|
63
|
-
const baseRouter = stackRouter<TrueSheetNavigationState<ParamListBase>, TrueSheetActionType>(
|
|
64
|
-
routerOptions
|
|
65
|
-
);
|
|
35
|
+
(stackRouter: TrueSheetRouterFactory) =>
|
|
36
|
+
(routerOptions: TrueSheetRouterOptions): TrueSheetRouter => {
|
|
37
|
+
const baseRouter = stackRouter(routerOptions);
|
|
66
38
|
|
|
67
39
|
return {
|
|
68
40
|
...baseRouter,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base navigation types for the Expo Router entry point.
|
|
3
|
+
*
|
|
4
|
+
* Sourced from Expo Router's vendored React Navigation so apps that only install
|
|
5
|
+
* `expo-router` still get real types — see `../base-types` for the React Navigation copy.
|
|
6
|
+
*/
|
|
7
|
+
export type {
|
|
8
|
+
DefaultNavigatorOptions,
|
|
9
|
+
NavigationAction,
|
|
10
|
+
NavigationHelpers,
|
|
11
|
+
NavigationProp,
|
|
12
|
+
NavigationState,
|
|
13
|
+
ParamListBase,
|
|
14
|
+
RouteProp,
|
|
15
|
+
Router,
|
|
16
|
+
StackActionHelpers,
|
|
17
|
+
StackRouterOptions,
|
|
18
|
+
} from 'expo-router/react-navigation';
|
|
@@ -1,48 +1,46 @@
|
|
|
1
|
-
import type { ParamListBase } from '@react-navigation/core';
|
|
2
1
|
import { StackRouter, unstable_integrateWithRouter, useNavigation } from 'expo-router';
|
|
3
2
|
|
|
4
|
-
import {
|
|
5
|
-
createTrueSheetRouter,
|
|
6
|
-
type StackRouterFactory,
|
|
7
|
-
type TrueSheetRouterOptions,
|
|
8
|
-
} from '../createTrueSheetRouter';
|
|
3
|
+
import { createTrueSheetRouter } from '../createTrueSheetRouter';
|
|
9
4
|
import { trueSheetNavigator } from '../navigator';
|
|
5
|
+
import type { ParamListBase } from './base-types';
|
|
10
6
|
import type {
|
|
7
|
+
StackRouterFactory,
|
|
11
8
|
TrueSheetNavigationOptions,
|
|
12
9
|
TrueSheetNavigationProp,
|
|
13
10
|
TrueSheetNavigationState,
|
|
14
11
|
TrueSheetNavigatorContentExtraProps,
|
|
15
12
|
TrueSheetNavigatorProps,
|
|
13
|
+
TrueSheetRouterFactory,
|
|
14
|
+
TrueSheetRouterOptions,
|
|
16
15
|
TrueSheetStandardEventMap,
|
|
17
|
-
} from '
|
|
16
|
+
} from './types';
|
|
18
17
|
|
|
18
|
+
// expo-router's vendored StackRouter is structurally identical to @react-navigation's.
|
|
19
|
+
// Pinned to this entry's own router types: `createTrueSheetRouter` is shared and typed
|
|
20
|
+
// against React Navigation, which resolves to `any` in apps that only install expo-router.
|
|
21
|
+
const sheetRouter: TrueSheetRouterFactory = createTrueSheetRouter(
|
|
22
|
+
StackRouter as StackRouterFactory
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
// `routes`/`dispatch` are injected by `createProps`, so they are declared as
|
|
26
|
+
// CreateProps (last generic) and excluded from the public navigator props
|
|
19
27
|
const SheetNavigator = unstable_integrateWithRouter<
|
|
20
28
|
TrueSheetNavigationOptions,
|
|
21
29
|
TrueSheetNavigationState<ParamListBase>,
|
|
22
30
|
TrueSheetStandardEventMap,
|
|
23
|
-
|
|
24
|
-
TrueSheetRouterOptions
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
dispatch,
|
|
33
|
-
}),
|
|
34
|
-
}
|
|
35
|
-
);
|
|
31
|
+
object,
|
|
32
|
+
TrueSheetRouterOptions,
|
|
33
|
+
TrueSheetNavigatorContentExtraProps
|
|
34
|
+
>(trueSheetNavigator, sheetRouter, {
|
|
35
|
+
createProps: ({ state, dispatch }) => ({
|
|
36
|
+
routes: state.routes,
|
|
37
|
+
dispatch,
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
36
40
|
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
// callbacks - replace it with the exact map
|
|
41
|
-
type SheetProps = Omit<
|
|
42
|
-
React.ComponentProps<typeof SheetNavigator>,
|
|
43
|
-
'screenListeners' | 'routes' | 'dispatch'
|
|
44
|
-
> &
|
|
45
|
-
Partial<Pick<React.ComponentProps<typeof SheetNavigator>, 'routes' | 'dispatch'>> &
|
|
41
|
+
// expo-router intersects the event map with an index signature which breaks
|
|
42
|
+
// precisely typed `screenListeners` callbacks - replace it with the exact map
|
|
43
|
+
type SheetProps = Omit<React.ComponentProps<typeof SheetNavigator>, 'screenListeners'> &
|
|
46
44
|
Pick<TrueSheetNavigatorProps, 'screenListeners'>;
|
|
47
45
|
|
|
48
46
|
/**
|
|
@@ -86,4 +84,4 @@ export type {
|
|
|
86
84
|
TrueSheetNavigationProp,
|
|
87
85
|
TrueSheetNavigationState,
|
|
88
86
|
TrueSheetScreenProps,
|
|
89
|
-
} from '
|
|
87
|
+
} from './types';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expo Router flavour of `../types`: same shapes, but bound to Expo Router's
|
|
3
|
+
* vendored React Navigation types so apps that only install `expo-router` still
|
|
4
|
+
* get real types instead of `any` — see `./base-types`.
|
|
5
|
+
*/
|
|
6
|
+
import type { TrueSheetActionType } from '../actions';
|
|
7
|
+
import type {
|
|
8
|
+
TrueSheetActionHelpersOf,
|
|
9
|
+
TrueSheetDispatch,
|
|
10
|
+
TrueSheetNavigationEventMap,
|
|
11
|
+
TrueSheetNavigationOptions,
|
|
12
|
+
TrueSheetStateOf,
|
|
13
|
+
} from '../types';
|
|
14
|
+
import type {
|
|
15
|
+
DefaultNavigatorOptions,
|
|
16
|
+
NavigationAction,
|
|
17
|
+
NavigationHelpers,
|
|
18
|
+
NavigationProp,
|
|
19
|
+
NavigationState,
|
|
20
|
+
ParamListBase,
|
|
21
|
+
RouteProp,
|
|
22
|
+
Router,
|
|
23
|
+
StackActionHelpers,
|
|
24
|
+
StackRouterOptions,
|
|
25
|
+
} from './base-types';
|
|
26
|
+
|
|
27
|
+
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
28
|
+
|
|
29
|
+
export type TrueSheetNavigationState<ParamList extends ParamListBase> = TrueSheetStateOf<
|
|
30
|
+
NavigationState<ParamList>
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
export type TrueSheetRouterState = TrueSheetNavigationState<ParamListBase>;
|
|
34
|
+
|
|
35
|
+
export type TrueSheetRouter = Router<TrueSheetRouterState, TrueSheetActionType>;
|
|
36
|
+
|
|
37
|
+
export type TrueSheetRouterFactory = (options: TrueSheetRouterOptions) => TrueSheetRouter;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The base `StackRouter` factory to wrap — see `../types` for the shared contract.
|
|
41
|
+
*/
|
|
42
|
+
export type StackRouterFactory = <
|
|
43
|
+
State extends NavigationState<ParamListBase>,
|
|
44
|
+
Action extends NavigationAction,
|
|
45
|
+
>(
|
|
46
|
+
options: TrueSheetRouterOptions
|
|
47
|
+
) => Router<State, Action>;
|
|
48
|
+
|
|
49
|
+
export type TrueSheetRoute = TrueSheetNavigationState<ParamListBase>['routes'][number];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Props injected into the navigator content by Expo Router's `createProps`.
|
|
53
|
+
* Raw routes carry the custom fields (`closing`, `resizeIndex`, `resizeKey`)
|
|
54
|
+
* that the standard state strips out.
|
|
55
|
+
*/
|
|
56
|
+
export interface TrueSheetNavigatorContentExtraProps {
|
|
57
|
+
routes: TrueSheetRoute[];
|
|
58
|
+
dispatch: TrueSheetDispatch;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type TrueSheetActionHelpers<ParamList extends ParamListBase> = TrueSheetActionHelpersOf<
|
|
62
|
+
StackActionHelpers<ParamList>
|
|
63
|
+
>;
|
|
64
|
+
|
|
65
|
+
export type TrueSheetNavigationProp<
|
|
66
|
+
ParamList extends ParamListBase,
|
|
67
|
+
RouteName extends keyof ParamList = string,
|
|
68
|
+
NavigatorID extends string | undefined = undefined,
|
|
69
|
+
> = NavigationProp<
|
|
70
|
+
ParamList,
|
|
71
|
+
RouteName,
|
|
72
|
+
NavigatorID,
|
|
73
|
+
TrueSheetNavigationState<ParamList>,
|
|
74
|
+
TrueSheetNavigationOptions,
|
|
75
|
+
TrueSheetNavigationEventMap
|
|
76
|
+
> &
|
|
77
|
+
TrueSheetActionHelpers<ParamList>;
|
|
78
|
+
|
|
79
|
+
export type TrueSheetScreenProps<
|
|
80
|
+
ParamList extends ParamListBase,
|
|
81
|
+
RouteName extends keyof ParamList = string,
|
|
82
|
+
NavigatorID extends string | undefined = undefined,
|
|
83
|
+
> = {
|
|
84
|
+
navigation: TrueSheetNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
85
|
+
route: RouteProp<ParamList, RouteName>;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type TrueSheetNavigationHelpers = NavigationHelpers<
|
|
89
|
+
ParamListBase,
|
|
90
|
+
TrueSheetNavigationEventMap
|
|
91
|
+
>;
|
|
92
|
+
|
|
93
|
+
export type TrueSheetNavigatorProps = DefaultNavigatorOptions<
|
|
94
|
+
ParamListBase,
|
|
95
|
+
string | undefined,
|
|
96
|
+
TrueSheetNavigationState<ParamListBase>,
|
|
97
|
+
TrueSheetNavigationOptions,
|
|
98
|
+
TrueSheetNavigationEventMap,
|
|
99
|
+
unknown
|
|
100
|
+
> & {
|
|
101
|
+
/**
|
|
102
|
+
* The name of the route to use as the base screen.
|
|
103
|
+
* This screen will be rendered as a regular screen, while other screens are presented as sheets.
|
|
104
|
+
* Defaults to the first screen defined in the navigator.
|
|
105
|
+
*/
|
|
106
|
+
initialRouteName?: string;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type {
|
|
110
|
+
PositionChangeHandler,
|
|
111
|
+
TrueSheetDispatch,
|
|
112
|
+
TrueSheetNavigationEventMap,
|
|
113
|
+
TrueSheetNavigationOptions,
|
|
114
|
+
TrueSheetNavigationSheetProps,
|
|
115
|
+
TrueSheetStandardEventMap,
|
|
116
|
+
} from '../types';
|