@lodev09/react-native-true-sheet 4.0.0-beta.22 → 4.0.0-beta.24

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 (39) hide show
  1. package/README.md +2 -2
  2. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetStackManager.kt +4 -2
  3. package/ios/TrueSheetContentView.mm +3 -2
  4. package/ios/TrueSheetView.mm +9 -0
  5. package/lib/module/TrueSheet.js.map +1 -1
  6. package/lib/module/fabric/TrueSheetFooterViewNativeComponent.ts +2 -3
  7. package/lib/module/fabric/TrueSheetViewNativeComponent.ts +74 -71
  8. package/lib/module/navigation/createTrueSheetRouter.js +114 -91
  9. package/lib/module/navigation/createTrueSheetRouter.js.map +1 -1
  10. package/lib/module/navigation/expo-router/extendTrueSheetRouter.js +43 -0
  11. package/lib/module/navigation/expo-router/extendTrueSheetRouter.js.map +1 -0
  12. package/lib/module/navigation/expo-router/index.js +9 -4
  13. package/lib/module/navigation/expo-router/index.js.map +1 -1
  14. package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
  15. package/lib/typescript/src/TrueSheet.types.d.ts +2 -2
  16. package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
  17. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts +2 -3
  18. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts.map +1 -1
  19. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +65 -66
  20. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
  21. package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +27 -0
  22. package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -1
  23. package/lib/typescript/src/navigation/expo-router/extendTrueSheetRouter.d.ts +29 -0
  24. package/lib/typescript/src/navigation/expo-router/extendTrueSheetRouter.d.ts.map +1 -0
  25. package/lib/typescript/src/navigation/expo-router/index.d.ts +3 -2
  26. package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -1
  27. package/lib/typescript/src/navigation/expo-router/types.d.ts +1 -1
  28. package/lib/typescript/src/navigation/types.d.ts +2 -1
  29. package/lib/typescript/src/navigation/types.d.ts.map +1 -1
  30. package/package.json +5 -4
  31. package/src/TrueSheet.tsx +3 -1
  32. package/src/TrueSheet.types.ts +2 -1
  33. package/src/fabric/TrueSheetFooterViewNativeComponent.ts +2 -3
  34. package/src/fabric/TrueSheetViewNativeComponent.ts +74 -71
  35. package/src/navigation/createTrueSheetRouter.ts +149 -113
  36. package/src/navigation/expo-router/extendTrueSheetRouter.ts +71 -0
  37. package/src/navigation/expo-router/index.ts +14 -6
  38. package/src/navigation/expo-router/types.ts +1 -1
  39. package/src/navigation/types.ts +3 -1
@@ -1,8 +1,10 @@
1
+ import * as ExpoRouter from 'expo-router';
1
2
  import { StackRouter, unstable_integrateWithRouter, useNavigation } from 'expo-router';
2
3
 
3
4
  import { createTrueSheetRouter } from '../createTrueSheetRouter';
4
5
  import { trueSheetNavigator } from '../navigator';
5
6
  import type { ParamListBase } from './base-types';
7
+ import { extendTrueSheetRouter, type ExtendRouter } from './extendTrueSheetRouter';
6
8
  import type {
7
9
  StackRouterFactory,
8
10
  TrueSheetNavigationOptions,
@@ -15,12 +17,18 @@ import type {
15
17
  TrueSheetStandardEventMap,
16
18
  } from './types';
17
19
 
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
- );
20
+ // Expo Router 58+ replaced the React Navigation router contract and ships `extendRouter`
21
+ // for it. Before that, the vendored StackRouter is structurally identical to
22
+ // @react-navigation's. Pinned to this entry's own router types: `createTrueSheetRouter` is
23
+ // shared and typed against React Navigation, which resolves to `any` in apps that only
24
+ // install expo-router.
25
+ const extendRouter = (ExpoRouter as Record<string, unknown>).extendRouter as
26
+ | ExtendRouter
27
+ | undefined;
28
+
29
+ const sheetRouter: TrueSheetRouterFactory = extendRouter
30
+ ? extendTrueSheetRouter(extendRouter, StackRouter as StackRouterFactory)
31
+ : createTrueSheetRouter(StackRouter as StackRouterFactory);
24
32
 
25
33
  // `routes`/`dispatch` are injected by `createProps`, so they are declared as
26
34
  // CreateProps (last generic) and excluded from the public navigator props
@@ -50,7 +50,7 @@ export type TrueSheetRoute = TrueSheetNavigationState<ParamListBase>['routes'][n
50
50
 
51
51
  /**
52
52
  * Props injected into the navigator content by Expo Router's `createProps`.
53
- * Raw routes carry the custom fields (`closing`, `resizeIndex`, `resizeKey`)
53
+ * Raw routes carry the custom fields (`closing`, `dismissing`, `resizeIndex`, `resizeKey`)
54
54
  * that the standard state strips out.
55
55
  */
56
56
  export interface TrueSheetNavigatorContentExtraProps {
@@ -96,6 +96,8 @@ export type TrueSheetStateOf<State extends { routes: readonly unknown[] }> = Omi
96
96
  resizeIndex?: number;
97
97
  resizeKey?: number;
98
98
  closing?: boolean;
99
+ // Stacked above a `closing` route and dismissed natively with it
100
+ dismissing?: boolean;
99
101
  })[];
100
102
  };
101
103
 
@@ -151,7 +153,7 @@ export type TrueSheetEmitFn = NavigatorArgs<
151
153
  /**
152
154
  * Props injected into the navigator content by each adapter
153
155
  * (React Navigation's `mapper` / Expo Router's `createProps`).
154
- * Raw routes carry the custom fields (`closing`, `resizeIndex`, `resizeKey`)
156
+ * Raw routes carry the custom fields (`closing`, `dismissing`, `resizeIndex`, `resizeKey`)
155
157
  * that the standard state strips out.
156
158
  */
157
159
  export interface TrueSheetNavigatorContentExtraProps {