@lodev09/react-native-true-sheet 4.0.0-beta.4 → 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.
Files changed (63) hide show
  1. package/README.md +21 -2
  2. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +0 -7
  3. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +0 -36
  4. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +0 -1
  5. package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +0 -1
  6. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +0 -8
  7. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +17 -38
  8. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +0 -2
  9. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +1 -2
  10. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +1 -7
  11. package/ios/TrueSheetContainerView.h +0 -6
  12. package/ios/TrueSheetContainerView.mm +0 -1
  13. package/ios/TrueSheetContentView.h +0 -7
  14. package/ios/TrueSheetContentView.mm +0 -32
  15. package/ios/TrueSheetView.mm +0 -6
  16. package/ios/TrueSheetViewController.mm +35 -27
  17. package/lib/module/TrueSheet.js +10 -5
  18. package/lib/module/TrueSheet.js.map +1 -1
  19. package/lib/module/TrueSheet.web.js.map +1 -1
  20. package/lib/module/mocks/navigationExpoRouter.js.map +1 -1
  21. package/lib/module/navigation/base-types.js +2 -0
  22. package/lib/module/navigation/base-types.js.map +1 -0
  23. package/lib/module/navigation/createTrueSheetRouter.js +0 -9
  24. package/lib/module/navigation/createTrueSheetRouter.js.map +1 -1
  25. package/lib/module/navigation/expo-router/base-types.js +2 -0
  26. package/lib/module/navigation/expo-router/base-types.js.map +1 -0
  27. package/lib/module/navigation/expo-router/index.js +5 -3
  28. package/lib/module/navigation/expo-router/index.js.map +1 -1
  29. package/lib/module/navigation/expo-router/types.js +4 -0
  30. package/lib/module/navigation/expo-router/types.js.map +1 -0
  31. package/lib/module/navigation/index.js.map +1 -1
  32. package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
  33. package/lib/typescript/src/TrueSheet.types.d.ts +14 -0
  34. package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
  35. package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -1
  36. package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +3 -3
  37. package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -1
  38. package/lib/typescript/src/navigation/base-types.d.ts +9 -0
  39. package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
  40. package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +2 -13
  41. package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -1
  42. package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
  43. package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
  44. package/lib/typescript/src/navigation/expo-router/index.d.ts +5 -5
  45. package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -1
  46. package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
  47. package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
  48. package/lib/typescript/src/navigation/index.d.ts +3 -4
  49. package/lib/typescript/src/navigation/index.d.ts.map +1 -1
  50. package/lib/typescript/src/navigation/types.d.ts +34 -4
  51. package/lib/typescript/src/navigation/types.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/src/TrueSheet.tsx +14 -5
  54. package/src/TrueSheet.types.ts +15 -0
  55. package/src/TrueSheet.web.tsx +2 -1
  56. package/src/mocks/navigationExpoRouter.ts +6 -5
  57. package/src/navigation/base-types.ts +20 -0
  58. package/src/navigation/createTrueSheetRouter.ts +5 -33
  59. package/src/navigation/expo-router/base-types.ts +18 -0
  60. package/src/navigation/expo-router/index.ts +20 -19
  61. package/src/navigation/expo-router/types.ts +116 -0
  62. package/src/navigation/index.ts +6 -7
  63. package/src/navigation/types.ts +65 -19
@@ -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
- } from '@react-navigation/core';
11
- import type { NavigatorArgs } from 'standard-navigation';
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
- export type TrueSheetNavigationState<ParamList extends ParamListBase> = Omit<
78
- NavigationState<ParamList>,
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: (NavigationState<ParamList>['routes'][number] & {
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
- export type TrueSheetActionHelpers<ParamList extends ParamListBase> =
120
- StackActionHelpers<ParamList> & {
121
- /**
122
- * Resize the sheet to a specific detent index.
123
- */
124
- resize(index?: number): void;
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,