@lodev09/react-native-true-sheet 4.0.0-beta.1 → 4.0.0-beta.3
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/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +8 -2
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +23 -6
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +9 -2
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +1 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/TouchEventDeduper.kt +31 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +7 -0
- package/ios/TrueSheetContainerView.h +5 -0
- package/ios/TrueSheetContainerView.mm +4 -0
- package/ios/TrueSheetFooterView.h +6 -0
- package/ios/TrueSheetFooterView.mm +31 -2
- package/ios/TrueSheetView.mm +82 -17
- package/ios/TrueSheetViewController.h +9 -0
- package/ios/TrueSheetViewController.mm +109 -29
- package/lib/module/TrueSheet.js +53 -9
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +11 -9
- package/lib/module/TrueSheet.web.js.map +1 -1
- package/lib/module/TrueSheetPeek.web.js +3 -3
- package/lib/module/TrueSheetPeek.web.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/{TrueSheetRouter.js → createTrueSheetRouter.js} +20 -24
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +48 -0
- package/lib/module/navigation/expo-router/index.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 +4 -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/helpers.js +10 -4
- package/lib/module/web/vaul/helpers.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +2 -0
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheetPeek.web.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/createTrueSheetRouter.d.ts +14 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.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/index.d.ts +42 -2
- 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 +3 -5
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +24 -0
- 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/helpers.d.ts.map +1 -1
- package/package.json +23 -8
- package/src/TrueSheet.tsx +55 -9
- package/src/TrueSheet.web.tsx +14 -18
- package/src/TrueSheetPeek.web.tsx +4 -3
- package/src/mocks/navigation.ts +32 -25
- package/src/mocks/navigationExpoRouter.ts +40 -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/createTrueSheetRouter.ts +222 -0
- package/src/navigation/expo-router/index.ts +89 -0
- package/src/navigation/index.ts +69 -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 +8 -15
- package/src/navigation/types.ts +32 -0
- package/src/navigation/useTrueSheetNavigation.ts +1 -1
- package/src/web/dom.ts +9 -0
- package/src/web/vaul/helpers.ts +13 -6
- 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
|
@@ -1,5 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type StandardNavigationTypeBagBase } from '@react-navigation/native';
|
|
2
|
+
import type { TrueSheetActionHelpers, TrueSheetNavigationOptions, TrueSheetNavigationEventMap, TrueSheetNavigationState } from './types';
|
|
3
|
+
import type { TrueSheetRouterOptions } from './createTrueSheetRouter';
|
|
4
|
+
export interface TrueSheetNavigationTypeBag extends StandardNavigationTypeBagBase {
|
|
5
|
+
State: TrueSheetNavigationState<this['ParamList']>;
|
|
6
|
+
ActionHelpers: TrueSheetActionHelpers<this['ParamList']>;
|
|
7
|
+
ScreenOptions: TrueSheetNavigationOptions;
|
|
8
|
+
EventMap: TrueSheetNavigationEventMap;
|
|
9
|
+
RouterOptions: TrueSheetRouterOptions;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a TrueSheet navigator.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const Sheet = createTrueSheetNavigator();
|
|
17
|
+
*
|
|
18
|
+
* function App() {
|
|
19
|
+
* return (
|
|
20
|
+
* <Sheet.Navigator>
|
|
21
|
+
* <Sheet.Screen name="Home" component={HomeScreen} />
|
|
22
|
+
* <Sheet.Screen
|
|
23
|
+
* name="Details"
|
|
24
|
+
* component={DetailsSheet}
|
|
25
|
+
* options={{ detents: [0.5, 1] }}
|
|
26
|
+
* />
|
|
27
|
+
* </Sheet.Navigator>
|
|
28
|
+
* );
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const createTrueSheetNavigator: import("@react-navigation/native").StandardNavigationCreateNavigator<TrueSheetNavigationTypeBag, {}>;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a screen configuration for the static API.
|
|
35
|
+
*/
|
|
36
|
+
export declare const createTrueSheetScreen: import("@react-navigation/core").StaticScreenFactory<TrueSheetNavigationTypeBag & {
|
|
37
|
+
ParamList: import("@react-navigation/routers").ParamListBase;
|
|
38
|
+
NavigatorID: string | undefined;
|
|
39
|
+
Navigator: import("react").ComponentType<{}>;
|
|
40
|
+
}>;
|
|
41
|
+
export { TrueSheetActions, type TrueSheetActionType } from './actions';
|
|
42
|
+
export { createTrueSheetRouter, type StackRouterFactory, type TrueSheetRouterOptions, } from './createTrueSheetRouter';
|
|
3
43
|
export { useTrueSheetNavigation } from './useTrueSheetNavigation';
|
|
4
44
|
export type { DetentInfoEventPayload, PositionChangeEventPayload } from '../TrueSheet.types';
|
|
5
45
|
export type { TrueSheetNavigationEventMap, TrueSheetNavigationHelpers, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetScreenProps, } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EAEzB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,WAAW,0BAA2B,SAAQ,6BAA6B;IAC/E,KAAK,EAAE,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACnD,aAAa,EAAE,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACzD,aAAa,EAAE,0BAA0B,CAAC;IAC1C,QAAQ,EAAE,2BAA2B,CAAC;IACtC,aAAa,EAAE,sBAAsB,CAAC;CACvC;AAYD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,wBAAwB,sGAAkB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;EAAe,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EACL,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,YAAY,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAE7F,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TrueSheetNavigationOptions, TrueSheetNavigatorContentExtraProps, TrueSheetStandardEventMap } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic TrueSheet navigator.
|
|
4
|
+
* Wired into React Navigation via `./index` and Expo Router via `./expo-router`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const trueSheetNavigator: import("standard-navigation").StandardNavigator<TrueSheetNavigationOptions, TrueSheetStandardEventMap, TrueSheetNavigatorContentExtraProps>;
|
|
7
|
+
//# sourceMappingURL=navigator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigator.d.ts","sourceRoot":"","sources":["../../../../src/navigation/navigator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,0BAA0B,EAC1B,mCAAmC,EACnC,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,6IAIH,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TrueSheetScreenProps } from './types';
|
|
2
|
-
export declare const ReanimatedTrueSheetScreen: ({ detentIndex, resizeKey,
|
|
2
|
+
export declare const ReanimatedTrueSheetScreen: ({ detentIndex, resizeKey, dispatch, emit, routeKey, closing, detents, children, positionChangeHandler, ...sheetProps }: TrueSheetScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=ReanimatedTrueSheetScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReanimatedTrueSheetScreen.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/ReanimatedTrueSheetScreen.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAKpD,eAAO,MAAM,yBAAyB,GAAI,
|
|
1
|
+
{"version":3,"file":"ReanimatedTrueSheetScreen.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/ReanimatedTrueSheetScreen.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAKpD,eAAO,MAAM,yBAAyB,GAAI,wHAWvC,oBAAoB,4CAsCtB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TrueSheetScreenProps } from './types';
|
|
2
|
-
export declare const TrueSheetScreen: ({ detentIndex, resizeKey,
|
|
2
|
+
export declare const TrueSheetScreen: ({ detentIndex, resizeKey, dispatch, emit, routeKey, closing, detents, children, positionChangeHandler, ...sheetProps }: TrueSheetScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=TrueSheetScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrueSheetScreen.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/TrueSheetScreen.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,eAAO,MAAM,eAAe,GAAI,
|
|
1
|
+
{"version":3,"file":"TrueSheetScreen.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/TrueSheetScreen.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,eAAO,MAAM,eAAe,GAAI,wHAW7B,oBAAoB,4CAmCtB,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ParamListBase } from '@react-navigation/core';
|
|
2
1
|
import type { TrueSheetProps } from '../../TrueSheet.types';
|
|
3
|
-
import type { PositionChangeHandler,
|
|
2
|
+
import type { PositionChangeHandler, TrueSheetDispatch, TrueSheetEmitFn, TrueSheetNavigationSheetProps } from '../types';
|
|
4
3
|
export interface TrueSheetScreenProps extends TrueSheetNavigationSheetProps {
|
|
5
4
|
detentIndex: number;
|
|
6
5
|
resizeKey?: number;
|
|
7
|
-
|
|
8
|
-
emit:
|
|
6
|
+
dispatch: TrueSheetDispatch;
|
|
7
|
+
emit: TrueSheetEmitFn;
|
|
9
8
|
routeKey: string;
|
|
10
9
|
closing?: boolean;
|
|
11
10
|
detents: TrueSheetProps['detents'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,oBAAqB,SAAQ,6BAA6B;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;CAC/C"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { TrueSheet } from '../../TrueSheet';
|
|
2
2
|
import type { DetentChangeEvent, DetentInfoEventPayload, DidBlurEvent, DidFocusEvent, DidPresentEvent, DragBeginEvent, DragChangeEvent, DragEndEvent, PositionChangeEvent, PositionChangeEventPayload, WillBlurEvent, WillDismissEvent, WillFocusEvent, WillPresentEvent } from '../../TrueSheet.types';
|
|
3
|
-
import type {
|
|
4
|
-
import type { ParamListBase } from '@react-navigation/core';
|
|
5
|
-
type EmitFn = TrueSheetNavigationHelpers['emit'];
|
|
3
|
+
import type { TrueSheetDispatch, TrueSheetEmitFn, TrueSheetNavigationEventMap } from '../types';
|
|
6
4
|
interface UseSheetScreenStateProps {
|
|
7
5
|
detentIndex: number;
|
|
8
6
|
resizeKey?: number;
|
|
9
7
|
closing?: boolean;
|
|
10
|
-
|
|
8
|
+
dispatch: TrueSheetDispatch;
|
|
11
9
|
routeKey: string;
|
|
12
|
-
emit:
|
|
10
|
+
emit: TrueSheetEmitFn;
|
|
13
11
|
}
|
|
14
12
|
export declare const useSheetScreenState: (props: UseSheetScreenStateProps) => {
|
|
15
13
|
ref: import("react").RefObject<TrueSheet | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSheetScreenState.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/useSheetScreenState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useSheetScreenState.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/screen/useSheetScreenState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGhG,UAAU,wBAAwB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB;;;sBAyBvD,MAAM,2BAA2B,QACjC,sBAAsB,GAAG,0BAA0B,GAAG,SAAS;;2BAmBlD,gBAAgB;0BACjB,eAAe;4BACb,gBAAgB;;4BAEhB,iBAAiB;yBACpB,cAAc;0BACb,eAAe;uBAClB,YAAY;8BACL,mBAAmB;0BACvB,cAAc;yBACf,aAAa;yBACb,aAAa;wBACd,YAAY;;CAWjC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, NavigationState, ParamListBase, RouteProp, StackActionHelpers } from '@react-navigation/core';
|
|
2
|
+
import type { NavigatorArgs } from 'standard-navigation';
|
|
2
3
|
import type { DetentInfoEventPayload, PositionChangeEventPayload, TrueSheetProps } from '../TrueSheet.types';
|
|
4
|
+
import type { TrueSheetActionType } from './actions';
|
|
3
5
|
export type PositionChangeHandler = (payload: PositionChangeEventPayload) => void;
|
|
4
6
|
export type TrueSheetNavigationEventMap = {
|
|
5
7
|
/**
|
|
@@ -89,6 +91,28 @@ export type TrueSheetNavigationState<ParamList extends ParamListBase> = Omit<Nav
|
|
|
89
91
|
closing?: boolean;
|
|
90
92
|
})[];
|
|
91
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* `TrueSheetNavigationEventMap` in the `standard-navigation` event-map shape.
|
|
96
|
+
*/
|
|
97
|
+
export type TrueSheetStandardEventMap = {
|
|
98
|
+
[K in keyof TrueSheetNavigationEventMap]: {
|
|
99
|
+
data: TrueSheetNavigationEventMap[K]['data'];
|
|
100
|
+
canPreventDefault: false;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export type TrueSheetRoute = TrueSheetNavigationState<ParamListBase>['routes'][number];
|
|
104
|
+
export type TrueSheetDispatch = (action: TrueSheetActionType) => void;
|
|
105
|
+
export type TrueSheetEmitFn = NavigatorArgs<TrueSheetNavigationOptions, TrueSheetStandardEventMap>['emitter']['emit'];
|
|
106
|
+
/**
|
|
107
|
+
* Props injected into the navigator content by each adapter
|
|
108
|
+
* (React Navigation's `mapper` / Expo Router's `createProps`).
|
|
109
|
+
* Raw routes carry the custom fields (`closing`, `resizeIndex`, `resizeKey`)
|
|
110
|
+
* that the standard state strips out.
|
|
111
|
+
*/
|
|
112
|
+
export interface TrueSheetNavigatorContentExtraProps {
|
|
113
|
+
routes: TrueSheetRoute[];
|
|
114
|
+
dispatch: TrueSheetDispatch;
|
|
115
|
+
}
|
|
92
116
|
export type TrueSheetActionHelpers<ParamList extends ParamListBase> = StackActionHelpers<ParamList> & {
|
|
93
117
|
/**
|
|
94
118
|
* Resize the sheet to a specific detent index.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,EACT,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,EACT,kBAAkB,EACnB,M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G;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;;;;;;;;;;OAiBG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,uBAAuB,CAC3D,aAAa,EACb,MAAM,GAAG,SAAS,EAClB,wBAAwB,CAAC,aAAa,CAAC,EACvC,0BAA0B,EAC1B,2BAA2B,EAC3B,OAAO,CACR,GAAG;IACF;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAC1C,0BAA0B,EAC1B,uBAAuB,CAAC,aAAa,CAAC,EACtC,SAAS,CAAC,aAAa,CAAC,CACzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTrueSheetNavigation.d.ts","sourceRoot":"","sources":["../../../../src/navigation/useTrueSheetNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useTrueSheetNavigation.d.ts","sourceRoot":"","sources":["../../../../src/navigation/useTrueSheetNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sBAAsB,GACjC,CAAC,SAAS,aAAa,GAAG,aAAa,OACpC,uBAAuB,CAAC,CAAC,CAAgD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { View } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a React Native web `View` ref value to its underlying DOM element —
|
|
4
|
+
* RN-web refs expose the host DOM node directly.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getDOMElement: (view: View | null) => HTMLElement | null;
|
|
7
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/web/dom.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,GAAG,IAAI,KAAG,WAAW,GAAG,IACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/web/vaul/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE5D,UAAU,KAAK;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/web/vaul/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE5D,UAAU,KAAK;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AASD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAYjD;AAED,wBAAgB,GAAG,CACjB,EAAE,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,EAC5C,MAAM,EAAE,KAAK,EACb,WAAW,UAAQ,QAmBpB;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,QAgBpE;AAED,eAAO,MAAM,UAAU,GAAI,WAAW,eAAe,YAWpD,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAgB5F;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,UAEpC;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACvC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,cAUpC;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,IAC1B,GAAG,MAAM,CAAC,SAAS,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,UAQ/D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodev09/react-native-true-sheet",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.3",
|
|
4
4
|
"description": "The true native bottom sheet experience for your React Native Apps.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"./mock": "./lib/module/mocks/index.js",
|
|
15
15
|
"./navigation/mock": "./lib/module/mocks/navigation.js",
|
|
16
|
+
"./navigation/expo-router/mock": "./lib/module/mocks/navigationExpoRouter.js",
|
|
16
17
|
"./reanimated/mock": "./lib/module/mocks/reanimated.js",
|
|
17
18
|
"./reanimated": {
|
|
18
19
|
"source": "./src/reanimated/index.ts",
|
|
@@ -24,6 +25,11 @@
|
|
|
24
25
|
"types": "./lib/typescript/src/navigation/index.d.ts",
|
|
25
26
|
"default": "./lib/module/navigation/index.js"
|
|
26
27
|
},
|
|
28
|
+
"./navigation/expo-router": {
|
|
29
|
+
"source": "./src/navigation/expo-router/index.ts",
|
|
30
|
+
"types": "./lib/typescript/src/navigation/expo-router/index.d.ts",
|
|
31
|
+
"default": "./lib/module/navigation/expo-router/index.js"
|
|
32
|
+
},
|
|
27
33
|
"./package.json": "./package.json"
|
|
28
34
|
},
|
|
29
35
|
"files": [
|
|
@@ -93,8 +99,8 @@
|
|
|
93
99
|
"@react-native/babel-preset": "^0.86.0",
|
|
94
100
|
"@react-native/eslint-config": "^0.86.0",
|
|
95
101
|
"@react-native/jest-preset": "^0.86.0",
|
|
96
|
-
"@react-navigation/core": "^7.
|
|
97
|
-
"@react-navigation/native": "^7.
|
|
102
|
+
"@react-navigation/core": "^7.21.12",
|
|
103
|
+
"@react-navigation/native": "^7.3.16",
|
|
98
104
|
"@release-it/conventional-changelog": "^11.0.0",
|
|
99
105
|
"@testing-library/react-native": "^13.3.3",
|
|
100
106
|
"@types/babel__core": "^7",
|
|
@@ -105,8 +111,8 @@
|
|
|
105
111
|
"eslint": "^9.35.0",
|
|
106
112
|
"eslint-config-prettier": "^10.1.8",
|
|
107
113
|
"eslint-plugin-prettier": "^5.5.4",
|
|
114
|
+
"expo-router": "~57.0.7",
|
|
108
115
|
"jest": "^29.7.0",
|
|
109
|
-
"nanoid": "^5.1.5",
|
|
110
116
|
"prettier": "^3.0.3",
|
|
111
117
|
"react": "19.2.3",
|
|
112
118
|
"react-native": "0.86.0",
|
|
@@ -115,6 +121,7 @@
|
|
|
115
121
|
"react-native-worklets": "0.10.0",
|
|
116
122
|
"react-test-renderer": "19.2.3",
|
|
117
123
|
"release-it": "^20.0.1",
|
|
124
|
+
"standard-navigation": "^0.0.9",
|
|
118
125
|
"turbo": "^2.5.6",
|
|
119
126
|
"typescript": "~6.0.3"
|
|
120
127
|
},
|
|
@@ -126,11 +133,13 @@
|
|
|
126
133
|
"peerDependencies": {
|
|
127
134
|
"@radix-ui/react-dialog": ">=1",
|
|
128
135
|
"@radix-ui/react-presence": ">=1",
|
|
129
|
-
"@react-navigation/
|
|
136
|
+
"@react-navigation/native": ">=7.3.0",
|
|
137
|
+
"expo-router": ">=57.0.0",
|
|
130
138
|
"react": "*",
|
|
131
139
|
"react-native": ">=0.82.0",
|
|
132
140
|
"react-native-reanimated": ">=4",
|
|
133
|
-
"react-native-worklets": "*"
|
|
141
|
+
"react-native-worklets": "*",
|
|
142
|
+
"standard-navigation": ">=0.0.9"
|
|
134
143
|
},
|
|
135
144
|
"peerDependenciesMeta": {
|
|
136
145
|
"@radix-ui/react-dialog": {
|
|
@@ -139,7 +148,10 @@
|
|
|
139
148
|
"@radix-ui/react-presence": {
|
|
140
149
|
"optional": true
|
|
141
150
|
},
|
|
142
|
-
"@react-navigation/
|
|
151
|
+
"@react-navigation/native": {
|
|
152
|
+
"optional": true
|
|
153
|
+
},
|
|
154
|
+
"expo-router": {
|
|
143
155
|
"optional": true
|
|
144
156
|
},
|
|
145
157
|
"react-native-reanimated": {
|
|
@@ -147,6 +159,9 @@
|
|
|
147
159
|
},
|
|
148
160
|
"react-native-worklets": {
|
|
149
161
|
"optional": true
|
|
162
|
+
},
|
|
163
|
+
"standard-navigation": {
|
|
164
|
+
"optional": true
|
|
150
165
|
}
|
|
151
166
|
},
|
|
152
167
|
"workspaces": [
|
|
@@ -162,7 +177,7 @@
|
|
|
162
177
|
"<rootDir>/jest.setup.js"
|
|
163
178
|
],
|
|
164
179
|
"transformIgnorePatterns": [
|
|
165
|
-
"node_modules/(?!(react-native|@react-native|react-native-reanimated|react-native-worklets|react-native-worklets-core)/)"
|
|
180
|
+
"node_modules/(?!(react-native|@react-native|@react-navigation|react-native-reanimated|react-native-worklets|react-native-worklets-core|standard-navigation)/)"
|
|
166
181
|
],
|
|
167
182
|
"modulePathIgnorePatterns": [
|
|
168
183
|
"<rootDir>/example/bare/node_modules",
|
package/src/TrueSheet.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type ComponentRef,
|
|
7
7
|
isValidElement,
|
|
8
8
|
createElement,
|
|
9
|
+
useEffect,
|
|
9
10
|
} from 'react';
|
|
10
11
|
|
|
11
12
|
import type {
|
|
@@ -67,8 +68,22 @@ const stopTouchPropagation = (event: GestureResponderEvent) => event.stopPropaga
|
|
|
67
68
|
|
|
68
69
|
interface TrueSheetState {
|
|
69
70
|
shouldRenderNativeView: boolean;
|
|
71
|
+
initialPresentReady: boolean;
|
|
70
72
|
}
|
|
71
73
|
|
|
74
|
+
// Gates auto-present (initialDetentIndex) by one commit. Rendered last in the
|
|
75
|
+
// sheet subtree so its mount effect runs after the content's mount effects —
|
|
76
|
+
// updates they schedule (e.g. a navigation footer via setOptions) batch with
|
|
77
|
+
// onReady's, so native receives initialDetentIndex together with the settled
|
|
78
|
+
// tree and presents at the final height instead of resizing mid-flight.
|
|
79
|
+
const InitialPresentGate = ({ onReady }: { onReady: () => void }) => {
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
onReady();
|
|
82
|
+
}, [onReady]);
|
|
83
|
+
|
|
84
|
+
return null;
|
|
85
|
+
};
|
|
86
|
+
|
|
72
87
|
export class TrueSheet
|
|
73
88
|
extends PureComponent<TrueSheetProps, TrueSheetState>
|
|
74
89
|
implements TrueSheetMethods
|
|
@@ -111,6 +126,7 @@ export class TrueSheet
|
|
|
111
126
|
|
|
112
127
|
this.state = {
|
|
113
128
|
shouldRenderNativeView: shouldRenderImmediately,
|
|
129
|
+
initialPresentReady: false,
|
|
114
130
|
};
|
|
115
131
|
|
|
116
132
|
this.onMount = this.onMount.bind(this);
|
|
@@ -129,6 +145,11 @@ export class TrueSheet
|
|
|
129
145
|
this.onDidBlur = this.onDidBlur.bind(this);
|
|
130
146
|
this.handleBackPress = this.handleBackPress.bind(this);
|
|
131
147
|
this.onVisibilityChange = this.onVisibilityChange.bind(this);
|
|
148
|
+
this.onInitialPresentReady = this.onInitialPresentReady.bind(this);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private onInitialPresentReady(): void {
|
|
152
|
+
this.setState({ initialPresentReady: true });
|
|
132
153
|
}
|
|
133
154
|
|
|
134
155
|
private validateDetents(): void {
|
|
@@ -443,6 +464,19 @@ export class TrueSheet
|
|
|
443
464
|
if (prevProps.detents !== this.props.detents) {
|
|
444
465
|
this.validateDetents();
|
|
445
466
|
}
|
|
467
|
+
|
|
468
|
+
// initialDetentIndex set at runtime on a lazily-mounted sheet: render the
|
|
469
|
+
// native tree so InitialPresentGate can deliver the index (constructor
|
|
470
|
+
// only computes this for the initial prop).
|
|
471
|
+
const prevInitialDetentIndex = prevProps.initialDetentIndex ?? -1;
|
|
472
|
+
const initialDetentIndex = this.props.initialDetentIndex ?? -1;
|
|
473
|
+
if (
|
|
474
|
+
prevInitialDetentIndex < 0 &&
|
|
475
|
+
initialDetentIndex >= 0 &&
|
|
476
|
+
!this.state.shouldRenderNativeView
|
|
477
|
+
) {
|
|
478
|
+
this.setState({ shouldRenderNativeView: true });
|
|
479
|
+
}
|
|
446
480
|
}
|
|
447
481
|
|
|
448
482
|
componentWillUnmount(): void {
|
|
@@ -498,6 +532,12 @@ export class TrueSheet
|
|
|
498
532
|
return Math.min(1, detent);
|
|
499
533
|
});
|
|
500
534
|
|
|
535
|
+
// Hold initialDetentIndex back from native until the gate's effect flushes
|
|
536
|
+
// (see InitialPresentGate) — native presents when the prop lands.
|
|
537
|
+
const autoPresent = initialDetentIndex >= 0;
|
|
538
|
+
const gatedInitialDetentIndex =
|
|
539
|
+
autoPresent && !this.state.initialPresentReady ? -1 : initialDetentIndex;
|
|
540
|
+
|
|
501
541
|
// Cache grabberOptions to avoid creating a new object every render
|
|
502
542
|
if (grabberOptions !== this.cachedGrabberOptions) {
|
|
503
543
|
this.cachedGrabberOptions = grabberOptions;
|
|
@@ -522,7 +562,7 @@ export class TrueSheet
|
|
|
522
562
|
accessibilityOptions={accessibilityOptions}
|
|
523
563
|
dimmed={dimmed}
|
|
524
564
|
dimmedDetentIndex={dimmedDetentIndex}
|
|
525
|
-
initialDetentIndex={
|
|
565
|
+
initialDetentIndex={gatedInitialDetentIndex}
|
|
526
566
|
initialDetentAnimated={initialDetentAnimated}
|
|
527
567
|
dismissible={dismissible}
|
|
528
568
|
draggable={draggable}
|
|
@@ -553,16 +593,19 @@ export class TrueSheet
|
|
|
553
593
|
onWillBlur={this.onWillBlur}
|
|
554
594
|
onDidBlur={this.onDidBlur}
|
|
555
595
|
onVisibilityChange={this.onVisibilityChange}
|
|
596
|
+
// These must stay on this host view, not on the container. The container is
|
|
597
|
+
// reparented into the native sheet, so this view is never a native ancestor of
|
|
598
|
+
// the sheet content. Claiming the responder here stops the negotiation at the
|
|
599
|
+
// sheet boundary without making an ancestor of the content the JS responder,
|
|
600
|
+
// which would block scrolling inside the sheet.
|
|
601
|
+
onStartShouldSetResponder={absorbUnclaimedTouches}
|
|
602
|
+
onTouchStart={stopTouchPropagation}
|
|
603
|
+
onTouchMove={stopTouchPropagation}
|
|
604
|
+
onTouchEnd={stopTouchPropagation}
|
|
605
|
+
onTouchCancel={stopTouchPropagation}
|
|
556
606
|
>
|
|
557
607
|
{this.state.shouldRenderNativeView && (
|
|
558
|
-
<TrueSheetContainerViewNativeComponent
|
|
559
|
-
style={styles.container}
|
|
560
|
-
onStartShouldSetResponder={absorbUnclaimedTouches}
|
|
561
|
-
onTouchStart={stopTouchPropagation}
|
|
562
|
-
onTouchMove={stopTouchPropagation}
|
|
563
|
-
onTouchEnd={stopTouchPropagation}
|
|
564
|
-
onTouchCancel={stopTouchPropagation}
|
|
565
|
-
>
|
|
608
|
+
<TrueSheetContainerViewNativeComponent style={styles.container}>
|
|
566
609
|
{header && (
|
|
567
610
|
<TrueSheetHeaderViewNativeComponent
|
|
568
611
|
style={[
|
|
@@ -591,6 +634,9 @@ export class TrueSheet
|
|
|
591
634
|
{isValidElement(footer) ? footer : createElement(footer)}
|
|
592
635
|
</TrueSheetFooterViewNativeComponent>
|
|
593
636
|
)}
|
|
637
|
+
{autoPresent && !this.state.initialPresentReady && (
|
|
638
|
+
<InitialPresentGate onReady={this.onInitialPresentReady} />
|
|
639
|
+
)}
|
|
594
640
|
</TrueSheetContainerViewNativeComponent>
|
|
595
641
|
)}
|
|
596
642
|
</TrueSheetViewNativeComponent>
|
package/src/TrueSheet.web.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useRef,
|
|
11
11
|
useState,
|
|
12
12
|
} from 'react';
|
|
13
|
-
import type {
|
|
13
|
+
import type { DimensionValue, LayoutChangeEvent } from 'react-native';
|
|
14
14
|
import { StyleSheet, useColorScheme, useWindowDimensions, View } from 'react-native';
|
|
15
15
|
|
|
16
16
|
import type {
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
DEFAULT_GRABBER_WIDTH,
|
|
52
52
|
DEFAULT_MAX_WIDTH,
|
|
53
53
|
} from './web/constants';
|
|
54
|
+
import { getDOMElement } from './web/dom';
|
|
54
55
|
import { Drawer } from './web/vaul';
|
|
55
56
|
import { DEFAULT_PEEK_HEIGHT, TRANSITIONS } from './web/vaul/constants';
|
|
56
57
|
|
|
@@ -302,8 +303,9 @@ const TrueSheetComponent = forwardRef<TrueSheetMethods, TrueSheetProps>((props,
|
|
|
302
303
|
return [
|
|
303
304
|
footerStyle,
|
|
304
305
|
{
|
|
305
|
-
|
|
306
|
-
|
|
306
|
+
// RN types don't model CSS calc(), but RN-web passes it through
|
|
307
|
+
paddingBottom: `calc(${baseCss} + env(safe-area-inset-bottom, 0px))` as DimensionValue,
|
|
308
|
+
},
|
|
307
309
|
];
|
|
308
310
|
}, [footerOwnsInset, footerStyle]);
|
|
309
311
|
|
|
@@ -327,14 +329,10 @@ const TrueSheetComponent = forwardRef<TrueSheetMethods, TrueSheetProps>((props,
|
|
|
327
329
|
// scrollable's viewport replaced by its content size) — the height the
|
|
328
330
|
// content wants regardless of the sheet's bounds.
|
|
329
331
|
const measureNaturalHeight = useCallback(() => {
|
|
330
|
-
const contentEl = contentRef.current
|
|
332
|
+
const contentEl = getDOMElement(contentRef.current);
|
|
331
333
|
if (!contentEl || !contentEl.isConnected) return 0;
|
|
332
|
-
const headerEl = absoluteHeaderRef.current
|
|
333
|
-
|
|
334
|
-
: (headerElRef.current as unknown as HTMLElement | null);
|
|
335
|
-
const footerEl = absoluteFooterRef.current
|
|
336
|
-
? null
|
|
337
|
-
: (footerElRef.current as unknown as HTMLElement | null);
|
|
334
|
+
const headerEl = absoluteHeaderRef.current ? null : getDOMElement(headerElRef.current);
|
|
335
|
+
const footerEl = absoluteFooterRef.current ? null : getDOMElement(footerElRef.current);
|
|
338
336
|
let height =
|
|
339
337
|
(headerEl?.offsetHeight ?? 0) + (footerEl?.offsetHeight ?? 0) + contentEl.offsetHeight;
|
|
340
338
|
const scroller = pinnedScrollerRef.current;
|
|
@@ -377,8 +375,8 @@ const TrueSheetComponent = forwardRef<TrueSheetMethods, TrueSheetProps>((props,
|
|
|
377
375
|
// observation). Resolves the content node live: the layout-branch swap
|
|
378
376
|
// (natural flow ↔ sized) remounts it.
|
|
379
377
|
const observe = () => {
|
|
380
|
-
const contentEl = contentRef.current
|
|
381
|
-
const headerEl = headerElRef.current
|
|
378
|
+
const contentEl = getDOMElement(contentRef.current);
|
|
379
|
+
const headerEl = getDOMElement(headerElRef.current);
|
|
382
380
|
|
|
383
381
|
// Skip mutations that don't change the observed topology — e.g. a
|
|
384
382
|
// virtualized list mounting rows inside the pinned scroller, which
|
|
@@ -549,13 +547,11 @@ const TrueSheetComponent = forwardRef<TrueSheetMethods, TrueSheetProps>((props,
|
|
|
549
547
|
// measure either: they fire while the portal subtree is still detached.
|
|
550
548
|
// Geometry only runs while the drawer is mounted, so the elements are
|
|
551
549
|
// measurable here; fall back to the state value when they're absent.
|
|
552
|
-
const headerEl = headerElRef.current
|
|
550
|
+
const headerEl = getDOMElement(headerElRef.current);
|
|
553
551
|
// A relative footer is pushed off-screen at the peek detent — excluded
|
|
554
|
-
const footerEl = absoluteFooterRef.current
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
const peekEl = peekElRef.current as unknown as HTMLElement | null;
|
|
558
|
-
const contentEl = contentRef.current as unknown as HTMLElement | null;
|
|
552
|
+
const footerEl = absoluteFooterRef.current ? getDOMElement(footerElRef.current) : null;
|
|
553
|
+
const peekEl = getDOMElement(peekElRef.current);
|
|
554
|
+
const contentEl = getDOMElement(contentRef.current);
|
|
559
555
|
const livePeekContentHeight =
|
|
560
556
|
peekEl && contentEl ? measurePeekContentHeight(peekEl, contentEl) : inputs.peekContentHeight;
|
|
561
557
|
const livePeekHeight =
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createContext, type RefObject, useContext, useEffect, useRef } from 'react';
|
|
2
2
|
import { type LayoutChangeEvent, View, type ViewProps } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { getDOMElement } from './web/dom';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Reports the measured peek content height to the owning TrueSheet.
|
|
6
8
|
* @internal
|
|
@@ -44,9 +46,8 @@ export const TrueSheetPeek = ({ onLayout, ...rest }: ViewProps) => {
|
|
|
44
46
|
|
|
45
47
|
const handleLayout = (event: LayoutChangeEvent) => {
|
|
46
48
|
if (context) {
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const contentElement = context.contentRef.current as unknown as HTMLElement | null;
|
|
49
|
+
const peekElement = getDOMElement(viewRef.current);
|
|
50
|
+
const contentElement = getDOMElement(context.contentRef.current);
|
|
50
51
|
|
|
51
52
|
const bottom =
|
|
52
53
|
peekElement && contentElement
|
package/src/mocks/navigation.ts
CHANGED
|
@@ -12,6 +12,11 @@ export const createTrueSheetNavigator = jest.fn(() => ({
|
|
|
12
12
|
Group: jest.fn(() => null),
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Mock createTrueSheetScreen for testing the static API.
|
|
17
|
+
*/
|
|
18
|
+
export const createTrueSheetScreen = jest.fn((config: object) => config);
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* Mock TrueSheetActions for testing.
|
|
17
22
|
*/
|
|
@@ -35,32 +40,34 @@ export const TrueSheetActions = {
|
|
|
35
40
|
/**
|
|
36
41
|
* Mock useTrueSheetNavigation hook for testing.
|
|
37
42
|
*/
|
|
38
|
-
export const useTrueSheetNavigation = jest.fn(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
export const useTrueSheetNavigation = jest.fn(<T extends ParamListBase = ParamListBase>() => {
|
|
44
|
+
// Partial drops react-navigation's private-brand member (PrivateValueStore),
|
|
45
|
+
// which no mock can implement — the members themselves stay type-checked.
|
|
46
|
+
const navigation: Partial<TrueSheetNavigationProp<T>> = {
|
|
47
|
+
navigate: jest.fn(),
|
|
48
|
+
goBack: jest.fn(),
|
|
49
|
+
reset: jest.fn(),
|
|
50
|
+
setParams: jest.fn(),
|
|
51
|
+
dispatch: jest.fn(),
|
|
52
|
+
isFocused: jest.fn(() => true),
|
|
53
|
+
canGoBack: jest.fn(() => true),
|
|
54
|
+
getId: jest.fn(),
|
|
55
|
+
getParent: jest.fn(),
|
|
56
|
+
getState: jest.fn(),
|
|
57
|
+
addListener: jest.fn(() => jest.fn()),
|
|
58
|
+
removeListener: jest.fn(),
|
|
59
|
+
setOptions: jest.fn(),
|
|
60
|
+
push: jest.fn(),
|
|
61
|
+
pop: jest.fn(),
|
|
62
|
+
popTo: jest.fn(),
|
|
63
|
+
popToTop: jest.fn(),
|
|
64
|
+
replace: jest.fn(),
|
|
65
|
+
resize: jest.fn(),
|
|
66
|
+
};
|
|
67
|
+
return navigation as TrueSheetNavigationProp<T>;
|
|
68
|
+
});
|
|
62
69
|
|
|
63
|
-
export type { TrueSheetActionType } from '../navigation/
|
|
70
|
+
export type { TrueSheetActionType } from '../navigation/actions';
|
|
64
71
|
export type { DetentInfoEventPayload, PositionChangeEventPayload } from '../TrueSheet.types';
|
|
65
72
|
export type {
|
|
66
73
|
TrueSheetNavigationEventMap,
|