@lodev09/react-native-true-sheet 4.0.0-beta.5 → 4.0.0-beta.6
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/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 +5 -3
- 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/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 +5 -5
- 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/types.d.ts +34 -4
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- package/package.json +1 -1
- 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 +20 -19
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +6 -7
- package/src/navigation/types.ts +65 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TrueSheetActions","useTrueSheetNavigation","useTrueSheetNavigationMock","Sheet","Object","assign","jest","fn","children","Screen","Protected"],"sourceRoot":"../../../src","sources":["mocks/navigationExpoRouter.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["TrueSheetActions","useTrueSheetNavigation","useTrueSheetNavigationMock","Sheet","Object","assign","jest","fn","children","Screen","Protected"],"sourceRoot":"../../../src","sources":["mocks/navigationExpoRouter.ts"],"mappings":";;AAEA,SACEA,gBAAgB,EAChBC,sBAAsB,IAAIC,0BAA0B,QAC/C,iBAAc;;AAErB;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,GAAGC,MAAM,CAACC,MAAM,CAChCC,IAAI,CAACC,EAAE,CAAC,CAAC;EAAEC;AAAwC,CAAC,KAAKA,QAAQ,CAAC,EAClE;EACEC,MAAM,EAAEH,IAAI,CAACC,EAAE,CAAC,MAAM,IAAI,CAAC;EAC3BG,SAAS,EAAEJ,IAAI,CAACC,EAAE,CAAC,MAAM,IAAI;AAC/B,CACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMN,sBAAsB,GAAGK,IAAI,CAACC,EAAE,CAG3C,MACEL,0BAA0B,CAAC,CAC/B,CAAC;AAED,SAASF,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["navigation/base-types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { TrueSheetActions } from "./actions.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The base `StackRouter` factory to wrap, typed generically over the state and
|
|
7
|
-
* action types the wrapper threads through — `StackRouter` is structural and
|
|
8
|
-
* never touches the sheet-specific fields.
|
|
9
|
-
* Injected by each entry point so the shared router never imports
|
|
10
|
-
* `@react-navigation/*` at runtime (Expo Router apps don't install it).
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
4
|
const uid = () => Math.random().toString(36).slice(2, 10);
|
|
14
5
|
const ensureBaseRoute = (state, baseRouteName, routeParamList) => {
|
|
15
6
|
if (!baseRouteName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TrueSheetActions","uid","Math","random","toString","slice","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","index","length","createTrueSheetRouter","stackRouter","routerOptions","baseRouter","type","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetRouter.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["TrueSheetActions","uid","Math","random","toString","slice","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","index","length","createTrueSheetRouter","stackRouter","routerOptions","baseRouter","type","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetRouter.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,cAAW;AAG5C,MAAMC,GAAG,GAAGA,CAAA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MlD,KAAK,GAAGgB,UAAU,CAACiC,kBAAkB,CAACC,YAAY,EAAE;QACxD7B,UAAU;QACVnB,cAAc;QACdiD;MACF,CAAC,CAAC;MAEF,MAAMlD,aAAa,GAAGc,aAAa,CAACK,gBAAgB,IAAIC,UAAU,CAAC,CAAC,CAAC;MACrE,MAAMC,kBAAkB,GAAGvB,eAAe,CAACC,KAAK,EAAEC,aAAa,EAAEC,cAAc,CAAC;MAEhF,OAAO;QACL,GAAGoB,kBAAkB;QACrBL,IAAI,EAAE,YAAY;QAClBR,GAAG,EAAE,cAAcf,GAAG,CAAC,CAAC;MAC1B,CAAC;IACH,CAAC;IAED0D,cAAc,EAAE3D;EAClB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["navigation/expo-router/base-types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
import { StackRouter, unstable_integrateWithRouter, useNavigation } from 'expo-router';
|
|
4
4
|
import { createTrueSheetRouter } from "../createTrueSheetRouter.js";
|
|
5
5
|
import { trueSheetNavigator } from "../navigator.js";
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
6
|
+
// expo-router's vendored StackRouter is structurally identical to @react-navigation's.
|
|
7
|
+
// Pinned to this entry's own router types: `createTrueSheetRouter` is shared and typed
|
|
8
|
+
// against React Navigation, which resolves to `any` in apps that only install expo-router.
|
|
9
|
+
const sheetRouter = createTrueSheetRouter(StackRouter);
|
|
10
|
+
const SheetNavigator = unstable_integrateWithRouter(trueSheetNavigator, sheetRouter, {
|
|
9
11
|
createProps: ({
|
|
10
12
|
state,
|
|
11
13
|
dispatch
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StackRouter","unstable_integrateWithRouter","useNavigation","createTrueSheetRouter","trueSheetNavigator","SheetNavigator","createProps","state","dispatch","routes","Sheet","useTrueSheetNavigation","TrueSheetActions"],"sourceRoot":"../../../../src","sources":["navigation/expo-router/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["StackRouter","unstable_integrateWithRouter","useNavigation","createTrueSheetRouter","trueSheetNavigator","sheetRouter","SheetNavigator","createProps","state","dispatch","routes","Sheet","useTrueSheetNavigation","TrueSheetActions"],"sourceRoot":"../../../../src","sources":["navigation/expo-router/index.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,4BAA4B,EAAEC,aAAa,QAAQ,aAAa;AAEtF,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,kBAAkB,QAAQ,iBAAc;AAcjD;AACA;AACA;AACA,MAAMC,WAAmC,GAAGF,qBAAqB,CAC/DH,WACF,CAAC;AAED,MAAMM,cAAc,GAAGL,4BAA4B,CAMjDG,kBAAkB,EAAEC,WAAW,EAAE;EACjCE,WAAW,EAAEA,CAAC;IAAEC,KAAK;IAAEC;EAAS,CAAC,MAAM;IACrCC,MAAM,EAAEF,KAAK,CAACE,MAAM;IACpBD;EACF,CAAC;AACH,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,KAAK,GAAGL,cAGpB;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMM,sBAAsB,GAAGA,CAAA,KAEHV,aAAa,CAA6B,CAAC;AAE9E,SAASW,gBAAgB,QAAkC,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["navigation/expo-router/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createStandardNavigationFactories","StackRouter","createTrueSheetRouter","trueSheetNavigator","createNavigator","createScreen","state","navigation","routes","dispatch","createTrueSheetNavigator","createTrueSheetScreen","TrueSheetActions","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/index.ts"],"mappings":";;AAAA,SACEA,iCAAiC,EACjCC,WAAW,QAEN,0BAA0B;AAEjC,SAASC,qBAAqB,
|
|
1
|
+
{"version":3,"names":["createStandardNavigationFactories","StackRouter","createTrueSheetRouter","trueSheetNavigator","createNavigator","createScreen","state","navigation","routes","dispatch","createTrueSheetNavigator","createTrueSheetScreen","TrueSheetActions","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/index.ts"],"mappings":";;AAAA,SACEA,iCAAiC,EACjCC,WAAW,QAEN,0BAA0B;AAEjC,SAASC,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASC,kBAAkB,QAAQ,gBAAa;AAmBhD,MAAM;EAAEC,eAAe;EAAEC;AAAa,CAAC,GAAGL,iCAAiC,CAKzEG,kBAAkB,EAClBD,qBAAqB,CAACD,WAAiC,CAAC,EACxD,CAAC;EAAEK,KAAK;EAAEC;AAAW,CAAC,MAAM;EAAEC,MAAM,EAAEF,KAAK,CAACE,MAAM;EAAEC,QAAQ,EAAEF,UAAU,CAACE;AAAS,CAAC,CACrF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAGN,eAAe;;AAEvD;AACA;AACA;AACA,OAAO,MAAMO,qBAAqB,GAAGN,YAAY;AAEjD,SAASO,gBAAgB,QAAkC,cAAW;AACtE,SAASV,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASW,sBAAsB,QAAQ,6BAA0B","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ParamListBase } from '
|
|
2
|
-
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';
|
|
3
3
|
import { TrueSheetActions } from './navigation';
|
|
4
4
|
/**
|
|
5
5
|
* Mock Sheet layout for testing.
|
|
@@ -18,5 +18,5 @@ export declare const useTrueSheetNavigation: jest.Mock<TrueSheetNavigationProp<P
|
|
|
18
18
|
export { TrueSheetActions };
|
|
19
19
|
export type { TrueSheetActionType } from '../navigation/actions';
|
|
20
20
|
export type { DetentInfoEventPayload, PositionChangeEventPayload } from '../TrueSheet.types';
|
|
21
|
-
export type { TrueSheetNavigationEventMap, TrueSheetNavigationHelpers, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetScreenProps, } from '../navigation/types';
|
|
21
|
+
export type { TrueSheetNavigationEventMap, TrueSheetNavigationHelpers, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetScreenProps, } from '../navigation/expo-router/types';
|
|
22
22
|
//# sourceMappingURL=navigationExpoRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigationExpoRouter.d.ts","sourceRoot":"","sources":["../../../../src/mocks/navigationExpoRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"navigationExpoRouter.d.ts","sourceRoot":"","sources":["../../../../src/mocks/navigationExpoRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,eAAO,MAAM,KAAK;cACmB,KAAK,CAAC,SAAS;;;;CAKnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,4DAKlC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC7F,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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 { DefaultNavigatorOptions, Descriptor, NavigationAction, NavigationHelpers, NavigationProp, NavigationState, ParamListBase, RouteProp, Router, StackActionHelpers, StackRouterOptions, } from '@react-navigation/core';
|
|
9
|
+
//# sourceMappingURL=base-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../../../../src/navigation/base-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,YAAY,EACV,uBAAuB,EACvB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { TrueSheetNavigationState } from './types';
|
|
4
|
-
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
5
|
-
/**
|
|
6
|
-
* The base `StackRouter` factory to wrap, typed generically over the state and
|
|
7
|
-
* action types the wrapper threads through — `StackRouter` is structural and
|
|
8
|
-
* never touches the sheet-specific fields.
|
|
9
|
-
* Injected by each entry point so the shared router never imports
|
|
10
|
-
* `@react-navigation/*` at runtime (Expo Router apps don't install it).
|
|
11
|
-
*/
|
|
12
|
-
export type StackRouterFactory = <State extends NavigationState<ParamListBase>, Action extends NavigationAction>(options: TrueSheetRouterOptions) => Router<State, Action>;
|
|
13
|
-
export declare const createTrueSheetRouter: (stackRouter: StackRouterFactory) => (routerOptions: TrueSheetRouterOptions) => Router<TrueSheetNavigationState<ParamListBase>, TrueSheetActionType>;
|
|
1
|
+
import type { TrueSheetRouter, TrueSheetRouterFactory, TrueSheetRouterOptions } from './types';
|
|
2
|
+
export declare const createTrueSheetRouter: (stackRouter: TrueSheetRouterFactory) => (routerOptions: TrueSheetRouterOptions) => TrueSheetRouter;
|
|
14
3
|
//# sourceMappingURL=createTrueSheetRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTrueSheetRouter.d.ts","sourceRoot":"","sources":["../../../../src/navigation/createTrueSheetRouter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createTrueSheetRouter.d.ts","sourceRoot":"","sources":["../../../../src/navigation/createTrueSheetRouter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAgC/F,eAAO,MAAM,qBAAqB,GAC/B,aAAa,sBAAsB,MACnC,eAAe,sBAAsB,KAAG,eA8JxC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 { DefaultNavigatorOptions, NavigationAction, NavigationHelpers, NavigationProp, NavigationState, ParamListBase, RouteProp, Router, StackActionHelpers, StackRouterOptions, } from 'expo-router/react-navigation';
|
|
8
|
+
//# sourceMappingURL=base-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/expo-router/base-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EACV,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ParamListBase } from '
|
|
2
|
-
import type { TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetNavigatorContentExtraProps, TrueSheetNavigatorProps, TrueSheetStandardEventMap } from '
|
|
3
|
-
declare const SheetNavigator: import("react").ForwardRefExoticComponent<Omit<import("expo-router/build/standard-navigation/types").StandardRouterNavigatorProps<TrueSheetNavigationState<ParamListBase>, TrueSheetNavigationOptions, TrueSheetStandardEventMap, TrueSheetNavigatorContentExtraProps, import("
|
|
4
|
-
Screen: (props: import("expo-router").ScreenProps<TrueSheetNavigationOptions, TrueSheetNavigationState<ParamListBase>, TrueSheetStandardEventMap & import("expo-router/
|
|
1
|
+
import type { ParamListBase } from './base-types';
|
|
2
|
+
import type { TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetNavigatorContentExtraProps, TrueSheetNavigatorProps, TrueSheetStandardEventMap } from './types';
|
|
3
|
+
declare const SheetNavigator: import("react").ForwardRefExoticComponent<Omit<import("expo-router/build/standard-navigation/types").StandardRouterNavigatorProps<TrueSheetNavigationState<ParamListBase>, TrueSheetNavigationOptions, TrueSheetStandardEventMap, TrueSheetNavigatorContentExtraProps, import("expo-router").StackRouterOptions>, "children"> & Partial<Pick<import("expo-router/build/standard-navigation/types").StandardRouterNavigatorProps<TrueSheetNavigationState<ParamListBase>, TrueSheetNavigationOptions, TrueSheetStandardEventMap, TrueSheetNavigatorContentExtraProps, import("expo-router").StackRouterOptions>, "children">> & import("react").RefAttributes<unknown>> & {
|
|
4
|
+
Screen: (props: import("expo-router").ScreenProps<TrueSheetNavigationOptions, TrueSheetNavigationState<ParamListBase>, TrueSheetStandardEventMap & import("expo-router/react-navigation").EventMapBase>) => null;
|
|
5
5
|
Protected: typeof import("expo-router/build/views/Protected").Protected;
|
|
6
6
|
};
|
|
7
7
|
type SheetProps = Omit<React.ComponentProps<typeof SheetNavigator>, 'screenListeners' | 'routes' | 'dispatch'> & Partial<Pick<React.ComponentProps<typeof SheetNavigator>, 'routes' | 'dispatch'>> & Pick<TrueSheetNavigatorProps, 'screenListeners'>;
|
|
@@ -33,5 +33,5 @@ export declare const Sheet: React.ComponentType<SheetProps> & {
|
|
|
33
33
|
export declare const useTrueSheetNavigation: <T extends ParamListBase = ParamListBase>() => TrueSheetNavigationProp<T>;
|
|
34
34
|
export { TrueSheetActions, type TrueSheetActionType } from '../actions';
|
|
35
35
|
export type { DetentInfoEventPayload, PositionChangeEventPayload } from '../../TrueSheet.types';
|
|
36
|
-
export type { TrueSheetNavigationEventMap, TrueSheetNavigationHelpers, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetScreenProps, } from '
|
|
36
|
+
export type { TrueSheetNavigationEventMap, TrueSheetNavigationHelpers, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetScreenProps, } from './types';
|
|
37
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/expo-router/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/expo-router/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAEV,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,mCAAmC,EACnC,uBAAuB,EAGvB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AASjB,QAAA,MAAM,cAAc;;;CAWlB,CAAC;AAMH,KAAK,UAAU,GAAG,IAAI,CACpB,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,EAC3C,iBAAiB,GAAG,QAAQ,GAAG,UAAU,CAC1C,GACC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,GACjF,IAAI,CAAC,uBAAuB,EAAE,iBAAiB,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK,EAAqB,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG;IACvE,MAAM,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;IACrC,SAAS,EAAE,OAAO,cAAc,CAAC,SAAS,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,CAAC,SAAS,aAAa,GAAG,aAAa,OACpC,uBAAuB,CAAC,CAAC,CAAgD,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAExE,YAAY,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEhG,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { TrueSheetActionHelpersOf, TrueSheetDispatch, TrueSheetNavigationEventMap, TrueSheetNavigationOptions, TrueSheetStateOf } from '../types';
|
|
8
|
+
import type { DefaultNavigatorOptions, NavigationAction, NavigationHelpers, NavigationProp, NavigationState, ParamListBase, RouteProp, Router, StackActionHelpers, StackRouterOptions } from './base-types';
|
|
9
|
+
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
10
|
+
export type TrueSheetNavigationState<ParamList extends ParamListBase> = TrueSheetStateOf<NavigationState<ParamList>>;
|
|
11
|
+
export type TrueSheetRouterState = TrueSheetNavigationState<ParamListBase>;
|
|
12
|
+
export type TrueSheetRouter = Router<TrueSheetRouterState, TrueSheetActionType>;
|
|
13
|
+
export type TrueSheetRouterFactory = (options: TrueSheetRouterOptions) => TrueSheetRouter;
|
|
14
|
+
/**
|
|
15
|
+
* The base `StackRouter` factory to wrap — see `../types` for the shared contract.
|
|
16
|
+
*/
|
|
17
|
+
export type StackRouterFactory = <State extends NavigationState<ParamListBase>, Action extends NavigationAction>(options: TrueSheetRouterOptions) => Router<State, Action>;
|
|
18
|
+
export type TrueSheetRoute = TrueSheetNavigationState<ParamListBase>['routes'][number];
|
|
19
|
+
/**
|
|
20
|
+
* Props injected into the navigator content by Expo Router's `createProps`.
|
|
21
|
+
* Raw routes carry the custom fields (`closing`, `resizeIndex`, `resizeKey`)
|
|
22
|
+
* that the standard state strips out.
|
|
23
|
+
*/
|
|
24
|
+
export interface TrueSheetNavigatorContentExtraProps {
|
|
25
|
+
routes: TrueSheetRoute[];
|
|
26
|
+
dispatch: TrueSheetDispatch;
|
|
27
|
+
}
|
|
28
|
+
export type TrueSheetActionHelpers<ParamList extends ParamListBase> = TrueSheetActionHelpersOf<StackActionHelpers<ParamList>>;
|
|
29
|
+
export type TrueSheetNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TrueSheetNavigationState<ParamList>, TrueSheetNavigationOptions, TrueSheetNavigationEventMap> & TrueSheetActionHelpers<ParamList>;
|
|
30
|
+
export type TrueSheetScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = {
|
|
31
|
+
navigation: TrueSheetNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
32
|
+
route: RouteProp<ParamList, RouteName>;
|
|
33
|
+
};
|
|
34
|
+
export type TrueSheetNavigationHelpers = NavigationHelpers<ParamListBase, TrueSheetNavigationEventMap>;
|
|
35
|
+
export type TrueSheetNavigatorProps = DefaultNavigatorOptions<ParamListBase, string | undefined, TrueSheetNavigationState<ParamListBase>, TrueSheetNavigationOptions, TrueSheetNavigationEventMap, unknown> & {
|
|
36
|
+
/**
|
|
37
|
+
* The name of the route to use as the base screen.
|
|
38
|
+
* This screen will be rendered as a regular screen, while other screens are presented as sheets.
|
|
39
|
+
* Defaults to the first screen defined in the navigator.
|
|
40
|
+
*/
|
|
41
|
+
initialRouteName?: string;
|
|
42
|
+
};
|
|
43
|
+
export type { PositionChangeHandler, TrueSheetDispatch, TrueSheetNavigationEventMap, TrueSheetNavigationOptions, TrueSheetNavigationSheetProps, TrueSheetStandardEventMap, } from '../types';
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/navigation/expo-router/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAC3B,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,cAAc,CAAC;A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AAS,SAAS,aAAa,EAC/B,SAAS,SAAS,MAAM,SAAS,GAAG,MAAM,EAC1C,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,IAChD;IACF,UAAU,EAAE,uBAAuB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACvE,KAAK,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CACxD,aAAa,EACb,2BAA2B,CAC5B,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,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,UAAU,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type StandardNavigationTypeBagBase } from '@react-navigation/native';
|
|
2
|
-
import type { TrueSheetActionHelpers, TrueSheetNavigationOptions, TrueSheetNavigationEventMap, TrueSheetNavigationState } from './types';
|
|
3
|
-
import type { TrueSheetRouterOptions } from './createTrueSheetRouter';
|
|
2
|
+
import type { TrueSheetActionHelpers, TrueSheetNavigationOptions, TrueSheetNavigationEventMap, TrueSheetNavigationState, TrueSheetRouterOptions } from './types';
|
|
4
3
|
export interface TrueSheetNavigationTypeBag extends StandardNavigationTypeBagBase {
|
|
5
4
|
State: TrueSheetNavigationState<this['ParamList']>;
|
|
6
5
|
ActionHelpers: TrueSheetActionHelpers<this['ParamList']>;
|
|
@@ -39,8 +38,8 @@ export declare const createTrueSheetScreen: import("@react-navigation/core").Sta
|
|
|
39
38
|
Navigator: import("react").ComponentType<{}>;
|
|
40
39
|
}>;
|
|
41
40
|
export { TrueSheetActions, type TrueSheetActionType } from './actions';
|
|
42
|
-
export { createTrueSheetRouter
|
|
41
|
+
export { createTrueSheetRouter } from './createTrueSheetRouter';
|
|
43
42
|
export { useTrueSheetNavigation } from './useTrueSheetNavigation';
|
|
44
43
|
export type { DetentInfoEventPayload, PositionChangeEventPayload } from '../TrueSheet.types';
|
|
45
|
-
export type { TrueSheetNavigationEventMap, TrueSheetNavigationHelpers, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetScreenProps, } from './types';
|
|
44
|
+
export type { StackRouterFactory, TrueSheetNavigationEventMap, TrueSheetNavigationHelpers, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetRouterOptions, TrueSheetScreenProps, } from './types';
|
|
46
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EAEV,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EAExB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB,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,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,YAAY,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAE7F,YAAY,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, NavigationState, ParamListBase, RouteProp, StackActionHelpers } from '@react-navigation/core';
|
|
2
1
|
import type { NavigatorArgs } from 'standard-navigation';
|
|
3
2
|
import type { DetentInfoEventPayload, PositionChangeEventPayload, TrueSheetProps } from '../TrueSheet.types';
|
|
4
3
|
import type { TrueSheetActionType } from './actions';
|
|
4
|
+
import type { DefaultNavigatorOptions, Descriptor, NavigationAction, NavigationHelpers, NavigationProp, NavigationState, ParamListBase, RouteProp, Router, StackActionHelpers, StackRouterOptions } from './base-types';
|
|
5
5
|
export type PositionChangeHandler = (payload: PositionChangeEventPayload) => void;
|
|
6
6
|
export type TrueSheetNavigationEventMap = {
|
|
7
7
|
/**
|
|
@@ -83,14 +83,39 @@ export type TrueSheetNavigationEventMap = {
|
|
|
83
83
|
data: undefined;
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
/**
|
|
87
|
+
* A navigation state tagged as `true-sheet`, with the sheet fields the router
|
|
88
|
+
* adds to each route.
|
|
89
|
+
* Generic over the base state so each entry point can bind its own
|
|
90
|
+
* `NavigationState` — see `./base-types`.
|
|
91
|
+
*/
|
|
92
|
+
export type TrueSheetStateOf<State extends {
|
|
93
|
+
routes: readonly unknown[];
|
|
94
|
+
}> = Omit<State, 'routes'> & {
|
|
87
95
|
type: 'true-sheet';
|
|
88
|
-
routes: (
|
|
96
|
+
routes: (State['routes'][number] & {
|
|
89
97
|
resizeIndex?: number;
|
|
90
98
|
resizeKey?: number;
|
|
91
99
|
closing?: boolean;
|
|
92
100
|
})[];
|
|
93
101
|
};
|
|
102
|
+
export type TrueSheetNavigationState<ParamList extends ParamListBase> = TrueSheetStateOf<NavigationState<ParamList>>;
|
|
103
|
+
export type TrueSheetRouterState = TrueSheetNavigationState<ParamListBase>;
|
|
104
|
+
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
105
|
+
export type TrueSheetRouter = Router<TrueSheetRouterState, TrueSheetActionType>;
|
|
106
|
+
/**
|
|
107
|
+
* The wrapped router factory — also the shape `createTrueSheetRouter` accepts,
|
|
108
|
+
* pre-instantiated so either entry point's `StackRouterFactory` fits it.
|
|
109
|
+
*/
|
|
110
|
+
export type TrueSheetRouterFactory = (options: TrueSheetRouterOptions) => TrueSheetRouter;
|
|
111
|
+
/**
|
|
112
|
+
* The base `StackRouter` factory to wrap, typed generically over the state and
|
|
113
|
+
* action types the wrapper threads through — `StackRouter` is structural and
|
|
114
|
+
* never touches the sheet-specific fields.
|
|
115
|
+
* Injected by each entry point so the shared router never imports
|
|
116
|
+
* `@react-navigation/*` at runtime (Expo Router apps don't install it).
|
|
117
|
+
*/
|
|
118
|
+
export type StackRouterFactory = <State extends NavigationState<ParamListBase>, Action extends NavigationAction>(options: TrueSheetRouterOptions) => Router<State, Action>;
|
|
94
119
|
/**
|
|
95
120
|
* `TrueSheetNavigationEventMap` in the `standard-navigation` event-map shape.
|
|
96
121
|
*/
|
|
@@ -113,12 +138,17 @@ export interface TrueSheetNavigatorContentExtraProps {
|
|
|
113
138
|
routes: TrueSheetRoute[];
|
|
114
139
|
dispatch: TrueSheetDispatch;
|
|
115
140
|
}
|
|
116
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Generic over the base helpers so each entry point can bind its own
|
|
143
|
+
* `StackActionHelpers` — see `./base-types`.
|
|
144
|
+
*/
|
|
145
|
+
export type TrueSheetActionHelpersOf<Helpers> = Helpers & {
|
|
117
146
|
/**
|
|
118
147
|
* Resize the sheet to a specific detent index.
|
|
119
148
|
*/
|
|
120
149
|
resize(index?: number): void;
|
|
121
150
|
};
|
|
151
|
+
export type TrueSheetActionHelpers<ParamList extends ParamListBase> = TrueSheetActionHelpersOf<StackActionHelpers<ParamList>>;
|
|
122
152
|
export type TrueSheetNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TrueSheetNavigationState<ParamList>, TrueSheetNavigationOptions, TrueSheetNavigationEventMap> & TrueSheetActionHelpers<ParamList>;
|
|
123
153
|
export type TrueSheetScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = {
|
|
124
154
|
navigation: TrueSheetNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC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AC;CACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -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,20 +1,26 @@
|
|
|
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';
|
|
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
|
+
);
|
|
18
24
|
|
|
19
25
|
const SheetNavigator = unstable_integrateWithRouter<
|
|
20
26
|
TrueSheetNavigationOptions,
|
|
@@ -22,17 +28,12 @@ const SheetNavigator = unstable_integrateWithRouter<
|
|
|
22
28
|
TrueSheetStandardEventMap,
|
|
23
29
|
TrueSheetNavigatorContentExtraProps,
|
|
24
30
|
TrueSheetRouterOptions
|
|
25
|
-
>(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
routes: state.routes,
|
|
32
|
-
dispatch,
|
|
33
|
-
}),
|
|
34
|
-
}
|
|
35
|
-
);
|
|
31
|
+
>(trueSheetNavigator, sheetRouter, {
|
|
32
|
+
createProps: ({ state, dispatch }) => ({
|
|
33
|
+
routes: state.routes,
|
|
34
|
+
dispatch,
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
36
37
|
|
|
37
38
|
// Public props: `routes`/`dispatch` are injected by `createProps` (optional here
|
|
38
39
|
// so the navigator type stays comparable), and expo-router intersects the event
|
|
@@ -86,4 +87,4 @@ export type {
|
|
|
86
87
|
TrueSheetNavigationProp,
|
|
87
88
|
TrueSheetNavigationState,
|
|
88
89
|
TrueSheetScreenProps,
|
|
89
|
-
} from '
|
|
90
|
+
} 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';
|
package/src/navigation/index.ts
CHANGED
|
@@ -4,16 +4,17 @@ import {
|
|
|
4
4
|
type StandardNavigationTypeBagBase,
|
|
5
5
|
} from '@react-navigation/native';
|
|
6
6
|
|
|
7
|
-
import { createTrueSheetRouter
|
|
7
|
+
import { createTrueSheetRouter } from './createTrueSheetRouter';
|
|
8
8
|
import { trueSheetNavigator } from './navigator';
|
|
9
9
|
import type {
|
|
10
|
+
StackRouterFactory,
|
|
10
11
|
TrueSheetActionHelpers,
|
|
11
12
|
TrueSheetNavigationOptions,
|
|
12
13
|
TrueSheetNavigationEventMap,
|
|
13
14
|
TrueSheetNavigationState,
|
|
14
15
|
TrueSheetNavigatorContentExtraProps,
|
|
16
|
+
TrueSheetRouterOptions,
|
|
15
17
|
} from './types';
|
|
16
|
-
import type { TrueSheetRouterOptions } from './createTrueSheetRouter';
|
|
17
18
|
|
|
18
19
|
export interface TrueSheetNavigationTypeBag extends StandardNavigationTypeBagBase {
|
|
19
20
|
State: TrueSheetNavigationState<this['ParamList']>;
|
|
@@ -62,20 +63,18 @@ export const createTrueSheetNavigator = createNavigator;
|
|
|
62
63
|
export const createTrueSheetScreen = createScreen;
|
|
63
64
|
|
|
64
65
|
export { TrueSheetActions, type TrueSheetActionType } from './actions';
|
|
65
|
-
export {
|
|
66
|
-
createTrueSheetRouter,
|
|
67
|
-
type StackRouterFactory,
|
|
68
|
-
type TrueSheetRouterOptions,
|
|
69
|
-
} from './createTrueSheetRouter';
|
|
66
|
+
export { createTrueSheetRouter } from './createTrueSheetRouter';
|
|
70
67
|
export { useTrueSheetNavigation } from './useTrueSheetNavigation';
|
|
71
68
|
|
|
72
69
|
export type { DetentInfoEventPayload, PositionChangeEventPayload } from '../TrueSheet.types';
|
|
73
70
|
|
|
74
71
|
export type {
|
|
72
|
+
StackRouterFactory,
|
|
75
73
|
TrueSheetNavigationEventMap,
|
|
76
74
|
TrueSheetNavigationHelpers,
|
|
77
75
|
TrueSheetNavigationOptions,
|
|
78
76
|
TrueSheetNavigationProp,
|
|
79
77
|
TrueSheetNavigationState,
|
|
78
|
+
TrueSheetRouterOptions,
|
|
80
79
|
TrueSheetScreenProps,
|
|
81
80
|
} from './types';
|
package/src/navigation/types.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
+
import type { NavigatorArgs } from 'standard-navigation';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
DetentInfoEventPayload,
|
|
5
|
+
PositionChangeEventPayload,
|
|
6
|
+
TrueSheetProps,
|
|
7
|
+
} from '../TrueSheet.types';
|
|
8
|
+
import type { TrueSheetActionType } from './actions';
|
|
1
9
|
import type {
|
|
2
10
|
DefaultNavigatorOptions,
|
|
3
11
|
Descriptor,
|
|
12
|
+
NavigationAction,
|
|
4
13
|
NavigationHelpers,
|
|
5
14
|
NavigationProp,
|
|
6
15
|
NavigationState,
|
|
7
16
|
ParamListBase,
|
|
8
17
|
RouteProp,
|
|
18
|
+
Router,
|
|
9
19
|
StackActionHelpers,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import type {
|
|
14
|
-
DetentInfoEventPayload,
|
|
15
|
-
PositionChangeEventPayload,
|
|
16
|
-
TrueSheetProps,
|
|
17
|
-
} from '../TrueSheet.types';
|
|
18
|
-
import type { TrueSheetActionType } from './actions';
|
|
20
|
+
StackRouterOptions,
|
|
21
|
+
} from './base-types';
|
|
19
22
|
|
|
20
23
|
export type PositionChangeHandler = (payload: PositionChangeEventPayload) => void;
|
|
21
24
|
|
|
@@ -74,18 +77,54 @@ export type TrueSheetNavigationEventMap = {
|
|
|
74
77
|
sheetDidBlur: { data: undefined };
|
|
75
78
|
};
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
/**
|
|
81
|
+
* A navigation state tagged as `true-sheet`, with the sheet fields the router
|
|
82
|
+
* adds to each route.
|
|
83
|
+
* Generic over the base state so each entry point can bind its own
|
|
84
|
+
* `NavigationState` — see `./base-types`.
|
|
85
|
+
*/
|
|
86
|
+
export type TrueSheetStateOf<State extends { routes: readonly unknown[] }> = Omit<
|
|
87
|
+
State,
|
|
79
88
|
'routes'
|
|
80
89
|
> & {
|
|
81
90
|
type: 'true-sheet';
|
|
82
|
-
routes: (
|
|
91
|
+
routes: (State['routes'][number] & {
|
|
83
92
|
resizeIndex?: number;
|
|
84
93
|
resizeKey?: number;
|
|
85
94
|
closing?: boolean;
|
|
86
95
|
})[];
|
|
87
96
|
};
|
|
88
97
|
|
|
98
|
+
export type TrueSheetNavigationState<ParamList extends ParamListBase> = TrueSheetStateOf<
|
|
99
|
+
NavigationState<ParamList>
|
|
100
|
+
>;
|
|
101
|
+
|
|
102
|
+
export type TrueSheetRouterState = TrueSheetNavigationState<ParamListBase>;
|
|
103
|
+
|
|
104
|
+
export type TrueSheetRouterOptions = StackRouterOptions;
|
|
105
|
+
|
|
106
|
+
export type TrueSheetRouter = Router<TrueSheetRouterState, TrueSheetActionType>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The wrapped router factory — also the shape `createTrueSheetRouter` accepts,
|
|
110
|
+
* pre-instantiated so either entry point's `StackRouterFactory` fits it.
|
|
111
|
+
*/
|
|
112
|
+
export type TrueSheetRouterFactory = (options: TrueSheetRouterOptions) => TrueSheetRouter;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The base `StackRouter` factory to wrap, typed generically over the state and
|
|
116
|
+
* action types the wrapper threads through — `StackRouter` is structural and
|
|
117
|
+
* never touches the sheet-specific fields.
|
|
118
|
+
* Injected by each entry point so the shared router never imports
|
|
119
|
+
* `@react-navigation/*` at runtime (Expo Router apps don't install it).
|
|
120
|
+
*/
|
|
121
|
+
export type StackRouterFactory = <
|
|
122
|
+
State extends NavigationState<ParamListBase>,
|
|
123
|
+
Action extends NavigationAction,
|
|
124
|
+
>(
|
|
125
|
+
options: TrueSheetRouterOptions
|
|
126
|
+
) => Router<State, Action>;
|
|
127
|
+
|
|
89
128
|
/**
|
|
90
129
|
* `TrueSheetNavigationEventMap` in the `standard-navigation` event-map shape.
|
|
91
130
|
*/
|
|
@@ -116,13 +155,20 @@ export interface TrueSheetNavigatorContentExtraProps {
|
|
|
116
155
|
dispatch: TrueSheetDispatch;
|
|
117
156
|
}
|
|
118
157
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Generic over the base helpers so each entry point can bind its own
|
|
160
|
+
* `StackActionHelpers` — see `./base-types`.
|
|
161
|
+
*/
|
|
162
|
+
export type TrueSheetActionHelpersOf<Helpers> = Helpers & {
|
|
163
|
+
/**
|
|
164
|
+
* Resize the sheet to a specific detent index.
|
|
165
|
+
*/
|
|
166
|
+
resize(index?: number): void;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type TrueSheetActionHelpers<ParamList extends ParamListBase> = TrueSheetActionHelpersOf<
|
|
170
|
+
StackActionHelpers<ParamList>
|
|
171
|
+
>;
|
|
126
172
|
|
|
127
173
|
export type TrueSheetNavigationProp<
|
|
128
174
|
ParamList extends ParamListBase,
|