react-native-screen-transitions 3.0.0-beta.1 → 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 (131) hide show
  1. package/lib/commonjs/blank-stack/components/Overlay.js +19 -5
  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 +1 -5
  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 +19 -5
  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 +2 -6
  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.map +1 -1
  76. package/lib/typescript/blank-stack/index.d.ts +2 -0
  77. package/lib/typescript/blank-stack/index.d.ts.map +1 -1
  78. package/lib/typescript/blank-stack/providers/blank-stack-state.d.ts +13 -0
  79. package/lib/typescript/blank-stack/providers/blank-stack-state.d.ts.map +1 -0
  80. package/lib/typescript/blank-stack/types.d.ts +4 -0
  81. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  82. package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  83. package/lib/typescript/shared/components/controllers/screen-lifecycle.d.ts.map +1 -1
  84. package/lib/typescript/shared/configs/index.d.ts +9 -9
  85. package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
  86. package/lib/typescript/shared/hooks/bounds/use-bound-registry.d.ts.map +1 -1
  87. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts +5 -2
  88. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  89. package/lib/typescript/shared/hooks/use-derived-value-state.d.ts +9 -0
  90. package/lib/typescript/shared/hooks/use-derived-value-state.d.ts.map +1 -0
  91. package/lib/typescript/shared/hooks/use-stable-callback-value.d.ts.map +1 -1
  92. package/lib/typescript/shared/index.d.ts +10 -9
  93. package/lib/typescript/shared/index.d.ts.map +1 -1
  94. package/lib/typescript/shared/providers/gestures.d.ts +4 -2
  95. package/lib/typescript/shared/providers/gestures.d.ts.map +1 -1
  96. package/lib/typescript/shared/providers/utils/create-provider.d.ts +11 -29
  97. package/lib/typescript/shared/providers/utils/create-provider.d.ts.map +1 -1
  98. package/lib/typescript/shared/stores/animation-store.d.ts +4 -2
  99. package/lib/typescript/shared/stores/animation-store.d.ts.map +1 -1
  100. package/lib/typescript/shared/stores/bound-store/index.d.ts +2 -0
  101. package/lib/typescript/shared/stores/bound-store/index.d.ts.map +1 -1
  102. package/lib/typescript/shared/stores/gesture-store.d.ts.map +1 -1
  103. package/package.json +1 -1
  104. package/src/blank-stack/components/Overlay.tsx +24 -4
  105. package/src/blank-stack/components/Screens.tsx +5 -5
  106. package/src/blank-stack/components/StackView.tsx +55 -46
  107. package/src/blank-stack/hooks/use-overlay-animation.tsx +3 -18
  108. package/src/blank-stack/index.ts +2 -0
  109. package/src/blank-stack/providers/blank-stack-state.tsx +90 -0
  110. package/src/blank-stack/types.ts +4 -0
  111. package/src/native-stack/views/NativeStackView.native.tsx +3 -1
  112. package/src/shared/components/controllers/screen-lifecycle.tsx +20 -7
  113. package/src/shared/hooks/animation/use-screen-animation.tsx +1 -1
  114. package/src/shared/hooks/bounds/use-bound-registry.tsx +32 -1
  115. package/src/shared/hooks/gestures/use-build-gestures.tsx +63 -35
  116. package/src/shared/hooks/use-derived-value-state.ts +41 -0
  117. package/src/shared/hooks/use-stable-callback-value.tsx +10 -1
  118. package/src/shared/index.ts +3 -0
  119. package/src/shared/providers/gestures.tsx +17 -8
  120. package/src/shared/providers/utils/create-provider.tsx +77 -0
  121. package/src/shared/stores/animation-store.ts +19 -3
  122. package/src/shared/stores/bound-store/index.ts +23 -0
  123. package/src/shared/stores/gesture-store.ts +15 -1
  124. package/lib/commonjs/shared/stores/navigator-dismiss-state.js +0 -23
  125. package/lib/commonjs/shared/stores/navigator-dismiss-state.js.map +0 -1
  126. package/lib/module/shared/stores/navigator-dismiss-state.js +0 -19
  127. package/lib/module/shared/stores/navigator-dismiss-state.js.map +0 -1
  128. package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts +0 -7
  129. package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts.map +0 -1
  130. package/src/shared/providers/utils/create-provider.ts +0 -64
  131. package/src/shared/stores/navigator-dismiss-state.ts +0 -17
@@ -1,32 +1,14 @@
1
1
  /**
2
- * Credits to
3
- * https://github.com/heroui-inc/heroui-native/blob/beta/src/helpers/utils/create-context.ts
2
+ * THANK YOU @MatiPl01
3
+ * https://github.com/MatiPl01/react-native-sortables/blob/main/packages/react-native-sortables/src/providers/utils/createProvider.tsx
4
+ * SUPER COOL AMAZING UTILITY
4
5
  */
