react-native-screen-transitions 2.0.2 → 2.0.4

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 (77) hide show
  1. package/lib/commonjs/utils/bounds/constants.js +3 -3
  2. package/lib/commonjs/utils/bounds/constants.js.map +1 -1
  3. package/lib/commonjs/utils/bounds/get-bounds.js +3 -3
  4. package/lib/commonjs/utils/bounds/get-bounds.js.map +1 -1
  5. package/lib/module/utils/bounds/constants.js +3 -3
  6. package/lib/module/utils/bounds/constants.js.map +1 -1
  7. package/lib/module/utils/bounds/get-bounds.js +3 -3
  8. package/lib/module/utils/bounds/get-bounds.js.map +1 -1
  9. package/lib/typescript/utils/bounds/_types/get-bounds.d.ts +2 -2
  10. package/lib/typescript/utils/bounds/_types/get-bounds.d.ts.map +1 -1
  11. package/lib/typescript/utils/bounds/constants.d.ts +4 -4
  12. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
  13. package/lib/typescript/utils/bounds/get-bounds.d.ts +2 -2
  14. package/lib/typescript/utils/bounds/get-bounds.d.ts.map +1 -1
  15. package/lib/typescript/utils/bounds/index.d.ts +1 -1
  16. package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
  17. package/package.json +4 -2
  18. package/src/__tests__/geometry.test.ts +127 -0
  19. package/src/components/bounds-activator.tsx +29 -0
  20. package/src/components/controllers/screen-lifecycle.tsx +72 -0
  21. package/src/components/create-transition-aware-component.tsx +99 -0
  22. package/src/components/root-transition-aware.tsx +56 -0
  23. package/src/configs/index.ts +2 -0
  24. package/src/configs/presets.ts +227 -0
  25. package/src/configs/specs.ts +9 -0
  26. package/src/hooks/animation/use-associated-style.tsx +28 -0
  27. package/src/hooks/animation/use-screen-animation.tsx +142 -0
  28. package/src/hooks/bounds/use-bound-measurer.tsx +71 -0
  29. package/src/hooks/gestures/use-build-gestures.tsx +369 -0
  30. package/src/hooks/gestures/use-scroll-progress.tsx +60 -0
  31. package/src/hooks/use-stable-callback.tsx +15 -0
  32. package/src/index.ts +32 -0
  33. package/src/integrations/native-stack/navigators/createNativeStackNavigator.tsx +112 -0
  34. package/src/integrations/native-stack/utils/debounce.tsx +14 -0
  35. package/src/integrations/native-stack/utils/getModalRoutesKeys.ts +21 -0
  36. package/src/integrations/native-stack/utils/useAnimatedHeaderHeight.tsx +18 -0
  37. package/src/integrations/native-stack/utils/useDismissedRouteError.tsx +30 -0
  38. package/src/integrations/native-stack/utils/useInvalidPreventRemoveError.tsx +31 -0
  39. package/src/integrations/native-stack/views/FontProcessor.native.tsx +12 -0
  40. package/src/integrations/native-stack/views/FontProcessor.tsx +5 -0
  41. package/src/integrations/native-stack/views/FooterComponent.tsx +10 -0
  42. package/src/integrations/native-stack/views/NativeStackView.native.tsx +657 -0
  43. package/src/integrations/native-stack/views/NativeStackView.tsx +214 -0
  44. package/src/integrations/native-stack/views/useHeaderConfigProps.tsx +295 -0
  45. package/src/providers/gestures.tsx +89 -0
  46. package/src/providers/keys.tsx +38 -0
  47. package/src/stores/animations.ts +45 -0
  48. package/src/stores/bounds.ts +71 -0
  49. package/src/stores/gestures.ts +55 -0
  50. package/src/stores/navigator-dismiss-state.ts +17 -0
  51. package/src/stores/utils/reset-stores-for-screen.ts +14 -0
  52. package/src/types/animation.ts +76 -0
  53. package/src/types/bounds.ts +82 -0
  54. package/src/types/core.ts +50 -0
  55. package/src/types/gesture.ts +33 -0
  56. package/src/types/navigator.ts +744 -0
  57. package/src/types/utils.ts +3 -0
  58. package/src/utils/animation/animate.ts +28 -0
  59. package/src/utils/animation/run-transition.ts +49 -0
  60. package/src/utils/bounds/_types/builder.ts +35 -0
  61. package/src/utils/bounds/_types/geometry.ts +17 -0
  62. package/src/utils/bounds/_types/get-bounds.ts +10 -0
  63. package/src/utils/bounds/build-bound-styles.ts +184 -0
  64. package/src/utils/bounds/constants.ts +25 -0
  65. package/src/utils/bounds/flatten-styles.ts +21 -0
  66. package/src/utils/bounds/geometry.ts +113 -0
  67. package/src/utils/bounds/get-bounds.ts +56 -0
  68. package/src/utils/bounds/index.ts +46 -0
  69. package/src/utils/bounds/style-composers.ts +172 -0
  70. package/src/utils/gesture/apply-gesture-activation-criteria.ts +109 -0
  71. package/src/utils/gesture/map-gesture-to-progress.ts +11 -0
  72. package/src/utils/gesture/normalize-gesture-translation.ts +20 -0
  73. package/src/utils/index.ts +1 -0
  74. package/lib/commonjs/__tests__ /geometry.test.js +0 -178
  75. package/lib/commonjs/__tests__ /geometry.test.js.map +0 -1
  76. package/lib/module/__tests__ /geometry.test.js +0 -178
  77. package/lib/module/__tests__ /geometry.test.js.map +0 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.FULLSCREEN_DIMENSIONS = exports.DEFAULT_BUILDER_OPTIONS = void 0;
