react-native-bottom-sheet-stack 1.0.2 → 1.0.3

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 (68) hide show
  1. package/lib/commonjs/BottomSheet.context.js.map +1 -1
  2. package/lib/commonjs/BottomSheetBackdrop.js +76 -0
  3. package/lib/commonjs/BottomSheetBackdrop.js.map +1 -0
  4. package/lib/commonjs/BottomSheetHost.js +203 -37
  5. package/lib/commonjs/BottomSheetHost.js.map +1 -1
  6. package/lib/commonjs/BottomSheetManaged.js +128 -38
  7. package/lib/commonjs/BottomSheetManaged.js.map +1 -1
  8. package/lib/commonjs/BottomSheetManager.context.js.map +1 -1
  9. package/lib/commonjs/BottomSheetManager.provider.js +38 -13
  10. package/lib/commonjs/BottomSheetManager.provider.js.map +1 -1
  11. package/lib/commonjs/BottomSheetScaleView.js +67 -0
  12. package/lib/commonjs/BottomSheetScaleView.js.map +1 -0
  13. package/lib/commonjs/animatedRegistry.js +25 -0
  14. package/lib/commonjs/animatedRegistry.js.map +1 -0
  15. package/lib/commonjs/bottomSheet.store.js.map +1 -1
  16. package/lib/commonjs/bottomSheetCoordinator.js +5 -6
  17. package/lib/commonjs/bottomSheetCoordinator.js.map +1 -1
  18. package/lib/commonjs/index.js +3 -3
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/useBottomSheetManager.js +88 -44
  21. package/lib/commonjs/useBottomSheetManager.js.map +1 -1
  22. package/lib/commonjs/useBottomSheetState.js +40 -10
  23. package/lib/commonjs/useBottomSheetState.js.map +1 -1
  24. package/lib/commonjs/useScaleAnimation.js +108 -0
  25. package/lib/commonjs/useScaleAnimation.js.map +1 -0
  26. package/lib/typescript/example/src/App.d.ts +0 -2
  27. package/lib/typescript/example/src/App.d.ts.map +1 -1
  28. package/lib/typescript/src/BottomSheetBackdrop.d.ts +12 -0
  29. package/lib/typescript/src/BottomSheetBackdrop.d.ts.map +1 -0
  30. package/lib/typescript/src/BottomSheetHost.d.ts +1 -2
  31. package/lib/typescript/src/BottomSheetHost.d.ts.map +1 -1
  32. package/lib/typescript/src/BottomSheetManaged.d.ts.map +1 -1
  33. package/lib/typescript/src/BottomSheetManager.context.d.ts +2 -0
  34. package/lib/typescript/src/BottomSheetManager.context.d.ts.map +1 -1
  35. package/lib/typescript/src/BottomSheetManager.provider.d.ts +4 -3
  36. package/lib/typescript/src/BottomSheetManager.provider.d.ts.map +1 -1
  37. package/lib/typescript/src/BottomSheetScaleView.d.ts +18 -0
  38. package/lib/typescript/src/BottomSheetScaleView.d.ts.map +1 -0
  39. package/lib/typescript/src/animatedRegistry.d.ts +4 -0
  40. package/lib/typescript/src/animatedRegistry.d.ts.map +1 -0
  41. package/lib/typescript/src/bottomSheet.store.d.ts +4 -3
  42. package/lib/typescript/src/bottomSheet.store.d.ts.map +1 -1
  43. package/lib/typescript/src/bottomSheetCoordinator.d.ts.map +1 -1
  44. package/lib/typescript/src/index.d.ts +2 -1
  45. package/lib/typescript/src/index.d.ts.map +1 -1
  46. package/lib/typescript/src/useBottomSheetManager.d.ts.map +1 -1
  47. package/lib/typescript/src/useBottomSheetState.d.ts.map +1 -1
  48. package/lib/typescript/src/useScaleAnimation.d.ts +43 -0
  49. package/lib/typescript/src/useScaleAnimation.d.ts.map +1 -0
  50. package/package.json +9 -2
  51. package/src/BottomSheetBackdrop.tsx +61 -0
  52. package/src/BottomSheetHost.tsx +51 -13
  53. package/src/BottomSheetManaged.tsx +26 -33
  54. package/src/BottomSheetManager.context.tsx +2 -0
  55. package/src/BottomSheetManager.provider.tsx +10 -6
  56. package/src/BottomSheetScaleView.tsx +41 -0
  57. package/src/animatedRegistry.ts +22 -0
  58. package/src/bottomSheet.store.ts +124 -124
  59. package/src/bottomSheetCoordinator.ts +5 -6
  60. package/src/index.tsx +2 -4
  61. package/src/useBottomSheetManager.tsx +37 -48
  62. package/src/useBottomSheetState.ts +2 -6
  63. package/src/useScaleAnimation.ts +114 -0
  64. package/lib/commonjs/ScaleBackgroundWrapper.js +0 -71
  65. package/lib/commonjs/ScaleBackgroundWrapper.js.map +0 -1
  66. package/lib/typescript/src/ScaleBackgroundWrapper.d.ts +0 -32
  67. package/lib/typescript/src/ScaleBackgroundWrapper.d.ts.map +0 -1
  68. package/src/ScaleBackgroundWrapper.tsx +0 -97
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useScaleAnimatedStyle = useScaleAnimatedStyle;
7
+ exports.useScaleDepth = useScaleDepth;
8
+ var _compilerRuntime = require("react/compiler-runtime");
9
+ var _react = require("react");
10
+ var _reactNativeReanimated = require("react-native-reanimated");
11
+ var _bottomSheet = require("./bottomSheet.store");
12
+ const DEFAULT_CONFIG = {
13
+ scale: 0.92,
14
+ translateY: 10,
15
+ borderRadius: 12,
16
+ duration: 300
17
+ };
18
+
19
+ /**
20
+ * Returns the number of sheets with scaleBackground above a given element.
21
+ * For background wrapper, pass undefined as sheetId - returns 0 or 1 (binary).
22
+ * For sheets, returns the count of scaleBackground sheets above it.
23
+ * Uses shallow comparison internally for optimal re-renders.
24
+ */
25
+ function useScaleDepth(groupId, sheetId) {
26
+ const $ = (0, _compilerRuntime.c)(3);
27
+ const prevDepthRef = (0, _react.useRef)(0);
28
+ let t0;
29
+ if ($[0] !== groupId || $[1] !== sheetId) {
30
+ t0 = state => {
31
+ const {
32
+ stackOrder,
33
+ sheetsById
34
+ } = state;
35
+ const startIndex = sheetId ? stackOrder.indexOf(sheetId) + 1 : 0;
36
+ if (sheetId && startIndex === 0) {
37
+ return prevDepthRef.current;
38
+ }
39
+ let depth = 0;
40
+ for (let i = startIndex; i < stackOrder.length; i++) {
41
+ const id = stackOrder[i];
42
+ const sheet = sheetsById[id];
43
+ if (sheet && sheet.groupId === groupId && sheet.scaleBackground && sheet.status !== "closing") {
44
+ depth++;
45
+ if (!sheetId) {
46
+ break;
47
+ }
48
+ }
49
+ }
50
+ prevDepthRef.current = depth;
51
+ return depth;
52
+ };
53
+ $[0] = groupId;
54
+ $[1] = sheetId;
55
+ $[2] = t0;
56
+ } else {
57
+ t0 = $[2];
58
+ }
59
+ const scaleDepthSelector = t0;
60
+ return (0, _bottomSheet.useBottomSheetStore)(scaleDepthSelector);
61
+ }
62
+
63
+ /**
64
+ * Returns animated style for scale effect based on depth.
65
+ * Uses power scaling: scale^depth for cascading effect.
66
+ */
67
+ function useScaleAnimatedStyle(depth, config) {
68
+ const {
69
+ scale: t0,
70
+ translateY: t1,
71
+ borderRadius: t2,
72
+ duration: t3
73
+ } = config ?? {};
74
+ const scale = t0 === undefined ? DEFAULT_CONFIG.scale : t0;
75
+ const translateY = t1 === undefined ? DEFAULT_CONFIG.translateY : t1;
76
+ const borderRadius = t2 === undefined ? DEFAULT_CONFIG.borderRadius : t2;
77
+ const duration = t3 === undefined ? DEFAULT_CONFIG.duration : t3;
78
+ const progress = (0, _reactNativeReanimated.useDerivedValue)(() => (0, _reactNativeReanimated.withTiming)(depth, {
79
+ duration
80
+ }));
81
+ return (0, _reactNativeReanimated.useAnimatedStyle)(() => {
82
+ const p = progress.value;
83
+ if (p === 0) {
84
+ return {
85
+ transform: [{
86
+ scale: 1
87
+ }, {
88
+ translateY: 0
89
+ }],
90
+ borderRadius: 0,
91
+ overflow: "visible"
92
+ };
93
+ }
94
+ const currentScale = Math.pow(scale, p);
95
+ const currentTranslateY = translateY * p;
96
+ const currentBorderRadius = Math.min(borderRadius * p, borderRadius);
97
+ return {
98
+ transform: [{
99
+ scale: currentScale
100
+ }, {
101
+ translateY: currentTranslateY
102
+ }],
103
+ borderRadius: currentBorderRadius,
104
+ overflow: "hidden"
105
+ };
106
+ });
107
+ }
108
+ //# sourceMappingURL=useScaleAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNativeReanimated","_bottomSheet","DEFAULT_CONFIG","scale","translateY","borderRadius","duration","useScaleDepth","groupId","sheetId","$","_compilerRuntime","c","prevDepthRef","useRef","t0","state","stackOrder","sheetsById","startIndex","indexOf","current","depth","i","length","id","sheet","scaleBackground","status","scaleDepthSelector","useBottomSheetStore","useScaleAnimatedStyle","config","t1","t2","t3","undefined","progress","useDerivedValue","withTiming","useAnimatedStyle","p","value","transform","overflow","currentScale","Math","pow","currentTranslateY","currentBorderRadius","min"],"sourceRoot":"../../src","sources":["useScaleAnimation.ts"],"mappings":"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","ignoreList":[]}
@@ -1,4 +1,2 @@
1
- import { type PropsWithChildren } from 'react';
2
1
  export default function App(): import("react/jsx-runtime").JSX.Element;
