react-native-screen-transitions 3.0.0-beta.0 → 3.0.0-beta.10

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 (132) hide show
  1. package/lib/commonjs/blank-stack/components/Overlay.js +33 -7
  2. package/lib/commonjs/blank-stack/components/Overlay.js.map +1 -1
  3. package/lib/commonjs/blank-stack/components/Screens.js +3 -3
  4. package/lib/commonjs/blank-stack/components/Screens.js.map +1 -1
  5. package/lib/commonjs/blank-stack/components/StackView.js +49 -40
  6. package/lib/commonjs/blank-stack/components/StackView.js.map +1 -1
  7. package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js +3 -7
  8. package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js.map +1 -1
  9. package/lib/commonjs/blank-stack/index.js +14 -0
  10. package/lib/commonjs/blank-stack/index.js.map +1 -1
  11. package/lib/commonjs/blank-stack/providers/blank-stack-state.js +65 -0
  12. package/lib/commonjs/blank-stack/providers/blank-stack-state.js.map +1 -0
  13. package/lib/commonjs/native-stack/views/NativeStackView.native.js +2 -1
  14. package/lib/commonjs/native-stack/views/NativeStackView.native.js.map +1 -1
  15. package/lib/commonjs/shared/components/controllers/screen-lifecycle.js +20 -6
  16. package/lib/commonjs/shared/components/controllers/screen-lifecycle.js.map +1 -1
  17. package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
  18. package/lib/commonjs/shared/hooks/bounds/use-bound-registry.js +21 -0
  19. package/lib/commonjs/shared/hooks/bounds/use-bound-registry.js.map +1 -1
  20. package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +40 -28
  21. package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
  22. package/lib/commonjs/shared/hooks/use-derived-value-state.js +33 -0
  23. package/lib/commonjs/shared/hooks/use-derived-value-state.js.map +1 -0
  24. package/lib/commonjs/shared/hooks/use-stable-callback-value.js +7 -1
  25. package/lib/commonjs/shared/hooks/use-stable-callback-value.js.map +1 -1
  26. package/lib/commonjs/shared/providers/gestures.js +6 -3
  27. package/lib/commonjs/shared/providers/gestures.js.map +1 -1
  28. package/lib/commonjs/shared/providers/utils/create-provider.js +41 -29
  29. package/lib/commonjs/shared/providers/utils/create-provider.js.map +1 -1
  30. package/lib/commonjs/shared/stores/animation-store.js +12 -3
  31. package/lib/commonjs/shared/stores/animation-store.js.map +1 -1
  32. package/lib/commonjs/shared/stores/bound-store/index.js +12 -1
  33. package/lib/commonjs/shared/stores/bound-store/index.js.map +1 -1
  34. package/lib/commonjs/shared/stores/gesture-store.js +10 -0
  35. package/lib/commonjs/shared/stores/gesture-store.js.map +1 -1
  36. package/lib/module/blank-stack/components/Overlay.js +33 -7
  37. package/lib/module/blank-stack/components/Overlay.js.map +1 -1
  38. package/lib/module/blank-stack/components/Screens.js +3 -3
  39. package/lib/module/blank-stack/components/Screens.js.map +1 -1
  40. package/lib/module/blank-stack/components/StackView.js +48 -40
  41. package/lib/module/blank-stack/components/StackView.js.map +1 -1
  42. package/lib/module/blank-stack/hooks/use-overlay-animation.js +4 -8
  43. package/lib/module/blank-stack/hooks/use-overlay-animation.js.map +1 -1
  44. package/lib/module/blank-stack/index.js +2 -0
  45. package/lib/module/blank-stack/index.js.map +1 -1
  46. package/lib/module/blank-stack/providers/blank-stack-state.js +59 -0
  47. package/lib/module/blank-stack/providers/blank-stack-state.js.map +1 -0
  48. package/lib/module/native-stack/views/NativeStackView.native.js +2 -1
  49. package/lib/module/native-stack/views/NativeStackView.native.js.map +1 -1
  50. package/lib/module/shared/components/controllers/screen-lifecycle.js +20 -6
  51. package/lib/module/shared/components/controllers/screen-lifecycle.js.map +1 -1
  52. package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
  53. package/lib/module/shared/hooks/bounds/use-bound-registry.js +22 -1
  54. package/lib/module/shared/hooks/bounds/use-bound-registry.js.map +1 -1
  55. package/lib/module/shared/hooks/gestures/use-build-gestures.js +42 -30
  56. package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
  57. package/lib/module/shared/hooks/use-derived-value-state.js +30 -0
  58. package/lib/module/shared/hooks/use-derived-value-state.js.map +1 -0
  59. package/lib/module/shared/hooks/use-stable-callback-value.js +8 -2
  60. package/lib/module/shared/hooks/use-stable-callback-value.js.map +1 -1
  61. package/lib/module/shared/providers/gestures.js +6 -3
  62. package/lib/module/shared/providers/gestures.js.map +1 -1
  63. package/lib/module/shared/providers/utils/create-provider.js +40 -27
  64. package/lib/module/shared/providers/utils/create-provider.js.map +1 -1
  65. package/lib/module/shared/stores/animation-store.js +15 -4
  66. package/lib/module/shared/stores/animation-store.js.map +1 -1
  67. package/lib/module/shared/stores/bound-store/index.js +12 -1
  68. package/lib/module/shared/stores/bound-store/index.js.map +1 -1
  69. package/lib/module/shared/stores/gesture-store.js +11 -1
  70. package/lib/module/shared/stores/gesture-store.js.map +1 -1
  71. package/lib/typescript/blank-stack/components/Overlay.d.ts.map +1 -1
  72. package/lib/typescript/blank-stack/components/Screens.d.ts +2 -3
  73. package/lib/typescript/blank-stack/components/Screens.d.ts.map +1 -1
  74. package/lib/typescript/blank-stack/components/StackView.d.ts.map +1 -1
  75. package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts +1 -1
  76. package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts.map +1 -1
  77. package/lib/typescript/blank-stack/index.d.ts +2 -0
  78. package/lib/typescript/blank-stack/index.d.ts.map +1 -1
  79. package/lib/typescript/blank-stack/providers/blank-stack-state.d.ts +13 -0
  80. package/lib/typescript/blank-stack/providers/blank-stack-state.d.ts.map +1 -0
  81. package/lib/typescript/blank-stack/types.d.ts +11 -3
  82. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  83. package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  84. package/lib/typescript/shared/components/controllers/screen-lifecycle.d.ts.map +1 -1
  85. package/lib/typescript/shared/configs/index.d.ts +9 -9
  86. package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
  87. package/lib/typescript/shared/hooks/bounds/use-bound-registry.d.ts.map +1 -1
  88. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts +5 -2
  89. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  90. package/lib/typescript/shared/hooks/use-derived-value-state.d.ts +9 -0
  91. package/lib/typescript/shared/hooks/use-derived-value-state.d.ts.map +1 -0
  92. package/lib/typescript/shared/hooks/use-stable-callback-value.d.ts.map +1 -1
  93. package/lib/typescript/shared/index.d.ts +10 -8
  94. package/lib/typescript/shared/index.d.ts.map +1 -1
  95. package/lib/typescript/shared/providers/gestures.d.ts +4 -2
  96. package/lib/typescript/shared/providers/gestures.d.ts.map +1 -1
  97. package/lib/typescript/shared/providers/utils/create-provider.d.ts +11 -29
  98. package/lib/typescript/shared/providers/utils/create-provider.d.ts.map +1 -1
  99. package/lib/typescript/shared/stores/animation-store.d.ts +4 -2
  100. package/lib/typescript/shared/stores/animation-store.d.ts.map +1 -1
  101. package/lib/typescript/shared/stores/bound-store/index.d.ts +2 -0
  102. package/lib/typescript/shared/stores/bound-store/index.d.ts.map +1 -1
  103. package/lib/typescript/shared/stores/gesture-store.d.ts.map +1 -1
  104. package/package.json +87 -99
  105. package/src/blank-stack/components/Overlay.tsx +40 -5
  106. package/src/blank-stack/components/Screens.tsx +5 -5
  107. package/src/blank-stack/components/StackView.tsx +55 -46
  108. package/src/blank-stack/hooks/use-overlay-animation.tsx +6 -21
  109. package/src/blank-stack/index.ts +2 -0
  110. package/src/blank-stack/providers/blank-stack-state.tsx +90 -0
  111. package/src/blank-stack/types.ts +11 -2
  112. package/src/native-stack/views/NativeStackView.native.tsx +3 -1
  113. package/src/shared/components/controllers/screen-lifecycle.tsx +20 -7
  114. package/src/shared/hooks/animation/use-screen-animation.tsx +1 -1
  115. package/src/shared/hooks/bounds/use-bound-registry.tsx +32 -1
  116. package/src/shared/hooks/gestures/use-build-gestures.tsx +63 -35
  117. package/src/shared/hooks/use-derived-value-state.ts +41 -0
  118. package/src/shared/hooks/use-stable-callback-value.tsx +10 -1
  119. package/src/shared/index.ts +8 -0
  120. package/src/shared/providers/gestures.tsx +17 -8
  121. package/src/shared/providers/utils/create-provider.tsx +77 -0
  122. package/src/shared/stores/animation-store.ts +19 -3
  123. package/src/shared/stores/bound-store/index.ts +23 -0
  124. package/src/shared/stores/gesture-store.ts +15 -1
  125. package/lib/commonjs/shared/stores/navigator-dismiss-state.js +0 -23
  126. package/lib/commonjs/shared/stores/navigator-dismiss-state.js.map +0 -1
  127. package/lib/module/shared/stores/navigator-dismiss-state.js +0 -19
  128. package/lib/module/shared/stores/navigator-dismiss-state.js.map +0 -1
  129. package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts +0 -7
  130. package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts.map +0 -1
  131. package/src/shared/providers/utils/create-provider.ts +0 -64
  132. package/src/shared/stores/navigator-dismiss-state.ts +0 -17