5
- import * as React from "react";
6
- export interface CreateContextOptions {
7
- /**
8
- * If `true`, React will throw if context is `null` or `undefined`
9
- * In some cases, you might want to support nested context, so you can set it to `false`
10
- */
11
- strict?: boolean;
12
- /**
13
- * Error message to throw if the context is `undefined`
14
- */
15
- errorMessage?: string;
16
- /**
17
- * The display name of the context
18
- */
19
- name?: string;
20
- }
21
- export type CreateContextReturn<T> = [
22
- React.Provider<T>,
23
- () => T,
24
- React.Context<T>
25
- ];
26
- /**
27
- * Creates a named context, provider, and hook.
28
- *
29
- * @param options create context options
30
- */
31
- export declare function createContext<ContextType>(options?: CreateContextOptions): CreateContextReturn<ContextType>;
6
+ import { type PropsWithChildren, type ReactNode } from "react";
7
+ export default function createProvider<ProviderName extends string, Guarded extends boolean = true>(name: ProviderName, options?: {
8
+ guarded?: Guarded;
9
+ }): <ProviderProps extends PropsWithChildren<object>, ContextValue>(factory: (props: ProviderProps) => {
10
+ value?: ContextValue;
11
+ enabled?: boolean;
12
+ children?: ReactNode;
13
+ }) => { [P in ProviderName as `${P}Context`]: React.Context<ContextValue>; } & { [P in ProviderName as `${P}Provider`]: React.FC<ProviderProps>; } & { [P in ProviderName as `use${P}Context`]: () => Guarded extends true ? ContextValue : ContextValue | null; };
32
14
  //# sourceMappingURL=create-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../../../../src/shared/providers/utils/create-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACpC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjB,MAAM,CAAC;IACP,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAE,oBAAyB,GA6BvE,mBAAmB,CAAC,WAAW,CAAC,CACrC"}
1
+ {"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../../../../src/shared/providers/utils/create-provider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,SAAS,EAGd,MAAM,OAAO,CAAC;AAEf,MAAM,CAAC,OAAO,UAAU,cAAc,CACrC,YAAY,SAAS,MAAM,EAC3B,OAAO,SAAS,OAAO,GAAG,IAAI,EAC7B,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,IAC5C,aAAa,SAAS,iBAAiB,CAAC,MAAM,CAAC,EAAE,YAAY,EACpE,SAAS,CAAC,KAAK,EAAE,aAAa,KAAK;IAClC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,KA4CI,GACH,CAAC,IAAI,YAAY,IAAI,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,GACjE,GAAG,GACF,CAAC,IAAI,YAAY,IAAI,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,GAC9D,GAAG,GACF,CAAC,IAAI,YAAY,IAAI,MAAM,CAAC,SAAS,GAAG,MAAM,OAAO,SAAS,IAAI,GAChE,YAAY,GACZ,YAAY,GAAG,IAAI,GACtB,CAEF"}
@@ -5,13 +5,15 @@ export type AnimationStoreMap = {
5
5
  closing: SharedValue<number>;
6
6
  animating: SharedValue<number>;
7
7
  };
8
- export declare function getAnimation(key: ScreenKey, type: "progress" | "closing" | "animating"): SharedValue<number>;
9
- export declare function getAll(key: ScreenKey): AnimationStoreMap;
8
+ declare function getAnimation(key: ScreenKey, type: "progress" | "closing" | "animating"): SharedValue<number>;
9
+ declare function getAll(key: ScreenKey): AnimationStoreMap;
10
10
  declare function clear(routeKey: ScreenKey): void;
11
+ declare function debugStoreSize(): void;
11
12
  export declare const AnimationStore: {
12
13
  getAnimation: typeof getAnimation;
13
14
  clear: typeof clear;
14
15
  getAll: typeof getAll;
16
+ debugStoreSize: typeof debugStoreSize;
15
17
  };
16
18
  export {};
17
19
  //# sourceMappingURL=animation-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"animation-store.d.ts","sourceRoot":"","sources":["../../../../src/shared/stores/animation-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC;AAiBF,wBAAgB,YAAY,CAC3B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,GACxC,WAAW,CAAC,MAAM,CAAC,CAErB;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,qBAEpC;AAED,iBAAS,KAAK,CAAC,QAAQ,EAAE,SAAS,QAGjC;AAED,eAAO,MAAM,cAAc;;;;CAI1B,CAAC"}