3
- export declare const Content: ({}: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
4
2
  //# sourceMappingURL=App.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../example/src/App.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAa3D,MAAM,CAAC,OAAO,UAAU,GAAG,4CAiB1B;AAmBD,eAAO,MAAM,OAAO,GAAI,IAAI,iBAAiB,4CAU5C,CAAC"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../example/src/App.tsx"],"names":[],"mappings":"AAwBA,MAAM,CAAC,OAAO,UAAU,GAAG,4CAgB1B"}
@@ -0,0 +1,12 @@
1
+ interface BottomSheetBackdropProps {
2
+ sheetId: string;
3
+ onPress?: () => void;
4
+ }
5
+ /**
6
+ * Custom backdrop component rendered separately from the scaled sheet content.
7
+ * This ensures the backdrop doesn't scale with the sheet.
8
+ * Opacity is interpolated from the bottom sheet's animatedIndex for smooth animation.
9
+ */
10
+ export declare function BottomSheetBackdrop({ sheetId, onPress, }: BottomSheetBackdropProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=BottomSheetBackdrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetBackdrop.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetBackdrop.tsx"],"names":[],"mappings":"AASA,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAID;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,GACR,EAAE,wBAAwB,2CA6B1B"}
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  declare function BottomSheetHostComp(): import("react/jsx-runtime").JSX.Element;
3
- export declare const BottomSheetHost: React.MemoExoticComponent<typeof BottomSheetHostComp>;
2
+ export declare const BottomSheetHost: typeof BottomSheetHostComp;
4
3
  export {};
5
4
  //# sourceMappingURL=BottomSheetHost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHost.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetHost.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAUlD,iBAAS,mBAAmB,4CA0B3B;AAsCD,eAAO,MAAM,eAAe,uDAAkC,CAAC"}
1
+ {"version":3,"file":"BottomSheetHost.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetHost.tsx"],"names":[],"mappings":"AAkBA,iBAAS,mBAAmB,4CA+B3B;AA4DD,eAAO,MAAM,eAAe,4BAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetManaged.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetManaged.tsx"],"names":[],"mappings":"AAAA,OAA4B,EAI1B,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAA+B,MAAM,OAAO,CAAC;AAKpD,MAAM,WAAW,cAAe,SAAQ,kBAAkB;CAAG;AAE7D,UAAU,uBAAwB,SAAQ,gBAAgB;CAAG;AAE7D,eAAO,MAAM,kBAAkB,gGAuE9B,CAAC"}
1
+ {"version":3,"file":"BottomSheetManaged.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetManaged.tsx"],"names":[],"mappings":"AAAA,OAA4B,EAE1B,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,cAAe,SAAQ,kBAAkB;CAAG;AAE7D,UAAU,uBAAwB,SAAQ,gBAAgB;CAAG;AAK7D,eAAO,MAAM,kBAAkB,gGA8D9B,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import type { ScaleConfig } from './useScaleAnimation';
2
3
  export interface BottomSheetManagerContextValue {
3
4
  groupId: string;
5
+ scaleConfig?: ScaleConfig;
4
6
  }