7
7
  const FULLSCREEN_DIMENSIONS = dimensions => {
8
- "worklet";
8
+ 'worklet';
9
9
 
10
10
  return {
11
11
  x: 0,
@@ -25,7 +25,7 @@ const DEFAULT_BUILDER_OPTIONS = exports.DEFAULT_BUILDER_OPTIONS = Object.freeze(
25
25
  toFullscreen: false,
26
26
  absolute: false,
27
27
  relative: true,
28
- method: "transform",
29
- contentScaleMode: "auto"
28
+ method: 'transform',
29
+ contentScaleMode: 'auto'
30
30
  });
31
31
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FULLSCREEN_DIMENSIONS","dimensions","x","y","pageX","pageY","width","height","exports","DEFAULT_BUILDER_OPTIONS","Object","freeze","gestures","toFullscreen","absolute","relative","method","contentScaleMode"],"sourceRoot":"../../../../src","sources":["utils/bounds/constants.ts"],"mappings":";;;;;;AAKO,MAAMA,qBAAqB,GACjCC,UAAsB,IACE;EACxB,SAAS;;EACT,OAAO;IACNC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAEL,UAAU,CAACK,KAAK;IACvBC,MAAM,EAAEN,UAAU,CAACM;EACpB,CAAC;AACF,CAAC;AAACC,OAAA,CAAAR,qBAAA,GAAAA,qBAAA;AAEK,MAAMS,uBAAuD,GAAAD,OAAA,CAAAC,uBAAA,GACnEC,MAAM,CAACC,MAAM,CAAC;EACbC,QAAQ,EAAE;IAAEV,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC;EACxBU,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAE,WAAW;EACnBC,gBAAgB,EAAE;AACnB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["FULLSCREEN_DIMENSIONS","dimensions","x","y","pageX","pageY","width","height","exports","DEFAULT_BUILDER_OPTIONS","Object","freeze","gestures","toFullscreen","absolute","relative","method","contentScaleMode"],"sourceRoot":"../../../../src","sources":["utils/bounds/constants.ts"],"mappings":";;;;;;AAKO,MAAMA,qBAAqB,GAAIC,UAAsB,IAAyB;EACnF,SAAS;;EACT,OAAO;IACLC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAEL,UAAU,CAACK,KAAK;IACvBC,MAAM,EAAEN,UAAU,CAACM;EACrB,CAAC;AACH,CAAC;AAACC,OAAA,CAAAR,qBAAA,GAAAA,qBAAA;AAEK,MAAMS,uBAAuD,GAAAD,OAAA,CAAAC,uBAAA,GAAGC,MAAM,CAACC,MAAM,CAAC;EACnFC,QAAQ,EAAE;IAAEV,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC;EACxBU,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAE,WAAW;EACnBC,gBAAgB,EAAE;AACpB,CAAC,CAAC","ignoreList":[]}
@@ -16,15 +16,15 @@ const fallbackBounds = {
16
16
  styles: {}
17
17
  };