1
+ {"version":3,"file":"animation-store.d.ts","sourceRoot":"","sources":["../../../../src/shared/stores/animation-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC;AAiBF,iBAAS,YAAY,CACpB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,GACxC,WAAW,CAAC,MAAM,CAAC,CAErB;AAED,iBAAS,MAAM,CAAC,GAAG,EAAE,SAAS,qBAE7B;AAED,iBAAS,KAAK,CAAC,QAAQ,EAAE,SAAS,QASjC;AAED,iBAAS,cAAc,SAGtB;AAED,eAAO,MAAM,cAAc;;;;;CAK1B,CAAC"}
@@ -9,6 +9,7 @@ declare function getBounds(screenId: string): Record<string, {
9
9
  declare function setRouteActive(routeKey: string, boundId: string): void;
10
10
  declare function getRouteActive(routeKey: string): string;
11
11
  declare function clear(routeKey: ScreenKey): void;
12
+ declare function debugBoundStore(): void;
12
13
  declare function getActiveBound(current: ScreenTransitionState, next: ScreenTransitionState | undefined, previous: ScreenTransitionState | undefined): string;
13
14
  export declare const BoundStore: {
14
15
  setBounds: typeof setBounds;
@@ -17,6 +18,7 @@ export declare const BoundStore: {
17
18
  getRouteActive: typeof getRouteActive;
18
19
  clear: typeof clear;
19
20
  getActiveBound: typeof getActiveBound;
21
+ debugBoundStore: typeof debugBoundStore;
20
22
  };
21
23
  export {};
22
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/stores/bound-store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAalD,iBAAS,SAAS,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,kBAAkB,GAAG,IAAW,EACxC,MAAM,GAAE,UAAe,QAYvB;AAED,iBAAS,SAAS,CAAC,QAAQ,EAAE,MAAM;YAzBT,kBAAkB;YAAU,UAAU;GA4B/D;AAED,iBAAS,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAOxD;AAED,iBAAS,cAAc,CAAC,QAAQ,EAAE,MAAM,UAGvC;AAoBD,iBAAS,KAAK,CAAC,QAAQ,EAAE,SAAS,QAyBjC;AAED,iBAAS,cAAc,CACtB,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,qBAAqB,GAAG,SAAS,EACvC,QAAQ,EAAE,qBAAqB,GAAG,SAAS,UAW3C;AAED,eAAO,MAAM,UAAU;;;;;;;CAOtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/stores/bound-store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAalD,iBAAS,SAAS,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,kBAAkB,GAAG,IAAW,EACxC,MAAM,GAAE,UAAe,QAYvB;AAED,iBAAS,SAAS,CAAC,QAAQ,EAAE,MAAM;YAzBT,kBAAkB;YAAU,UAAU;GA4B/D;AAED,iBAAS,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAOxD;AAED,iBAAS,cAAc,CAAC,QAAQ,EAAE,MAAM,UAGvC;AAoBD,iBAAS,KAAK,CAAC,QAAQ,EAAE,SAAS,QAyBjC;AAED,iBAAS,eAAe,SAoBvB;AAED,iBAAS,cAAc,CACtB,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,qBAAqB,GAAG,SAAS,EACvC,QAAQ,EAAE,qBAAqB,GAAG,SAAS,UAW3C;AAED,eAAO,MAAM,UAAU;;;;;;;;CAQtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"gesture-store.d.ts","sourceRoot":"","sources":["../../../../src/shared/stores/gesture-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,UAAU,GACnB,GAAG,GACH,GAAG,GACH,aAAa,GACb,aAAa,GACb,cAAc,GACd,YAAY,CAAC;AAEhB,MAAM,MAAM,eAAe,GAAG;IAC7B,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC;CACvE,CAAC;AAuBF,iBAAS,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,uBAE9D;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,SAAS,mBAE5C;AAED,iBAAS,KAAK,CAAC,QAAQ,EAAE,SAAS,QAEjC;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAC"}
1
+ {"version":3,"file":"gesture-store.d.ts","sourceRoot":"","sources":["../../../../src/shared/stores/gesture-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,UAAU,GACnB,GAAG,GACH,GAAG,GACH,aAAa,GACb,aAAa,GACb,cAAc,GACd,YAAY,CAAC;AAEhB,MAAM,MAAM,eAAe,GAAG;IAC7B,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC;CACvE,CAAC;AAuBF,iBAAS,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,uBAE9D;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,SAAS,mBAE5C;AAED,iBAAS,KAAK,CAAC,QAAQ,EAAE,SAAS,QAYjC;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screen-transitions",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "Easy screen transitions for React Native and Expo",
5
5
  "author": "Ed",
6
6
  "license": "MIT",
@@ -5,6 +5,7 @@ import {
5
5
  import { useMemo } from "react";
6
6
  import { Animated, StyleSheet, View } from "react-native";
7
7
  import { useSafeAreaInsets } from "react-native-safe-area-context";
8
+ import { useScreenAnimation } from "../../shared/hooks/animation/use-screen-animation";
8
9
  import { KeysProvider, useKeys } from "../../shared/providers/keys";
9
10
  import { useOverlayAnimation } from "../hooks/use-overlay-animation";
10
11
  import type {
@@ -13,7 +14,6 @@ import type {
13
14
  BlankStackScene,
14
15
  } from "../types";
15
16
  import { useStackNavigationContext } from "../utils/with-stack-navigation";
16
- import { useScreenAnimation } from "../../shared/hooks/animation/use-screen-animation";
17
17
 
18
18
  type OverlayHostProps = {
19
19
  scene: BlankStackScene;
@@ -43,13 +43,33 @@ const getActiveFloatOverlay = (scenes: BlankStackScene[], index: number) => {
43
43
  return null;
44
44
  };
45
45
 
46
-
47
46
  const OverlayHost = ({ scene, isFloating }: OverlayHostProps) => {
48
47
  const insets = useSafeAreaInsets();
49
48
 
50
49
  const OverlayComponent = scene.descriptor.options.overlay;
51
50
 
52
51
  const { overlayAnimation, optimisticActiveIndex } = useOverlayAnimation();
52
+ const { scenes } = useStackNavigationContext();
53
+
54
+ const overlaySceneIndex = useMemo(() => {
55
+ return scenes.findIndex(
56
+ (stackScene) => stackScene.route.key === scene.route.key,
57
+ );
58
+ }, [scenes, scene.route.key]);
59
+
60
+ const focusedRoute = useMemo(() => {
61
+ if (overlaySceneIndex === -1) {
62
+ return scene.route;
63
+ }
64
+
65
+ const maxOffset = Math.max(scenes.length - overlaySceneIndex - 1, 0);
66
+ const normalizedIndex = Math.min(
67
+ Math.max(optimisticActiveIndex, 0),
68
+ maxOffset,
69
+ );
70
+
71
+ return scenes[overlaySceneIndex + normalizedIndex]?.route ?? scene.route;
72
+ }, [overlaySceneIndex, optimisticActiveIndex, scenes, scene.route]);
53
73
 
54
74
  const screenAnimation = useScreenAnimation();
55
75
 
@@ -59,6 +79,7 @@ const OverlayHost = ({ scene, isFloating }: OverlayHostProps) => {
59
79
 
60
80
  const overlayProps: BlankStackOverlayProps = {
61
81
  route: scene.route,
82
+ focusedRoute,
62
83
  navigation: scene.descriptor.navigation,
63
84
  overlayAnimation,
64
85
  screenAnimation,
@@ -71,7 +92,7 @@ const OverlayHost = ({ scene, isFloating }: OverlayHostProps) => {
71
92
  pointerEvents="box-none"
72
93
  style={[
73
94
  styles.container,
74
- isFloating ? styles.floating : null,
95
+ isFloating ? styles.floating : { zIndex: 1 },
75
96
  styles.absolute,
76
97
  ]}
77
98
  >
@@ -112,7 +133,6 @@ const FloatOverlay = () => {
112
133
  };
113
134
 
114
135
  const ScreenOverlay = () => {
115
- const { focusedIndex } = useStackNavigationContext();
116
136
  const { current } = useKeys<BlankStackDescriptor>();
117
137
 
118
138
  const options = current.options;
@@ -13,7 +13,7 @@ import { AnimationStore } from "../../shared/stores/animation-store";
13
13
  interface ScreenProps {
14
14
  routeKey: string;
15
15
  index: number;
16
- routes: NavigationRoute<ParamListBase, string>[];
16
+ routesLength: number;
17
17
  isPreloaded: boolean;
18
18
  children: React.ReactNode;
19
19
  freezeOnBlur?: boolean;
@@ -32,7 +32,7 @@ const AnimatedScreen = Animated.createAnimatedComponent(RNSScreen);
32
32
  export const Screen = ({
33
33
  routeKey,
34
34
  index,
35
- routes,
35
+ routesLength,
36
36
  isPreloaded,
37
37
  activeScreensLimit,
38
38
  children,
@@ -48,13 +48,13 @@ export const Screen = ({
48
48
  return;
49
49
  }
50
50
 
51
- if (index < routes.length - activeScreensLimit - 1 || isPreloaded) {
51
+ if (index < routesLength - activeScreensLimit - 1 || isPreloaded) {
52
52
  screenActivity.value = STATE_INACTIVE;
53
53
  } else {
54
54
  const outputValue =
55
- index === routes.length - 1
55
+ index === routesLength - 1
56
56
  ? STATE_ON_TOP
57
- : index >= routes.length - activeScreensLimit
57
+ : index >= routesLength - activeScreensLimit
58
58
  ? STATE_TRANSITIONING_OR_BELOW_TOP
59
59
  : STATE_INACTIVE;
60
60
 
@@ -3,9 +3,12 @@ import {
3
3
  NavigationContext,
4
4
  NavigationRouteContext,
5
5
  } from "@react-navigation/native";
6
+ import * as React from "react";
7
+ import { StyleSheet } from "react-native";
6
8
  import { GestureHandlerRootView } from "react-native-gesture-handler";
7
9
  import { ScreenContainer } from "react-native-screens";
8
10
  import { BlankStackScreenLifecycleController } from "../../shared/components/controllers/screen-lifecycle";
11
+ import { BlankStackStateProvider } from "../providers/blank-stack-state";
9
12
  import { ScreenTransitionProvider } from "../../shared/providers/screen-transition-provider";
10
13
  import type { BlankStackDescriptor } from "../types";
11
14
  import { withStackNavigationProvider } from "../utils/with-stack-navigation";
@@ -22,7 +25,7 @@ type SceneViewProps = {
22
25
  sceneIndex: number;
23
26
  };
24
27
 
25
- const SceneView = ({ descriptor }: SceneViewProps) => {
28
+ const SceneView = React.memo(({ descriptor }: SceneViewProps) => {
26
29
  const { route, navigation, render } = descriptor;
27
30
 
28
31
  return (
@@ -33,7 +36,7 @@ const SceneView = ({ descriptor }: SceneViewProps) => {
33
36
  </NavigationRouteContext.Provider>
34
37
  </NavigationContext.Provider>
35
38
  );
36
- };
39
+ });
37
40
 
38
41
  export const StackView = withStackNavigationProvider(
39
42
  ({
@@ -47,56 +50,62 @@ export const StackView = withStackNavigationProvider(
47
50
  return (
48
51
  <GestureHandlerRootView>
49
52
  <SafeAreaProviderCompat>
50
- {shouldShowFloatOverlay ? <Overlay.Float /> : null}
51
- <ScreenContainer style={{ flex: 1 }}>
52
- {scenes.map((scene, sceneIndex) => {
53
- const descriptor = scene.descriptor;
54
- const route = scene.route;
55
- const isFocused = focusedIndex === sceneIndex;
56
- const isBelowFocused = focusedIndex - 1 === sceneIndex;
53
+ <BlankStackStateProvider>
54
+ {shouldShowFloatOverlay ? <Overlay.Float /> : null}
55
+ <ScreenContainer style={styles.container}>
56
+ {scenes.map((scene, sceneIndex) => {
57
+ const descriptor = scene.descriptor;
58
+ const route = scene.route;
59
+ const isFocused = focusedIndex === sceneIndex;
60
+ const isBelowFocused = focusedIndex - 1 === sceneIndex;
57
61
 
58
- const previousDescriptor =
59
- scenes[sceneIndex - 1]?.descriptor ?? undefined;
60
- const nextDescriptor =
61
- scenes[sceneIndex + 1]?.descriptor ?? undefined;
62
+ const previousDescriptor =
63
+ scenes[sceneIndex - 1]?.descriptor ?? undefined;
64
+ const nextDescriptor =
65
+ scenes[sceneIndex + 1]?.descriptor ?? undefined;
62
66
 
63
- const isPreloaded = descriptors[route.key] === undefined;
67
+ const isPreloaded = descriptors[route.key] === undefined;
64
68
 
65
- // On Fabric, when screen is frozen, animated and reanimated values are not updated
66
- // due to component being unmounted. To avoid this, we don't freeze the previous screen there
67
- const shouldFreeze = isFabric()
68
- ? !isPreloaded && !isFocused && !isBelowFocused
69
- : !isPreloaded && !isFocused;
70
- return (
71
- <Screen
72
- key={route.key}
73
- isPreloaded={isPreloaded}
74
- index={sceneIndex}
75
- activeScreensLimit={activeScreensLimit}
76
- routeKey={route.key}
77
- routes={routes}
78
- shouldFreeze={shouldFreeze}
79
- freezeOnBlur={descriptor.options.freezeOnBlur}
80
- >
81
- <ScreenTransitionProvider
82
- previous={previousDescriptor}
83
- current={descriptor}
84
- next={nextDescriptor}
85
- LifecycleController={BlankStackScreenLifecycleController}
69
+ // On Fabric, when screen is frozen, animated and reanimated values are not updated
70
+ // due to component being unmounted. To avoid this, we don't freeze the previous screen there
71
+ const shouldFreeze = isFabric()
72
+ ? !isPreloaded && !isFocused && !isBelowFocused
73
+ : !isPreloaded && !isFocused;
74
+ return (
75
+ <Screen
76
+ key={route.key}
77
+ isPreloaded={isPreloaded}
78
+ index={sceneIndex}
79
+ activeScreensLimit={activeScreensLimit}
80
+ routeKey={route.key}
81
+ routesLength={routes.length}
82
+ shouldFreeze={shouldFreeze}
83
+ freezeOnBlur={descriptor.options.freezeOnBlur}
86
84
  >
87
- <SceneView
88
- key={route.key}
89
- isFocused={isFocused}
90
- sceneIndex={sceneIndex}
91
- descriptor={descriptor}
92
- />
93
- </ScreenTransitionProvider>
94
- </Screen>
95
- );
96
- })}
97
- </ScreenContainer>
85
+ <ScreenTransitionProvider
86
+ previous={previousDescriptor}
87
+ current={descriptor}
88
+ next={nextDescriptor}
89
+ LifecycleController={BlankStackScreenLifecycleController}
90
+ >
91
+ <SceneView
92
+ key={route.key}
93
+ isFocused={isFocused}
94
+ sceneIndex={sceneIndex}
95
+ descriptor={descriptor}
96
+ />
97
+ </ScreenTransitionProvider>
98
+ </Screen>
99
+ );
100
+ })}
101
+ </ScreenContainer>
102
+ </BlankStackStateProvider>
98
103
  </SafeAreaProviderCompat>
99
104
  </GestureHandlerRootView>
100
105
  );
101
106
  },
102
107
  );
108
+
109
+ const styles = StyleSheet.create({
110
+ container: { flex: 1 },
111
+ });
@@ -1,19 +1,10 @@
1
1
  import { useMemo } from "react";
2
2
  import { useWindowDimensions } from "react-native";
3
- import {
4
- type DerivedValue,
5
- type SharedValue,
6
- useDerivedValue,
7
- useSharedValue,
8
- } from "react-native-reanimated";
3
+ import { type DerivedValue, useDerivedValue } from "react-native-reanimated";
9
4
  import { useSafeAreaInsets } from "react-native-safe-area-context";
10
5
  import { useSharedValueState } from "../../shared/hooks/use-shared-value-state";
11
6
  import { useKeys } from "../../shared/providers/keys";
12
- import {
13
- AnimationStore,
14
- type AnimationStoreMap,
15
- } from "../../shared/stores/animation-store";
16
- import { GestureStore } from "../../shared/stores/gesture-store";
7
+ import { AnimationStore } from "../../shared/stores/animation-store";
17
8
  import type { OverlayInterpolationProps } from "../../shared/types/animation";
18
9
  import { useStackNavigationContext } from "../utils/with-stack-navigation";
19
10
 
@@ -27,15 +18,9 @@ export const useOverlayAnimation = (): {
27
18
  optimisticActiveIndex: number;
28
19
  } => {
29
20
  const { current } = useKeys();
30
- const { scenes, focusedIndex } = useStackNavigationContext();
21
+ const { scenes } = useStackNavigationContext();
31
22
  const routeKey = current?.route?.key;
32
23
 
33
- const gestureState = routeKey
34
- ? GestureStore.getRouteGestures(routeKey)
35
- : null;
36
-
37
- const fallbackIsDismissing = useSharedValue(0);
38
-
39
24
  const progressValues = useMemo(() => {
40
25
  if (!routeKey) {
41
26
  return [];
@@ -1,3 +1,4 @@
1
+ export { useOverlayAnimation } from "../blank-stack/hooks/use-overlay-animation";
1
2
  export { createBlankStackNavigator } from "../blank-stack/navigators/createBlankStackNavigator";
2
3
  export type {
3
4
  BlankStackNavigationEventMap,
@@ -8,3 +9,4 @@ export type {
8
9
  BlankStackOverlayProps,
9
10
  BlankStackScreenProps,
10
11
  } from "../blank-stack/types";
12
+ export { useBlankStackState } from "./providers/blank-stack-state";
@@ -0,0 +1,90 @@
1
+ import type { NavigationRoute, ParamListBase } from "@react-navigation/native";
2
+ import { useCallback, useEffect, useMemo, useState } from "react";
3
+ import { useDerivedValue } from "react-native-reanimated";
4
+ import { useSharedValueState } from "../../shared/hooks/use-shared-value-state";
5
+ import createProvider from "../../shared/providers/utils/create-provider";
6
+ import { AnimationStore } from "../../shared/stores/animation-store";
7
+ import { useStackNavigationContext } from "../utils/with-stack-navigation";
8
+
9
+ interface BlankStackStateProviderProps {
10
+ children: React.ReactNode;
11
+ }
12
+
13
+ type BlankStackStateProviderContext = {
14
+ parentIndex: number;
15
+ parentRoutes: NavigationRoute<ParamListBase, string>[];
16
+ index: number;
17
+ routes: NavigationRoute<ParamListBase, string>[];
18
+ };
19
+
20
+ const {
21
+ useBlankStackStateContext: useBlankStackState,
22
+ BlankStackStateProvider,
23
+ } = createProvider("BlankStackState", { guarded: false })<
24
+ BlankStackStateProviderProps,
25
+ BlankStackStateProviderContext
26
+ >(() => {
27
+ const { focusedIndex, routes: stackRoutes } = useStackNavigationContext();
28
+ const [index, setIndex] = useState(0);
29
+ const [routes, setRoutes] = useState<
30
+ NavigationRoute<ParamListBase, string>[]
31
+ >([]);
32
+
33
+ const progressValues = useMemo(
34
+ () => stackRoutes.map((route) => AnimationStore.getAll(route.key)),
35
+ [stackRoutes],
36
+ );
37
+
38
+ const parentIndex = useDerivedValue(() => {
39
+ "worklet";
40
+
41
+ const activeIndex = progressValues.length - 1;
42
+ const isOneDismissing = Number(
43
+ progressValues.some((value) => value.closing.value > 0),
44
+ );
45
+
46
+ const optimisticIndex = activeIndex - isOneDismissing;
47
+
48
+ return optimisticIndex;
49
+ }, [focusedIndex, progressValues]);
50
+
51
+ const parentIndexValue = useSharedValueState(parentIndex);
52
+
53
+ const _registerNested = useCallback(
54
+ (
55
+ nestedIndex: number,
56
+ nestedRoutes: NavigationRoute<ParamListBase, string>[],
57
+ ) => {
58
+ if (nestedIndex !== index) {
59
+ setIndex(nestedIndex);
60
+ }
61
+ if (nestedRoutes.length !== routes.length) {
62
+ setRoutes(nestedRoutes);
63
+ }
64
+ },
65
+ [routes.length, index],
66
+ );
67
+
68
+ const context = useBlankStackState();
69
+
70
+ useEffect(() => {
71
+ //@ts-expect-error Internally used
72
+ if (context?._registerNested) {
73
+ //@ts-expect-error Internally used
74
+ context._registerNested(parentIndexValue, stackRoutes);
75
+ }
76
+ //@ts-expect-error Internally used
77
+ }, [parentIndexValue, context?._registerNested, stackRoutes]);
78
+
79
+ return {
80
+ value: {
81
+ parentIndex: parentIndexValue,
82
+ parentRoutes: stackRoutes,
83
+ index,
84
+ routes,
85
+ _registerNested,
86
+ },
87
+ };
88
+ });
89
+
90
+ export { useBlankStackState, BlankStackStateProvider };
@@ -107,6 +107,10 @@ export type BlankStackOverlayProps = {
107
107
  * Route object for the current screen.
108
108
  */
109
109
  route: Route<string>;
110
+ /**
111
+ * Route object for the currently focused screen in the stack.
112
+ */
113
+ focusedRoute: Route<string>;
110
114
  /**
111
115
  * Navigation prop for the overlay.
112
116
  */
@@ -513,11 +513,13 @@ export function NativeStackView({
513
513
  return acc;
514
514
  }, {});
515
515
 
516
+ const routes = state.routes.concat(state.preloadedRoutes);
517
+
516
518
  return (
517
519
  <GestureHandlerRootView>
518
520
  <SafeAreaProviderCompat>
519
521
  <ScreenStack style={styles.container}>
520
- {state.routes.concat(state.preloadedRoutes).map((route, index) => {
522
+ {routes.map((route, index) => {
521
523
  const descriptor =
522
524
  descriptors[route.key] ?? preloadedDescriptors[route.key];
523
525
  const isFocused = state.index === index;
@@ -4,10 +4,11 @@ import type { BlankStackDescriptor } from "../../../blank-stack/types";
4
4
  import { useStackNavigationContext } from "../../../blank-stack/utils/with-stack-navigation";
5
5
  import type { NativeStackDescriptor } from "../../../native-stack/types";
6
6
  import { useParentGestureRegistry } from "../../hooks/gestures/use-parent-gesture-registry";
7
+ import { useDerivedValueState } from "../../hooks/use-derived-value-state";
7
8
  import useStableCallback from "../../hooks/use-stable-callback";
9
+ import { useGestureContext } from "../../providers/gestures";
8
10
  import { useKeys } from "../../providers/keys";
9
11
  import { AnimationStore } from "../../stores/animation-store";
10
- import { NavigatorDismissState } from "../../stores/navigator-dismiss-state";
11
12
  import { resetStoresForScreen } from "../../stores/utils/reset-stores-for-screen";
12
13
  import { startScreenTransition } from "../../utils/animation/start-screen-transition";
13
14
 
@@ -22,19 +23,22 @@ export const NativeStackScreenLifecycleController = ({
22
23
  children,
23
24
  }: ScreenLifecycleProps) => {
24
25
  const { current } = useKeys<NativeStackDescriptor>();
26
+ const { parentContext } = useGestureContext();
27
+
28
+ const isParentDismissingViaGesture = useDerivedValueState(() => {
29
+ "worklet";
30
+ return parentContext?.gestureAnimationValues.isDismissing?.value ?? false;
31
+ });
25
32
 
26
33
  const animations = AnimationStore.getAll(current.route.key);
27
34
 
28
35
  const handleBeforeRemove = useStableCallback((e: any) => {
29
- const key = current.navigation.getParent()?.getState().key;
30
- const requestedDismissOnNavigator = NavigatorDismissState.get(key);
31
-
32
36
  const isEnabled = current.options.enableTransitions;
33
- const isRequestedDismissOnNavigator = requestedDismissOnNavigator;
37
+
34
38
  const isFirstScreen = current.navigation.getState().index === 0;
35
39
 
36
40
  // If transitions are disabled, or the dismissal was on the local root, or this is the first screen of the stack, reset the stores
37
- if (!isEnabled || isRequestedDismissOnNavigator || isFirstScreen) {
41
+ if (!isEnabled || isParentDismissingViaGesture || isFirstScreen) {
38
42
  resetStoresForScreen(current);
39
43
  return;
40
44
  }
@@ -105,6 +109,10 @@ export const BlankStackScreenLifecycleController = ({
105
109
  });
106
110
  });
107
111
 
112
+ const handleCleanup = useStableCallback(() => {
113
+ resetStoresForScreen(current);
114
+ });
115
+
108
116
  const handleCloseEnd = useStableCallback((finished: boolean) => {
109
117
  if (!finished) {
110
118
  return;
@@ -130,7 +138,12 @@ export const BlankStackScreenLifecycleController = ({
130
138
  },
131
139
  );
132
140
 
133
- useLayoutEffect(handleInitialize);
141
+ useLayoutEffect(() => {
142
+ handleInitialize();
143
+ return () => {
144
+ handleCleanup();
145
+ };
146
+ }, [handleInitialize, handleCleanup]);
134
147
 
135
148
  // important for t.a scrollviews inside nested navigators.
136
149
  useParentGestureRegistry();
@@ -9,6 +9,7 @@ import {
9
9
  NO_BOUNDS_MAP,
10
10
  } from "../../constants";
11
11
  import { type TransitionDescriptor, useKeys } from "../../providers/keys";
12
+
12
13
  import { AnimationStore } from "../../stores/animation-store";
13
14
  import { BoundStore } from "../../stores/bound-store";
14
15
  import { GestureStore, type GestureStoreMap } from "../../stores/gesture-store";
@@ -121,7 +122,6 @@ export function _useScreenAnimation() {
121
122
  focused,
122
123
  activeBoundId,
123
124
  progress,
124
-
125
125
  active,
126
126
  isActiveTransitioning,
127
127
  isDismissing,
@@ -1,4 +1,11 @@
1
- import { createContext, Fragment, useContext, useMemo } from "react";
1
+ import {
2
+ createContext,
3
+ Fragment,
4
+ useContext,
5
+ useLayoutEffect,
6
+ useMemo,
7
+ useRef,
8
+ } from "react";
2
9
  import type { View } from "react-native";
3
10
  import {
4
11
  type AnimatedRef,
@@ -132,6 +139,30 @@ export const useBoundsRegistry = ({
132
139
  );
133
140
  }, [IS_ROOT, sharedBoundTag, ROOT_SIGNAL]);
134
141
 
142
+ const prevNextRef = useRef(next);
143
+ /**
144
+ * Measure non-pressable elements when the screen goes from focused to blurred
145
+ * (or when a new `next` descriptor appears) so we capture final bounds
146
+ * right before the transition starts.
147
+ */
148
+ useLayoutEffect(() => {
149
+ if (!sharedBoundTag || onPress) return;
150
+
151
+ const hadNext = !!prevNextRef.current;
152
+ const hasNext = !!next;
153
+
154
+ if (!hadNext && hasNext) {
155
+ runOnUI(maybeMeasureAndStore)({});
156
+ }
157
+
158
+ prevNextRef.current = next;
159
+ }, [next, sharedBoundTag, onPress, maybeMeasureAndStore]);
160
+
161
+ /**
162
+ * Signal child shared elements (nested under this provider) to refresh their
163
+ * measurements when the root updates, while preventing them from marking
164
+ * themselves active during that sync.
165
+ */
135
166
  useAnimatedReaction(
136
167
  () => ROOT_MEASUREMENT_SIGNAL?.updateSignal.value,
137
168
  (current) => {