5
7
  export declare const BottomSheetManagerContext: React.Context<BottomSheetManagerContextValue | null>;
6
8
  //# sourceMappingURL=BottomSheetManager.context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetManager.context.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetManager.context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,yBAAyB,sDAC4B,CAAC"}
1
+ {"version":3,"file":"BottomSheetManager.context.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetManager.context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,eAAO,MAAM,yBAAyB,sDAC4B,CAAC"}
@@ -1,10 +1,11 @@
1
- import React, { type PropsWithChildren } from 'react';
1
+ import { type PropsWithChildren } from 'react';
2
2
  import { type BottomSheetManagerContextValue } from './BottomSheetManager.context';
3
+ import type { ScaleConfig } from './useScaleAnimation';
3
4
  interface ProviderProps extends PropsWithChildren {
4
5
  id: string;
6
+ scaleConfig?: ScaleConfig;
5
7
  }
6
- declare function BottomSheetManagerProviderComp({ id, children }: ProviderProps): import("react/jsx-runtime").JSX.Element;
7
- export declare const BottomSheetManagerProvider: React.MemoExoticComponent<typeof BottomSheetManagerProviderComp>;
8
+ export declare function BottomSheetManagerProvider({ id, scaleConfig, children, }: ProviderProps): import("react/jsx-runtime").JSX.Element;
8
9
  export declare const useBottomSheetManagerContext: () => BottomSheetManagerContextValue;