18
18
  const getBounds = props => {
19
- "worklet";
19
+ 'worklet';
20
20
 
21
21
  const boundId = props.id;
22
22
  const phase = props.phase;
23
23
  if (phase && boundId) {
24
24
  let phaseBounds = null;
25
- if (phase === "current") {
25
+ if (phase === 'current') {
26
26
  phaseBounds = props.current?.bounds[boundId];
27
- } else if (phase === "next") {
27
+ } else if (phase === 'next') {
28
28
  phaseBounds = props.next?.bounds[boundId];
29
29
  } else {
30
30
  phaseBounds = props.previous?.bounds[boundId];
@@ -1 +1 @@
1
- {"version":3,"names":["fallbackBounds","bounds","width","height","x","y","pageX","pageY","styles","getBounds","props","boundId","id","phase","phaseBounds","current","next","previous","previousBounds","nextBounds","exports"],"sourceRoot":"../../../../src","sources":["utils/bounds/get-bounds.ts"],"mappings":";;;;;;AAIA,MAAMA,cAAc,GAAG;EACtBC,MAAM,EAAE;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE;EACR,CAAC;EACDC,MAAM,EAAE,CAAC;AACV,CAAC;AAEM,MAAMC,SAAS,GAAIC,KAAsB,IAAiB;EAChE,SAAS;;EACT,MAAMC,OAAO,GAAGD,KAAK,CAACE,EAAE;EACxB,MAAMC,KAAK,GAAGH,KAAK,CAACG,KAAK;EAEzB,IAAIA,KAAK,IAAIF,OAAO,EAAE;IACrB,IAAIG,WAAW,GAAG,IAAI;IAEtB,IAAID,KAAK,KAAK,SAAS,EAAE;MACxBC,WAAW,GAAGJ,KAAK,CAACK,OAAO,EAAEd,MAAM,CAACU,OAAO,CAAC;IAC7C,CAAC,MAAM,IAAIE,KAAK,KAAK,MAAM,EAAE;MAC5BC,WAAW,GAAGJ,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAC1C,CAAC,MAAM;MACNG,WAAW,GAAGJ,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAC9C;IAEA,IAAI,CAACG,WAAW,EAAE;MACjB,OAAOd,cAAc;IACtB;IAEA,OAAO;MACNC,MAAM,EAAEa,WAAW,CAACb,MAAM;MAC1BO,MAAM,EAAEM,WAAW,EAAEN;IACtB,CAAC;EACF;EAEA,IAAI,CAACE,KAAK,CAACM,IAAI,IAAIL,OAAO,EAAE;IAC3B,MAAMO,cAAc,GAAGR,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAEtD,OAAOO,cAAc,IAAIlB,cAAc;EACxC;EAEA,IAAIW,OAAO,EAAE;IACZ,MAAMQ,UAAU,GAAGT,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAE9C,OAAOQ,UAAU,IAAInB,cAAc;EACpC;EAEA,OAAOA,cAAc;AACtB,CAAC;AAACoB,OAAA,CAAAX,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["fallbackBounds","bounds","width","height","x","y","pageX","pageY","styles","getBounds","props","boundId","id","phase","phaseBounds","current","next","previous","previousBounds","nextBounds","exports"],"sourceRoot":"../../../../src","sources":["utils/bounds/get-bounds.ts"],"mappings":";;;;;;AAIA,MAAMA,cAAc,GAAG;EACrBC,MAAM,EAAE;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE,CAAC;AACX,CAAC;AAEM,MAAMC,SAAS,GAAIC,KAAsB,IAAiB;EAC/D,SAAS;;EACT,MAAMC,OAAO,GAAGD,KAAK,CAACE,EAAE;EACxB,MAAMC,KAAK,GAAGH,KAAK,CAACG,KAAK;EAEzB,IAAIA,KAAK,IAAIF,OAAO,EAAE;IACpB,IAAIG,WAAW,GAAG,IAAI;IAEtB,IAAID,KAAK,KAAK,SAAS,EAAE;MACvBC,WAAW,GAAGJ,KAAK,CAACK,OAAO,EAAEd,MAAM,CAACU,OAAO,CAAC;IAC9C,CAAC,MAAM,IAAIE,KAAK,KAAK,MAAM,EAAE;MAC3BC,WAAW,GAAGJ,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAC3C,CAAC,MAAM;MACLG,WAAW,GAAGJ,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAC/C;IAEA,IAAI,CAACG,WAAW,EAAE;MAChB,OAAOd,cAAc;IACvB;IAEA,OAAO;MACLC,MAAM,EAAEa,WAAW,CAACb,MAAM;MAC1BO,MAAM,EAAEM,WAAW,EAAEN;IACvB,CAAC;EACH;EAEA,IAAI,CAACE,KAAK,CAACM,IAAI,IAAIL,OAAO,EAAE;IAC1B,MAAMO,cAAc,GAAGR,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAEtD,OAAOO,cAAc,IAAIlB,cAAc;EACzC;EAEA,IAAIW,OAAO,EAAE;IACX,MAAMQ,UAAU,GAAGT,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAE9C,OAAOQ,UAAU,IAAInB,cAAc;EACrC;EAEA,OAAOA,cAAc;AACvB,CAAC;AAACoB,OAAA,CAAAX,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  export const FULLSCREEN_DIMENSIONS = dimensions => {
4
- "worklet";
4
+ 'worklet';
5
5
 
6
6
  return {
7
7
  x: 0,
@@ -20,7 +20,7 @@ export const DEFAULT_BUILDER_OPTIONS = Object.freeze({
20
20
  toFullscreen: false,
21
21
  absolute: false,
22
22
  relative: true,
23
- method: "transform",
24
- contentScaleMode: "auto"
23
+ method: 'transform',
24
+ contentScaleMode: 'auto'
25
25
  });
26
26
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FULLSCREEN_DIMENSIONS","dimensions","x","y","pageX","pageY","width","height","DEFAULT_BUILDER_OPTIONS","Object","freeze","gestures","toFullscreen","absolute","relative","method","contentScaleMode"],"sourceRoot":"../../../../src","sources":["utils/bounds/constants.ts"],"mappings":";;AAKA,OAAO,MAAMA,qBAAqB,GACjCC,UAAsB,IACE;EACxB,SAAS;;EACT,OAAO;IACNC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAEL,UAAU,CAACK,KAAK;IACvBC,MAAM,EAAEN,UAAU,CAACM;EACpB,CAAC;AACF,CAAC;AAED,OAAO,MAAMC,uBAAuD,GACnEC,MAAM,CAACC,MAAM,CAAC;EACbC,QAAQ,EAAE;IAAET,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC;EACxBS,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAE,WAAW;EACnBC,gBAAgB,EAAE;AACnB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["FULLSCREEN_DIMENSIONS","dimensions","x","y","pageX","pageY","width","height","DEFAULT_BUILDER_OPTIONS","Object","freeze","gestures","toFullscreen","absolute","relative","method","contentScaleMode"],"sourceRoot":"../../../../src","sources":["utils/bounds/constants.ts"],"mappings":";;AAKA,OAAO,MAAMA,qBAAqB,GAAIC,UAAsB,IAAyB;EACnF,SAAS;;EACT,OAAO;IACLC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAEL,UAAU,CAACK,KAAK;IACvBC,MAAM,EAAEN,UAAU,CAACM;EACrB,CAAC;AACH,CAAC;AAED,OAAO,MAAMC,uBAAuD,GAAGC,MAAM,CAACC,MAAM,CAAC;EACnFC,QAAQ,EAAE;IAAET,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC;EACxBS,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAE,WAAW;EACnBC,gBAAgB,EAAE;AACpB,CAAC,CAAC","ignoreList":[]}
@@ -12,15 +12,15 @@ const fallbackBounds = {
12
12
  styles: {}
13
13
  };
14
14
  export const getBounds = props => {
15
- "worklet";
15
+ 'worklet';
16
16
 
17
17
  const boundId = props.id;
18
18
  const phase = props.phase;
19
19
  if (phase && boundId) {
20
20
  let phaseBounds = null;
21
- if (phase === "current") {
21
+ if (phase === 'current') {
22
22
  phaseBounds = props.current?.bounds[boundId];
23
- } else if (phase === "next") {
23
+ } else if (phase === 'next') {
24
24
  phaseBounds = props.next?.bounds[boundId];
25
25
  } else {
26
26
  phaseBounds = props.previous?.bounds[boundId];
@@ -1 +1 @@
1
- {"version":3,"names":["fallbackBounds","bounds","width","height","x","y","pageX","pageY","styles","getBounds","props","boundId","id","phase","phaseBounds","current","next","previous","previousBounds","nextBounds"],"sourceRoot":"../../../../src","sources":["utils/bounds/get-bounds.ts"],"mappings":";;AAIA,MAAMA,cAAc,GAAG;EACtBC,MAAM,EAAE;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE;EACR,CAAC;EACDC,MAAM,EAAE,CAAC;AACV,CAAC;AAED,OAAO,MAAMC,SAAS,GAAIC,KAAsB,IAAiB;EAChE,SAAS;;EACT,MAAMC,OAAO,GAAGD,KAAK,CAACE,EAAE;EACxB,MAAMC,KAAK,GAAGH,KAAK,CAACG,KAAK;EAEzB,IAAIA,KAAK,IAAIF,OAAO,EAAE;IACrB,IAAIG,WAAW,GAAG,IAAI;IAEtB,IAAID,KAAK,KAAK,SAAS,EAAE;MACxBC,WAAW,GAAGJ,KAAK,CAACK,OAAO,EAAEd,MAAM,CAACU,OAAO,CAAC;IAC7C,CAAC,MAAM,IAAIE,KAAK,KAAK,MAAM,EAAE;MAC5BC,WAAW,GAAGJ,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAC1C,CAAC,MAAM;MACNG,WAAW,GAAGJ,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAC9C;IAEA,IAAI,CAACG,WAAW,EAAE;MACjB,OAAOd,cAAc;IACtB;IAEA,OAAO;MACNC,MAAM,EAAEa,WAAW,CAACb,MAAM;MAC1BO,MAAM,EAAEM,WAAW,EAAEN;IACtB,CAAC;EACF;EAEA,IAAI,CAACE,KAAK,CAACM,IAAI,IAAIL,OAAO,EAAE;IAC3B,MAAMO,cAAc,GAAGR,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAEtD,OAAOO,cAAc,IAAIlB,cAAc;EACxC;EAEA,IAAIW,OAAO,EAAE;IACZ,MAAMQ,UAAU,GAAGT,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAE9C,OAAOQ,UAAU,IAAInB,cAAc;EACpC;EAEA,OAAOA,cAAc;AACtB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["fallbackBounds","bounds","width","height","x","y","pageX","pageY","styles","getBounds","props","boundId","id","phase","phaseBounds","current","next","previous","previousBounds","nextBounds"],"sourceRoot":"../../../../src","sources":["utils/bounds/get-bounds.ts"],"mappings":";;AAIA,MAAMA,cAAc,GAAG;EACrBC,MAAM,EAAE;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE,CAAC;AACX,CAAC;AAED,OAAO,MAAMC,SAAS,GAAIC,KAAsB,IAAiB;EAC/D,SAAS;;EACT,MAAMC,OAAO,GAAGD,KAAK,CAACE,EAAE;EACxB,MAAMC,KAAK,GAAGH,KAAK,CAACG,KAAK;EAEzB,IAAIA,KAAK,IAAIF,OAAO,EAAE;IACpB,IAAIG,WAAW,GAAG,IAAI;IAEtB,IAAID,KAAK,KAAK,SAAS,EAAE;MACvBC,WAAW,GAAGJ,KAAK,CAACK,OAAO,EAAEd,MAAM,CAACU,OAAO,CAAC;IAC9C,CAAC,MAAM,IAAIE,KAAK,KAAK,MAAM,EAAE;MAC3BC,WAAW,GAAGJ,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAC3C,CAAC,MAAM;MACLG,WAAW,GAAGJ,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAC/C;IAEA,IAAI,CAACG,WAAW,EAAE;MAChB,OAAOd,cAAc;IACvB;IAEA,OAAO;MACLC,MAAM,EAAEa,WAAW,CAACb,MAAM;MAC1BO,MAAM,EAAEM,WAAW,EAAEN;IACvB,CAAC;EACH;EAEA,IAAI,CAACE,KAAK,CAACM,IAAI,IAAIL,OAAO,EAAE;IAC1B,MAAMO,cAAc,GAAGR,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAEtD,OAAOO,cAAc,IAAIlB,cAAc;EACzC;EAEA,IAAIW,OAAO,EAAE;IACX,MAAMQ,UAAU,GAAGT,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAE9C,OAAOQ,UAAU,IAAInB,cAAc;EACrC;EAEA,OAAOA,cAAc;AACvB,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { ScreenPhase } from "src/types/core";
2
- import type { ScreenTransitionState } from "../../../types/animation";
1
+ import type { ScreenPhase } from '../../../types/core';
2
+ import type { ScreenTransitionState } from '../../../types/animation';
3
3
  export type GetBoundsParams = {
4
4
  id: string | null;
5
5
  phase?: ScreenPhase;
@@ -1 +1 @@
1
- {"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_types/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC7B,CAAC"}
1
+ {"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_types/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B,CAAC"}
@@ -1,7 +1,7 @@
1
- import type { ScaledSize } from "react-native";
2
- import type { MeasuredDimensions } from "react-native-reanimated";
3
- import type { Complete } from "src/types/utils";
4
- import type { BoundsBuilderOptions } from "./_types/builder";
1
+ import type { ScaledSize } from 'react-native';
2
+ import type { MeasuredDimensions } from 'react-native-reanimated';
3
+ import type { Complete } from '../../types/utils';
4
+ import type { BoundsBuilderOptions } from './_types/builder';
5
5
  export declare const FULLSCREEN_DIMENSIONS: (dimensions: ScaledSize) => MeasuredDimensions;
6
6
  export declare const DEFAULT_BUILDER_OPTIONS: Complete<BoundsBuilderOptions>;
7
7
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,GACjC,YAAY,UAAU,KACpB,kBAUF,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,oBAAoB,CAQhE,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,GAAI,YAAY,UAAU,KAAG,kBAU9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,oBAAoB,CAOjE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { BoundEntry } from "src/types/bounds";
2
- import type { GetBoundsParams } from "./_types/get-bounds";
1
+ import type { BoundEntry } from '../../types/bounds';
2
+ import type { GetBoundsParams } from './_types/get-bounds';
3
3
  export declare const getBounds: (props: GetBoundsParams) => BoundEntry;
4
4
  //# sourceMappingURL=get-bounds.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAc3D,eAAO,MAAM,SAAS,GAAI,OAAO,eAAe,KAAG,UAuClD,CAAC"}
1
+ {"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAc3D,eAAO,MAAM,SAAS,GAAI,OAAO,eAAe,KAAG,UAuClD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ScaledSize } from "react-native";
2
- import type { ScreenPhase } from "src/types/core";
2
+ import type { ScreenPhase } from "../../types/core";
3
3
  import type { ScreenTransitionState } from "../../types/animation";
4
4
  export interface BuildBoundsAccessorParams {
5
5
  activeBoundId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAInE,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,mEAOjC,yBAAyB,YAGN,MAAM;eAWf,MAAM,UAAU,WAAW;CASvC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAInE,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,mEAOjC,yBAAyB,YAGN,MAAM;eAWf,MAAM,UAAU,WAAW;CASvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screen-transitions",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Easy screen transitions for React Native and Expo",
5
5
  "author": "Ed",
6
6
  "license": "MIT",
@@ -12,6 +12,7 @@
12
12
  "main": "lib/commonjs/index.js",
13
13
  "module": "lib/module/index.js",
14
14
  "types": "lib/typescript/index.d.ts",
15
+ "react-native": "src/index",
15
16
  "scripts": {
16
17
  "build": "bob build",
17
18
  "lint": "biome check ./src",
@@ -27,6 +28,7 @@
27
28
  ],
28
29
  "files": [
29
30
  "lib",
31
+ "src",
30
32
  "README.md",
31
33
  "LICENSE"
32
34
  ],
@@ -64,5 +66,5 @@
64
66
  ]
65
67
  ]
66
68
  },
67
- "gitHead": "3f7cb6a77b24a99123fd4cb1277f152aa365e792"
69
+ "gitHead": "38f75fc51e610d78d165d5fc78b94f71a1db0efe"
68
70
  }
@@ -0,0 +1,127 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import {
3
+ computeContentTransformGeometry,
4
+ computeRelativeGeometry,
5
+ } from "../utils/bounds/geometry";
6
+
7
+ describe("computeRelativeGeometry", () => {
8
+ it("calculates correct relative geometry when entering", () => {
9
+ const start = {
10
+ x: 10,
11
+ y: 20,
12
+ pageX: 10,
13
+ pageY: 20,
14
+ width: 100,
15
+ height: 200,
16
+ };
17
+ const end = {
18
+ x: 50,
19
+ y: 100,
20
+ pageX: 50,
21
+ pageY: 100,
22
+ width: 200,
23
+ height: 400,
24
+ };
25
+
26
+ const result = computeRelativeGeometry({ start, end, entering: true });
27
+
28
+ expect(result.dx).toBe(-90); // center diff X
29
+ expect(result.dy).toBe(-180); // center diff Y
30
+ expect(result.scaleX).toBe(0.5); // width ratio
31
+ expect(result.scaleY).toBe(0.5); // height ratio
32
+ expect(result.ranges).toEqual([0, 1]);
33
+ expect(result.entering).toBe(true);
34
+ });
35
+
36
+ it("calculates correct relative geometry when exiting", () => {
37
+ const start = { x: 0, y: 0, pageX: 10, pageY: 20, width: 100, height: 200 };
38
+ const end = { x: 0, y: 0, pageX: 50, pageY: 100, width: 200, height: 400 };
39
+
40
+ const result = computeRelativeGeometry({ start, end, entering: false });
41
+
42
+ expect(result.ranges).toEqual([1, 2]);
43
+ expect(result.entering).toBe(false);
44
+ });
45
+ });
46
+
47
+ describe("computeContentTransformGeometry", () => {
48
+ const dimensions = { width: 375, height: 812, scale: 1, fontScale: 1 };
49
+
50
+ it("calculates transform with aspectFit mode", () => {
51
+ const start = {
52
+ x: 0,
53
+ y: 0,
54
+ pageX: 50,
55
+ pageY: 100,
56
+ width: 100,
57
+ height: 100,
58
+ };
59
+ const end = { x: 0, y: 0, pageX: 100, pageY: 200, width: 200, height: 50 };
60
+
61
+ const result = computeContentTransformGeometry({
62
+ start,
63
+ end,
64
+ entering: true,
65
+ dimensions,
66
+ contentScaleMode: "aspectFit",
67
+ });
68
+
69
+ expect(result.s).toBe(0.5);
70
+ expect(result.entering).toBe(true);
71
+ expect(result.ranges).toEqual([0, 1]);
72
+ });
73
+
74
+ it("calculates transform with aspectFill mode", () => {
75
+ const start = {
76
+ x: 0,
77
+ y: 0,
78
+ pageX: 50,
79
+ pageY: 100,
80
+ width: 100,
81
+ height: 100,
82
+ };
83
+ const end = { x: 0, y: 0, pageX: 100, pageY: 200, width: 200, height: 50 };
84
+
85
+ const result = computeContentTransformGeometry({
86
+ start,
87
+ end,
88
+ entering: true,
89
+ dimensions,
90
+ contentScaleMode: "aspectFill",
91
+ });
92
+
93
+ expect(result.s).toBe(2);
94
+ });
95
+
96
+ it("handles auto mode based on aspect ratio difference", () => {
97
+ const start = { x: 0, y: 0, pageX: 0, pageY: 0, width: 100, height: 100 };
98
+ const end = { x: 0, y: 0, pageX: 0, pageY: 0, width: 200, height: 195 };
99
+
100
+ const result = computeContentTransformGeometry({
101
+ start,
102
+ end,
103
+ entering: true,
104
+ dimensions,
105
+ contentScaleMode: "auto",
106
+ });
107
+
108
+ expect(result.s).toBeCloseTo(0.512, 2);
109
+ });
110
+
111
+ it("handles zero dimensions safely", () => {
112
+ const start = { x: 0, y: 0, pageX: 0, pageY: 0, width: 0, height: 100 };
113
+ const end = { x: 0, y: 0, pageX: 0, pageY: 0, width: 200, height: 200 };
114
+
115
+ // Should not throw and use safe fallback
116
+ const result = computeContentTransformGeometry({
117
+ start,
118
+ end,
119
+ entering: true,
120
+ dimensions,
121
+ contentScaleMode: "aspectFit",
122
+ });
123
+
124
+ expect(result.s).toBeDefined();
125
+ expect(Number.isFinite(result.s)).toBe(true);
126
+ });
127
+ });
@@ -0,0 +1,29 @@
1
+ import { useMemo } from "react";
2
+ import { Gesture, GestureDetector } from "react-native-gesture-handler";
3
+ import { Bounds } from "../stores/bounds";
4
+
5
+ interface BoundActivatorProps {
6
+ sharedBoundTag?: string;
7
+ children: React.ReactNode;
8
+ measure: () => void;
9
+ }
10
+
11
+ export const BoundActivator = ({
12
+ sharedBoundTag,
13
+ children,
14
+ measure,
15
+ }: BoundActivatorProps) => {
16
+ const tapGesture = useMemo(() => {
17
+ return Gesture.Tap().onStart(() => {
18
+ "worklet";
19
+ if (sharedBoundTag) {
20
+ Bounds.setActiveBoundId(sharedBoundTag);
21
+ measure();
22
+ }
23
+ });
24
+ }, [sharedBoundTag, measure]);
25
+
26
+ if (!sharedBoundTag) return children;
27
+
28
+ return <GestureDetector gesture={tapGesture}>{children}</GestureDetector>;
29
+ };
@@ -0,0 +1,72 @@
1
+ import { useEffect, useLayoutEffect } from "react";
2
+ import useStableCallback from "../../hooks/use-stable-callback";
3
+ import { useKeys } from "../../providers/keys";
4
+ import { Animations } from "../../stores/animations";
5
+ import { NavigatorDismissState } from "../../stores/navigator-dismiss-state";
6
+ import { resetStoresForScreen } from "../../stores/utils/reset-stores-for-screen";
7
+ import { runTransition } from "../../utils/animation/run-transition";
8
+
9
+ interface ScreenLifecycleProps {
10
+ children: React.ReactNode;
11
+ }
12
+
13
+ export const ScreenLifecycleController = ({
14
+ children,
15
+ }: ScreenLifecycleProps) => {
16
+ const { current } = useKeys();
17
+
18
+ const animations = Animations.getAll(current.route.key);
19
+
20
+ const handleBeforeRemove = useStableCallback((e: any) => {
21
+ const key = current.navigation.getParent()?.getState().key;
22
+ const requestedDismissOnNavigator = NavigatorDismissState.get(key);
23
+
24
+ // Don't run e.preventDefault when the dismissal was on the local root
25
+ if (requestedDismissOnNavigator) {
26
+ resetStoresForScreen(current);
27
+ return;
28
+ }
29
+
30
+ // Don't run e.preventDefault when this is the first screen of the stack
31
+ if (current.navigation.getState().index === 0) {
32
+ resetStoresForScreen(current);
33
+ return;
34
+ }
35
+
36
+ e.preventDefault();
37
+ const onFinish = (finished: boolean) => {
38
+ if (finished) {
39
+ resetStoresForScreen(current);
40
+ current.navigation.dispatch(e.data.action);
41
+ }
42
+ };
43
+
44
+ runTransition({
45
+ target: "close",
46
+ spec: current.options.transitionSpec,
47
+ onFinish,
48
+ animations,
49
+ });
50
+ });
51
+
52
+ const handleInitialize = useStableCallback(() => {
53
+ runTransition({
54
+ target: "open",
55
+ spec: current.options.transitionSpec,
56
+ animations,
57
+ });
58
+ });
59
+
60
+ useLayoutEffect(handleInitialize, []);
61
+
62
+ useEffect(() => {
63
+ const unsubscribe = current.navigation.addListener(
64
+ "beforeRemove",
65
+ handleBeforeRemove,
66
+ );
67
+
68
+ return unsubscribe;
69
+ }, [current.navigation, handleBeforeRemove]);
70
+
71
+ return children;
72
+ };
@@ -0,0 +1,99 @@
1
+ import type React from "react";
2
+ import { type ComponentType, forwardRef, memo } from "react";
3
+ import type { View } from "react-native";
4
+ import { GestureDetector } from "react-native-gesture-handler";
5
+ import Animated, { runOnUI, useAnimatedRef } from "react-native-reanimated";
6
+ import { useAssociatedStyles } from "../hooks/animation/use-associated-style";
7
+ import { useBoundMeasurer } from "../hooks/bounds/use-bound-measurer";
8
+ import { useScrollProgress } from "../hooks/gestures/use-scroll-progress";
9
+ import { useGestureContext } from "../providers/gestures";
10
+ import { useKeys } from "../providers/keys";
11
+ import type { TransitionAwareProps } from "../types/core";
12
+ import type { Any } from "../types/utils";
13
+ import { BoundActivator } from "./bounds-activator";
14
+
15
+ interface CreateTransitionAwareComponentOptions {
16
+ isScrollable?: boolean;
17
+ }
18
+
19
+ export function createTransitionAwareComponent<P extends object>(
20
+ Wrapped: ComponentType<P>,
21
+ options: CreateTransitionAwareComponentOptions = {},
22
+ ) {
23
+ const { isScrollable = false } = options;
24
+
25
+ const AnimatedComponent = Animated.createAnimatedComponent(Wrapped);
26
+
27
+ const ScrollableInner = forwardRef<
28
+ React.ComponentRef<typeof Wrapped>,
29
+ TransitionAwareProps<P>
30
+ >((props: Any, ref) => {
31
+ const { nativeGesture } = useGestureContext();
32
+
33
+ const { scrollHandler, onContentSizeChange, onLayout } = useScrollProgress({
34
+ onScroll: props.onScroll,
35
+ onContentSizeChange: props.onContentSizeChange,
36
+ onLayout: props.onLayout, // Add this line to pass through onLayout
37
+ });
38
+
39
+ return (
40
+ <GestureDetector gesture={nativeGesture}>
41
+ <AnimatedComponent
42
+ {...(props as Any)}
43
+ ref={ref}
44
+ onScroll={scrollHandler}
45
+ onContentSizeChange={onContentSizeChange}
46
+ onLayout={onLayout}
47
+ scrollEventThrottle={props.scrollEventThrottle || 16}
48
+ />
49
+ </GestureDetector>
50
+ );
51
+ });
52
+
53
+ const Inner = forwardRef<
54
+ React.ComponentRef<typeof AnimatedComponent>,
55
+ TransitionAwareProps<P>
56
+ >((props, ref) => {
57
+ const { children, style, sharedBoundTag, styleId, onPress, ...rest } =
58
+ props as Any;
59
+
60
+ const animatedRef = useAnimatedRef<View>();
61
+ const { current } = useKeys();
62
+
63
+ const { associatedStyles } = useAssociatedStyles({
64
+ id: sharedBoundTag || styleId,
65
+ });
66
+
67
+ const { measureAndSet, measureOnLayout } = useBoundMeasurer({
68
+ sharedBoundTag,
69
+ animatedRef,
70
+ current,
71
+ style,
72
+ });
73
+
74
+ if (isScrollable) {
75
+ return <ScrollableInner {...(props as Any)} ref={ref} />;
76
+ }
77
+
78
+ return (
79
+ <BoundActivator sharedBoundTag={sharedBoundTag} measure={measureAndSet}>
80
+ <AnimatedComponent
81
+ {...(rest as Any)}
82
+ ref={animatedRef}
83
+ style={[style, associatedStyles]}
84
+ onPress={onPress}
85
+ onLayout={runOnUI(measureOnLayout)}
86
+ >
87
+ {children}
88
+ </AnimatedComponent>
89
+ </BoundActivator>
90
+ );
91
+ });
92
+
93
+ return memo(Inner) as React.MemoExoticComponent<
94
+ React.ForwardRefExoticComponent<
95
+ TransitionAwareProps<P> &
96
+ React.RefAttributes<React.ComponentRef<typeof Wrapped>>
97
+ >
98
+ >;
99
+ }
@@ -0,0 +1,56 @@
1
+ import { memo } from "react";
2
+ import { StyleSheet } from "react-native";
3
+ import Animated, { useAnimatedStyle } from "react-native-reanimated";
4
+ import { _useScreenAnimation } from "../hooks/animation/use-screen-animation";
5
+
6
+ interface RootTransitionAwareProps {
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ export const RootTransitionAware = memo(
11
+ ({ children }: RootTransitionAwareProps) => {
12
+ const { screenInterpolatorProps, screenStyleInterpolator } =
13
+ _useScreenAnimation();
14
+
15
+ const animatedContentStyle = useAnimatedStyle(() => {
16
+ "worklet";
17
+ if (!screenStyleInterpolator) {
18
+ return {};
19
+ }
20
+ const props = screenInterpolatorProps.value;
21
+ return screenStyleInterpolator(props).contentStyle || {};
22
+ });
23
+
24
+ const animatedOverlayStyle = useAnimatedStyle(() => {
25
+ "worklet";
26
+ if (!screenStyleInterpolator) {
27
+ return {};
28
+ }
29
+ return (
30
+ screenStyleInterpolator(screenInterpolatorProps.value).overlayStyle ||
31
+ {}
32
+ );
33
+ });
34
+
35
+ return (
36
+ <Animated.View style={styles.container}>
37
+ <Animated.View
38
+ style={[StyleSheet.absoluteFillObject, animatedOverlayStyle]}
39
+ pointerEvents="none"
40
+ />
41
+ <Animated.View style={[styles.content, animatedContentStyle]}>
42
+ {children}
43
+ </Animated.View>
44
+ </Animated.View>
45
+ );
46
+ },
47
+ );
48
+
49
+ const styles = StyleSheet.create({
50
+ container: {
51
+ flex: 1,
52
+ },
53
+ content: {
54
+ flex: 1,
55
+ },
56
+ });
@@ -0,0 +1,2 @@
1
+ export * as presets from "./presets";
2
+ export * as specs from "./specs";