@@ -1,4 +1,8 @@
1
- import { makeMutable, type SharedValue } from "react-native-reanimated";
1
+ import {
2
+ cancelAnimation,
3
+ makeMutable,
4
+ type SharedValue,
5
+ } from "react-native-reanimated";
2
6
  import type { ScreenKey } from "../types/core";
3
7
 
4
8
  export type AnimationStoreMap = {
@@ -22,24 +26,36 @@ const ensure = (key: ScreenKey) => {
22
26
  return bag;
23
27
  };
24
28
 
25
- export function getAnimation(
29
+ function getAnimation(
26
30
  key: ScreenKey,
27
31
  type: "progress" | "closing" | "animating",
28
32
  ): SharedValue<number> {
29
33
  return ensure(key)[type];
30
34
  }
31
35
 
32
- export function getAll(key: ScreenKey) {
36
+ function getAll(key: ScreenKey) {
33
37
  return ensure(key);
34
38
  }
35
39
 
36
40
  function clear(routeKey: ScreenKey) {
37
41
  "worklet";
42
+ const bag = store[routeKey];
43
+ if (bag) {
44
+ cancelAnimation(bag.progress);
45
+ cancelAnimation(bag.closing);
46
+ cancelAnimation(bag.animating);
47
+ }
38
48
  delete store[routeKey];
39
49
  }
40
50
 
51
+ function debugStoreSize() {
52
+ console.log("[AnimationStore] Size:", Object.keys(store).length);
53
+ console.log("[AnimationStore] Keys:", Object.keys(store));
54
+ }
55
+
41
56
  export const AnimationStore = {
42
57
  getAnimation,
43
58
  clear,
44
59
  getAll,
60
+ debugStoreSize,
45
61
  };
@@ -99,6 +99,28 @@ function clear(routeKey: ScreenKey) {
99
99
  });
100
100
  }
101
101
 
102
+ function debugBoundStore() {
103
+ "worklet";
104
+ console.log("[BoundStore] registry keys:", Object.keys(registry.value));
105
+ console.log(
106
+ "[BoundStore] registry size:",
107
+ Object.keys(registry.value).length,
108
+ );
109
+ console.log("[BoundStore] pairCache keys:", Object.keys(pairCache.value));
110
+ console.log(
111
+ "[BoundStore] pairCache size:",
112
+ Object.keys(pairCache.value).length,
113
+ );
114
+ console.log(
115
+ "[BoundStore] lastActiveByRoute keys:",
116
+ Object.keys(lastActiveByRoute.value),
117
+ );
118
+ console.log(
119
+ "[BoundStore] lastActiveByRoute size:",
120
+ Object.keys(lastActiveByRoute.value).length,
121
+ );
122
+ }
123
+
102
124
  function getActiveBound(
103
125
  current: ScreenTransitionState,
104
126
  next: ScreenTransitionState | undefined,
@@ -122,4 +144,5 @@ export const BoundStore = {
122
144
  getRouteActive,
123
145
  clear,
124
146
  getActiveBound,
147
+ debugBoundStore,
125
148
  };
@@ -1,4 +1,8 @@
1
- import { makeMutable, type SharedValue } from "react-native-reanimated";
1
+ import {
2
+ cancelAnimation,
3
+ makeMutable,
4
+ type SharedValue,
5
+ } from "react-native-reanimated";
2
6
  import type { ScreenKey } from "../types/core";
3
7
  import type { GestureDirection } from "../types/gesture";
4
8
 
@@ -50,6 +54,16 @@ function getRouteGestures(routeKey: ScreenKey) {
50
54
  }
51
55
 
52
56
  function clear(routeKey: ScreenKey) {
57
+ const bag = store[routeKey];
58
+ if (bag) {
59
+ cancelAnimation(bag.x);
60
+ cancelAnimation(bag.y);
61
+ cancelAnimation(bag.normalizedX);
62
+ cancelAnimation(bag.normalizedY);
63
+ cancelAnimation(bag.isDismissing);
64
+ cancelAnimation(bag.isDragging);
65
+ cancelAnimation(bag.direction);
66
+ }
53
67
  delete store[routeKey];
54
68
  }
55
69
 
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NavigatorDismissState = void 0;
7
- const map = new Map();
8
- const NavigatorDismissState = exports.NavigatorDismissState = {
9
- get(id) {
10
- if (!id) return false;
11
- return map.get(id) === true;
12
- },
13
- set(id, val) {
14
- map.set(id, !!val);
15
- },
16
- remove(id) {
17
- map.delete(id);
18
- },
19
- clear() {
20
- map.clear();
21
- }
22
- };
23
- //# sourceMappingURL=navigator-dismiss-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["map","Map","NavigatorDismissState","exports","get","id","set","val","remove","delete","clear"],"sourceRoot":"../../../../src","sources":["shared/stores/navigator-dismiss-state.ts"],"mappings":";;;;;;AAAA,MAAMA,GAAG,GAAG,IAAIC,GAAG,CAAkB,CAAC;AAE/B,MAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EACpCE,GAAGA,CAACC,EAAsB,EAAW;IACpC,IAAI,CAACA,EAAE,EAAE,OAAO,KAAK;IACrB,OAAOL,GAAG,CAACI,GAAG,CAACC,EAAE,CAAC,KAAK,IAAI;EAC5B,CAAC;EACDC,GAAGA,CAACD,EAAU,EAAEE,GAAY,EAAE;IAC7BP,GAAG,CAACM,GAAG,CAACD,EAAE,EAAE,CAAC,CAACE,GAAG,CAAC;EACnB,CAAC;EACDC,MAAMA,CAACH,EAAU,EAAE;IAClBL,GAAG,CAACS,MAAM,CAACJ,EAAE,CAAC;EACf,CAAC;EACDK,KAAKA,CAAA,EAAG;IACPV,GAAG,CAACU,KAAK,CAAC,CAAC;EACZ;AACD,CAAC","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- const map = new Map();
4
- export const NavigatorDismissState = {
5
- get(id) {
6
- if (!id) return false;
7
- return map.get(id) === true;
8
- },
9
- set(id, val) {
10
- map.set(id, !!val);
11
- },
12
- remove(id) {
13
- map.delete(id);
14
- },
15
- clear() {
16
- map.clear();
17
- }
18
- };
19
- //# sourceMappingURL=navigator-dismiss-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["map","Map","NavigatorDismissState","get","id","set","val","remove","delete","clear"],"sourceRoot":"../../../../src","sources":["shared/stores/navigator-dismiss-state.ts"],"mappings":";;AAAA,MAAMA,GAAG,GAAG,IAAIC,GAAG,CAAkB,CAAC;AAEtC,OAAO,MAAMC,qBAAqB,GAAG;EACpCC,GAAGA,CAACC,EAAsB,EAAW;IACpC,IAAI,CAACA,EAAE,EAAE,OAAO,KAAK;IACrB,OAAOJ,GAAG,CAACG,GAAG,CAACC,EAAE,CAAC,KAAK,IAAI;EAC5B,CAAC;EACDC,GAAGA,CAACD,EAAU,EAAEE,GAAY,EAAE;IAC7BN,GAAG,CAACK,GAAG,CAACD,EAAE,EAAE,CAAC,CAACE,GAAG,CAAC;EACnB,CAAC;EACDC,MAAMA,CAACH,EAAU,EAAE;IAClBJ,GAAG,CAACQ,MAAM,CAACJ,EAAE,CAAC;EACf,CAAC;EACDK,KAAKA,CAAA,EAAG;IACPT,GAAG,CAACS,KAAK,CAAC,CAAC;EACZ;AACD,CAAC","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- export declare const NavigatorDismissState: {
2
- get(id: string | undefined): boolean;
3
- set(id: string, val: boolean): void;
4
- remove(id: string): void;
5
- clear(): void;
6
- };
7
- //# sourceMappingURL=navigator-dismiss-state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigator-dismiss-state.d.ts","sourceRoot":"","sources":["../../../../src/shared/stores/navigator-dismiss-state.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;YACzB,MAAM,GAAG,SAAS,GAAG,OAAO;YAI5B,MAAM,OAAO,OAAO;eAGjB,MAAM;;CAMjB,CAAC"}
@@ -1,64 +0,0 @@
1
- /**
2
- * Credits to
3
- * https://github.com/heroui-inc/heroui-native/blob/beta/src/helpers/utils/create-context.ts
4
- */
5
- import * as React from "react";
6
-
7
- export interface CreateContextOptions {
8
- /**
9
- * If `true`, React will throw if context is `null` or `undefined`
10
- * In some cases, you might want to support nested context, so you can set it to `false`
11
- */
12
- strict?: boolean;
13
- /**
14
- * Error message to throw if the context is `undefined`
15
- */
16
- errorMessage?: string;
17
- /**
18
- * The display name of the context
19
- */
20
- name?: string;
21
- }
22
-
23
- export type CreateContextReturn<T> = [
24
- React.Provider<T>,
25
- () => T,
26
- React.Context<T>,
27
- ];
28
-
29
- /**
30
- * Creates a named context, provider, and hook.
31
- *
32
- * @param options create context options
33
- */
34
- export function createContext<ContextType>(options: CreateContextOptions = {}) {
35
- const {
36
- strict = true,
37
- errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
38
- name,
39
- } = options;
40
-
41
- const Context = React.createContext<ContextType | undefined>(undefined);
42
-
43
- Context.displayName = name;
44
-
45
- function useContext() {
46
- const context = React.useContext(Context);
47
-
48
- if (!context && strict) {
49
- const error = new Error(errorMessage);
50
-
51
- error.name = "ContextError";
52
- Error.captureStackTrace?.(error, useContext);
53
- throw error;
54
- }
55
-
56
- return context;
57
- }
58
-
59
- return [
60
- Context.Provider,
61
- useContext,
62
- Context,
63
- ] as CreateContextReturn<ContextType>;
64
- }
@@ -1,17 +0,0 @@
1
- const map = new Map<string, boolean>();
2
-
3
- export const NavigatorDismissState = {
4
- get(id: string | undefined): boolean {
5
- if (!id) return false;
6
- return map.get(id) === true;
7
- },
8
- set(id: string, val: boolean) {
9
- map.set(id, !!val);
10
- },
11
- remove(id: string) {
12
- map.delete(id);
13
- },
14
- clear() {
15
- map.clear();
16
- },
17
- };