9
10
  export declare const useMaybeBottomSheetManagerContext: () => BottomSheetManagerContextValue | null;
10
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetManager.provider.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetManager.provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AAEtC,UAAU,aAAc,SAAQ,iBAAiB;IAC/C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,iBAAS,8BAA8B,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,aAAa,2CAMtE;AAED,eAAO,MAAM,0BAA0B,kEAEtC,CAAC;AAEF,eAAO,MAAM,4BAA4B,QACnC,8BASH,CAAC;AAEJ,eAAO,MAAM,iCAAiC,QACxC,8BAA8B,GAAG,IAOpC,CAAC"}
1
+ {"version":3,"file":"BottomSheetManager.provider.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetManager.provider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,UAAU,aAAc,SAAQ,iBAAiB;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,0BAA0B,CAAC,EACzC,EAAE,EACF,WAAW,EACX,QAAQ,GACT,EAAE,aAAa,2CAQf;AAED,eAAO,MAAM,4BAA4B,QACnC,8BASH,CAAC;AAEJ,eAAO,MAAM,iCAAiC,QACxC,8BAA8B,GAAG,IAOpC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ /**
3
+ * Wraps your app content with iOS-style scale animation when a bottom sheet
4
+ * with scaleBackground: true is open. Place your main content inside this
5
+ * component, but keep BottomSheetHost outside of it.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <BottomSheetManagerProvider id="default" scaleConfig={{ scale: 0.92 }}>
10
+ * <BottomSheetScaleView>
11
+ * <MainContent />
12
+ * </BottomSheetScaleView>
13
+ * <BottomSheetHost />
14
+ * </BottomSheetManagerProvider>
15
+ * ```
16
+ */
17
+ export declare function BottomSheetScaleView({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
18
+ //# sourceMappingURL=BottomSheetScaleView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetScaleView.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetScaleView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAM3D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAanE"}
@@ -0,0 +1,4 @@
1
+ import { type SharedValue } from 'react-native-reanimated';
2
+ export declare function getAnimatedIndex(sheetId: string): SharedValue<number>;
3
+ export declare function cleanupAnimatedIndex(sheetId: string): void;
4
+ //# sourceMappingURL=animatedRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animatedRegistry.d.ts","sourceRoot":"","sources":["../../../src/animatedRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAQxE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CASrE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1D"}
@@ -22,10 +22,11 @@ interface BottomSheetStoreActions {
22
22
  finishClosing(id: string): void;
23
23
  clearAll(): void;
24
24
  }
25
- export declare const useBottomSheetStore: import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<import("zustand/vanilla").StoreApi<BottomSheetStoreState & BottomSheetStoreActions>, "subscribe"> & {
25
+ export type BottomSheetStore = BottomSheetStoreState & BottomSheetStoreActions;
26
+ export declare const useBottomSheetStore: import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<import("zustand/vanilla").StoreApi<BottomSheetStore>, "subscribe"> & {
26
27
  subscribe: {
27
- (listener: (selectedState: BottomSheetStoreState & BottomSheetStoreActions, previousSelectedState: BottomSheetStoreState & BottomSheetStoreActions) => void): () => void;
28
- <U>(selector: (state: BottomSheetStoreState & BottomSheetStoreActions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
28
+ (listener: (selectedState: BottomSheetStore, previousSelectedState: BottomSheetStore) => void): () => void;
29
+ <U>(selector: (state: BottomSheetStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
29
30
  equalityFn?: ((a: U, b: U) => boolean) | undefined;
30
31
  fireImmediately?: boolean;
31
32
  } | undefined): () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"bottomSheet.store.d.ts","sourceRoot":"","sources":["../../../src/bottomSheet.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC1E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAErD,UAAU,qBAAqB;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB;;;;;;;;EAoI/B,CAAC"}
1
+ {"version":3,"file":"bottomSheet.store.d.ts","sourceRoot":"","sources":["../../../src/bottomSheet.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC1E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAErD,UAAU,qBAAqB;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAE/E,eAAO,MAAM,mBAAmB;;;;;;;;EAkI/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"bottomSheetCoordinator.d.ts","sourceRoot":"","sources":["../../../src/bottomSheetCoordinator.ts"],"names":[],"mappings":"AAGA,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,cAiCzD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM;+BAIpB,MAAM,WAAW,MAAM;;EA8B1D"}
1
+ {"version":3,"file":"bottomSheetCoordinator.d.ts","sourceRoot":"","sources":["../../../src/bottomSheetCoordinator.ts"],"names":[],"mappings":"AAGA,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,cAgCzD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM;+BAIpB,MAAM,WAAW,MAAM;;EA8B1D"}
@@ -3,5 +3,6 @@ export { BottomSheetManagerProvider } from './BottomSheetManager.provider';
3
3
  export { useBottomSheetManager } from './useBottomSheetManager';
4
4
  export { useBottomSheetState } from './useBottomSheetState';
5
5
  export { BottomSheetManaged } from './BottomSheetManaged';
6
- export { ScaleBackgroundWrapper, type ScaleBackgroundConfig, } from './ScaleBackgroundWrapper';
6
+ export { BottomSheetScaleView } from './BottomSheetScaleView';
7
+ export { type ScaleConfig } from './useScaleAnimation';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBottomSheetManager.d.ts","sourceRoot":"","sources":["../../../src/useBottomSheetManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMzE,eAAO,MAAM,qBAAqB;;gBAmEzB,MAAM;+BA7CA,KAAK,CAAC,YAAY,YAClB;QACP,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B;;;;;;;;;;;;;CAwDN,CAAC"}
1
+ {"version":3,"file":"useBottomSheetManager.d.ts","sourceRoot":"","sources":["../../../src/useBottomSheetManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMzE,eAAO,MAAM,qBAAqB;;gBA0Db,MAAM;+BArCd,KAAK,CAAC,YAAY,YAClB;QACP,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B;;;;;;;;;;;;;CA8CJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBottomSheetState.d.ts","sourceRoot":"","sources":["../../../src/useBottomSheetState.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,wBAAgB,mBAAmB,IAAI;IACrC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAyBA"}
1
+ {"version":3,"file":"useBottomSheetState.d.ts","sourceRoot":"","sources":["../../../src/useBottomSheetState.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,wBAAgB,mBAAmB,IAAI;IACrC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAsBA"}
@@ -0,0 +1,43 @@
1
+ export interface ScaleConfig {
2
+ /** Scale factor when sheet is open (default: 0.92) */
3
+ scale?: number;
4
+ /** Vertical translation when sheet is open (default: 10) */
5
+ translateY?: number;
6
+ /** Border radius when sheet is open (default: 12) */
7
+ borderRadius?: number;
8
+ /** Animation duration in ms (default: 300) */
9
+ duration?: number;
10
+ }
11
+ /**
12
+ * Returns the number of sheets with scaleBackground above a given element.
13
+ * For background wrapper, pass undefined as sheetId - returns 0 or 1 (binary).
14
+ * For sheets, returns the count of scaleBackground sheets above it.
15
+ * Uses shallow comparison internally for optimal re-renders.
16
+ */
17
+ export declare function useScaleDepth(groupId: string, sheetId?: string): number;
18
+ /**
19
+ * Returns animated style for scale effect based on depth.
20
+ * Uses power scaling: scale^depth for cascading effect.
21
+ */
22
+ export declare function useScaleAnimatedStyle(depth: number, config?: ScaleConfig): {
23
+ transform: ({
24
+ scale: number;
25
+ translateY?: undefined;
26
+ } | {
27
+ translateY: number;
28
+ scale?: undefined;
29
+ })[];
30
+ borderRadius: number;
31
+ overflow: "visible";
32
+ } | {
33
+ transform: ({
34
+ scale: number;
35
+ translateY?: undefined;
36
+ } | {
37
+ translateY: number;
38
+ scale?: undefined;
39
+ })[];
40
+ borderRadius: number;
41
+ overflow: "hidden";
42
+ };
43
+ //# sourceMappingURL=useScaleAnimation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScaleAnimation.d.ts","sourceRoot":"","sources":["../../../src/useScaleAnimation.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAuCvE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;EAiCxE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bottom-sheet-stack",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Bottom Sheet Stack Manager",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "lib/commonjs/index.js",
@@ -38,6 +38,7 @@
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
40
  "devDependencies": {
41
+ "@babel/cli": "^7.28.6",
41
42
  "@commitlint/config-conventional": "^19.6.0",
42
43
  "@eslint/compat": "^1.2.7",
43
44
  "@eslint/eslintrc": "^3.3.0",
@@ -48,6 +49,7 @@
48
49
  "@release-it/conventional-changelog": "^9.0.2",
49
50
  "@types/jest": "^29.5.5",
50
51
  "@types/react": "^19.0.12",
52
+ "babel-plugin-react-compiler": "^1.0.0",
51
53
  "commitlint": "^19.6.1",
52
54
  "del-cli": "^5.1.0",
53
55
  "eslint": "^9.22.0",
@@ -121,7 +123,12 @@
121
123
  "source": "src",
122
124
  "output": "lib",
123
125
  "targets": [
124
- "commonjs",
126
+ [
127
+ "commonjs",
128
+ {
129
+ "configFile": true
130
+ }
131
+ ],
125
132
  "typescript"
126
133
  ]
127
134
  },
@@ -0,0 +1,61 @@
1
+ import { Pressable, StyleSheet } from 'react-native';
2
+ import Animated, {
3
+ Extrapolation,
4
+ interpolate,
5
+ useAnimatedStyle,
6
+ } from 'react-native-reanimated';
7
+ import { getAnimatedIndex } from './animatedRegistry';
8
+ import { useBottomSheetStore } from './bottomSheet.store';
9
+
10
+ interface BottomSheetBackdropProps {
11
+ sheetId: string;
12
+ onPress?: () => void;
13
+ }
14
+
15
+ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
16
+
17
+ /**
18
+ * Custom backdrop component rendered separately from the scaled sheet content.
19
+ * This ensures the backdrop doesn't scale with the sheet.
20
+ * Opacity is interpolated from the bottom sheet's animatedIndex for smooth animation.
21
+ */
22
+ export function BottomSheetBackdrop({
23
+ sheetId,
24
+ onPress,
25
+ }: BottomSheetBackdropProps) {
26
+ const status = useBottomSheetStore(
27
+ (state) => state.sheetsById[sheetId]?.status
28
+ );
29
+
30
+ const animatedIndex = getAnimatedIndex(sheetId);
31
+
32
+ const isVisible = status === 'opening' || status === 'open';
33
+
34
+ const animatedStyle = useAnimatedStyle(() => {
35
+ // Interpolate opacity based on animatedIndex
36
+ // -1 = closed, 0+ = open at snap point
37
+ const opacity = interpolate(
38
+ animatedIndex.value,
39
+ [-1, 0],
40
+ [0, 1],
41
+ Extrapolation.CLAMP
42
+ );
43
+
44
+ return { opacity };
45
+ });
46
+
47
+ return (
48
+ <AnimatedPressable
49
+ style={[styles.backdrop, animatedStyle]}
50
+ onPress={onPress}
51
+ pointerEvents={isVisible ? 'auto' : 'none'}
52
+ />
53
+ );
54
+ }
55
+
56
+ const styles = StyleSheet.create({
57
+ backdrop: {
58
+ ...StyleSheet.absoluteFillObject,
59
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
60
+ },
61
+ });
@@ -1,18 +1,26 @@
1
- import React, { useEffect, useMemo } from 'react';
1
+ import { useEffect } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
+ import Animated from 'react-native-reanimated';
3
4
  import { useSafeAreaFrame } from 'react-native-safe-area-context';
4
5
 
5
6
  import { shallow } from 'zustand/shallow';
7
+ import { cleanupAnimatedIndex } from './animatedRegistry';
8
+ import { BottomSheetBackdrop } from './BottomSheetBackdrop';
6
9
  import { BottomSheetContext } from './BottomSheet.context';
7
10
  import { useBottomSheetStore } from './bottomSheet.store';
8
11
  import { useBottomSheetManagerContext } from './BottomSheetManager.provider';
9
12
  import { initBottomSheetCoordinator } from './bottomSheetCoordinator';
13
+ import {
14
+ useScaleAnimatedStyle,
15
+ useScaleDepth,
16
+ type ScaleConfig,
17
+ } from './useScaleAnimation';
10
18
 
11
19
  function BottomSheetHostComp() {
12
20
  const queueIds = useQueueIds();
13
21
  const clearAll = useBottomSheetStore((store) => store.clearAll);
14
22
 
15
- const { groupId } = useBottomSheetManagerContext();
23
+ const { groupId, scaleConfig } = useBottomSheetManagerContext();
16
24
 
17
25
  useEffect(() => {
18
26
  const unsubscribe = initBottomSheetCoordinator(groupId);
@@ -30,35 +38,62 @@ function BottomSheetHostComp() {
30
38
  return (
31
39
  <>
32
40
  {queueIds.map((id) => (
33
- <QueueItem key={id} id={id} />
41
+ <QueueItem
42
+ key={id}
43
+ id={id}
44
+ groupId={groupId}
45
+ scaleConfig={scaleConfig}
46
+ />
34
47
  ))}
35
48
  </>
36
49
  );
37
50
  }
38
51
 
39
- const QueueItem = React.memo(({ id }: { id: string }) => {
52
+ function QueueItem({
53
+ id,
54
+ groupId,
55
+ scaleConfig,
56
+ }: {
57
+ id: string;
58
+ groupId: string;
59
+ scaleConfig?: ScaleConfig;
60
+ }) {
40
61
  const content = useBottomSheetStore((state) => state.sheetsById[id]?.content);
41
62
 
42
63
  const { width, height } = useSafeAreaFrame();
43
- const value = useMemo(() => ({ id }), [id]);
64
+ const value = { id };
65
+
66
+ const scaleDepth = useScaleDepth(groupId, id);
67
+ const scaleStyle = useScaleAnimatedStyle(scaleDepth, scaleConfig);
68
+
69
+ // Cleanup animated index when sheet is unmounted
70
+ useEffect(() => {
71
+ return () => {
72
+ cleanupAnimatedIndex(id);
73
+ };
74
+ }, [id]);
44
75
 
45
76
  return (
46
77
  <BottomSheetContext.Provider value={value}>
47
- <View
78
+ {/* Backdrop - rendered without scaling */}
79
+ <View style={[StyleSheet.absoluteFillObject, styles.backdropContainer]}>
80
+ <BottomSheetBackdrop sheetId={id} />
81
+ </View>
82
+
83
+ {/* Sheet content - rendered with scaling */}
84
+ <Animated.View
48
85
  style={[
49
86
  StyleSheet.absoluteFillObject,
50
87
  styles.container,
51
- {
52
- width,
53
- height,
54
- },
88
+ { width, height },
89
+ scaleStyle,
55
90
  ]}
56
91
  >
57
92
  {content}
58
- </View>
93
+ </Animated.View>
59
94
  </BottomSheetContext.Provider>
60
95
  );
61
- });
96
+ }
62
97
 
63
98
  const useQueueIds = () => {
64
99
  const { groupId } = useBottomSheetManagerContext();
@@ -72,9 +107,12 @@ const useQueueIds = () => {
72
107
  );
73
108
  };
74
109
 
75
- export const BottomSheetHost = React.memo(BottomSheetHostComp);
110
+ export const BottomSheetHost = BottomSheetHostComp;
76
111
 
77
112
  const styles = StyleSheet.create({
113
+ backdropContainer: {
114
+ zIndex: 99_999_999,
115
+ },
78
116
  container: {
79
117
  zIndex: 100_000_000,
80
118
  pointerEvents: 'box-none',