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

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 (86) hide show
  1. package/README.md +262 -50
  2. package/lib/commonjs/BottomSheet.context.js.map +1 -1
  3. package/lib/commonjs/BottomSheetBackdrop.js +76 -0
  4. package/lib/commonjs/BottomSheetBackdrop.js.map +1 -0
  5. package/lib/commonjs/BottomSheetHost.js +280 -38
  6. package/lib/commonjs/BottomSheetHost.js.map +1 -1
  7. package/lib/commonjs/BottomSheetManaged.js +128 -38
  8. package/lib/commonjs/BottomSheetManaged.js.map +1 -1
  9. package/lib/commonjs/BottomSheetManager.context.js.map +1 -1
  10. package/lib/commonjs/BottomSheetManager.provider.js +41 -13
  11. package/lib/commonjs/BottomSheetManager.provider.js.map +1 -1
  12. package/lib/commonjs/BottomSheetPortal.js +46 -0
  13. package/lib/commonjs/BottomSheetPortal.js.map +1 -0
  14. package/lib/commonjs/BottomSheetScaleView.js +67 -0
  15. package/lib/commonjs/BottomSheetScaleView.js.map +1 -0
  16. package/lib/commonjs/animatedRegistry.js +25 -0
  17. package/lib/commonjs/animatedRegistry.js.map +1 -0
  18. package/lib/commonjs/bottomSheet.store.js +19 -0
  19. package/lib/commonjs/bottomSheet.store.js.map +1 -1
  20. package/lib/commonjs/bottomSheetCoordinator.js +5 -6
  21. package/lib/commonjs/bottomSheetCoordinator.js.map +1 -1
  22. package/lib/commonjs/index.js +17 -3
  23. package/lib/commonjs/index.js.map +1 -1
  24. package/lib/commonjs/portal.types.js +2 -0
  25. package/lib/commonjs/portal.types.js.map +1 -0
  26. package/lib/commonjs/useBottomSheetControl.js +81 -0
  27. package/lib/commonjs/useBottomSheetControl.js.map +1 -0
  28. package/lib/commonjs/useBottomSheetManager.js +88 -44
  29. package/lib/commonjs/useBottomSheetManager.js.map +1 -1
  30. package/lib/commonjs/useBottomSheetState.js +40 -10
  31. package/lib/commonjs/useBottomSheetState.js.map +1 -1
  32. package/lib/commonjs/useScaleAnimation.js +108 -0
  33. package/lib/commonjs/useScaleAnimation.js.map +1 -0
  34. package/lib/typescript/example/src/App.d.ts +0 -2
  35. package/lib/typescript/example/src/App.d.ts.map +1 -1
  36. package/lib/typescript/src/BottomSheetBackdrop.d.ts +12 -0
  37. package/lib/typescript/src/BottomSheetBackdrop.d.ts.map +1 -0
  38. package/lib/typescript/src/BottomSheetHost.d.ts +1 -2
  39. package/lib/typescript/src/BottomSheetHost.d.ts.map +1 -1
  40. package/lib/typescript/src/BottomSheetManaged.d.ts.map +1 -1
  41. package/lib/typescript/src/BottomSheetManager.context.d.ts +2 -0
  42. package/lib/typescript/src/BottomSheetManager.context.d.ts.map +1 -1
  43. package/lib/typescript/src/BottomSheetManager.provider.d.ts +4 -3
  44. package/lib/typescript/src/BottomSheetManager.provider.d.ts.map +1 -1
  45. package/lib/typescript/src/BottomSheetPortal.d.ts +9 -0
  46. package/lib/typescript/src/BottomSheetPortal.d.ts.map +1 -0
  47. package/lib/typescript/src/BottomSheetScaleView.d.ts +18 -0
  48. package/lib/typescript/src/BottomSheetScaleView.d.ts.map +1 -0
  49. package/lib/typescript/src/animatedRegistry.d.ts +4 -0
  50. package/lib/typescript/src/animatedRegistry.d.ts.map +1 -0
  51. package/lib/typescript/src/bottomSheet.store.d.ts +9 -3
  52. package/lib/typescript/src/bottomSheet.store.d.ts.map +1 -1
  53. package/lib/typescript/src/bottomSheetCoordinator.d.ts.map +1 -1
  54. package/lib/typescript/src/index.d.ts +5 -1
  55. package/lib/typescript/src/index.d.ts.map +1 -1
  56. package/lib/typescript/src/portal.types.d.ts +24 -0
  57. package/lib/typescript/src/portal.types.d.ts.map +1 -0
  58. package/lib/typescript/src/useBottomSheetControl.d.ts +10 -0
  59. package/lib/typescript/src/useBottomSheetControl.d.ts.map +1 -0
  60. package/lib/typescript/src/useBottomSheetManager.d.ts +2 -0
  61. package/lib/typescript/src/useBottomSheetManager.d.ts.map +1 -1
  62. package/lib/typescript/src/useBottomSheetState.d.ts.map +1 -1
  63. package/lib/typescript/src/useScaleAnimation.d.ts +43 -0
  64. package/lib/typescript/src/useScaleAnimation.d.ts.map +1 -0
  65. package/package.json +11 -2
  66. package/src/BottomSheetBackdrop.tsx +61 -0
  67. package/src/BottomSheetHost.tsx +74 -15
  68. package/src/BottomSheetManaged.tsx +26 -33
  69. package/src/BottomSheetManager.context.tsx +2 -0
  70. package/src/BottomSheetManager.provider.tsx +15 -8
  71. package/src/BottomSheetPortal.tsx +39 -0
  72. package/src/BottomSheetScaleView.tsx +41 -0
  73. package/src/animatedRegistry.ts +22 -0
  74. package/src/bottomSheet.store.ts +150 -123
  75. package/src/bottomSheetCoordinator.ts +5 -6
  76. package/src/index.tsx +8 -4
  77. package/src/portal.types.ts +25 -0
  78. package/src/useBottomSheetControl.ts +52 -0
  79. package/src/useBottomSheetManager.tsx +37 -48
  80. package/src/useBottomSheetState.ts +2 -6
  81. package/src/useScaleAnimation.ts +114 -0
  82. package/lib/commonjs/ScaleBackgroundWrapper.js +0 -71
  83. package/lib/commonjs/ScaleBackgroundWrapper.js.map +0 -1
  84. package/lib/typescript/src/ScaleBackgroundWrapper.d.ts +0 -32
  85. package/lib/typescript/src/ScaleBackgroundWrapper.d.ts.map +0 -1
  86. package/src/ScaleBackgroundWrapper.tsx +0 -97
package/README.md CHANGED
@@ -1,88 +1,300 @@
1
- # 🧩 BottomSheet Stack Manager
1
+ # react-native-bottom-sheet-stack
2
2
 
3
- Manage a stack of [@gorhom/bottom-sheet](https://github.com/gorhom/react-native-bottom-sheet) components with `push`, `switch`, and `replace` navigation without unmounting underlying sheets.
3
+ A stack manager for [@gorhom/bottom-sheet](https://github.com/gorhom/react-native-bottom-sheet) with `push`, `switch`, and `replace` navigation modes, iOS-style scale animations, and React context preservation.
4
4
 
5
- > ⚠️ **Important:** Not Production Ready
6
- > This library is currently in active development and is not yet considered production-ready.
5
+ ## Features
7
6
 
8
- ## Demo:
9
- https://x.com/tsolfitsmexx/status/1913103288834089056?s=46&t=kx6uESwbDrRgTUOCDr1tMQ
7
+ - **Stack Navigation** — `push`, `switch`, and `replace` modes for managing multiple sheets
8
+ - **Scale Animation** — iOS-style background scaling effect when sheets are stacked
9
+ - **Context Preservation** — Portal-based API that preserves React context in bottom sheets
10
+ - **Underlying Sheets Stay Mounted** — Sheets remain in the stack until explicitly closed
11
+ - **Group Support** — Isolated stacks for different parts of your app
10
12
 
11
- ---
12
-
13
- ## 🚀 Features
14
-
15
- - 🧱 `push` — stack a new sheet above the current one
16
- - 🔄 `switch` — override current sheet temporarily, restore the previous one when closing
17
- - 🔁 `replace` — fully swap and remove the current sheet
18
- - 🧠 Underlying sheets remain mounted
19
- - 🗂️ Group support for isolated stacks
20
-
21
- ---
22
-
23
- ## 📦 Installation
13
+ ## Installation
24
14
 
25
15
  ```bash
26
- yarn add zustand @gorhom/bottom-sheet
16
+ yarn add react-native-bottom-sheet-stack
27
17
  ```
28
18
 
29
- ## Usage
19
+ ### Peer Dependencies
30
20
 
31
- ### 🧠 Important: Use <BottomSheetManaged /> instead of <BottomSheet />
32
-
33
- To make the stack manager work, you must replace all instances of BottomSheet from @gorhom/bottom-sheet with the provided:
34
-
35
- ```tsx
36
- import { BottomSheetManaged } from 'react-native-bottom-sheet-stack';
21
+ ```bash
22
+ yarn add @gorhom/bottom-sheet react-native-reanimated react-native-gesture-handler react-native-safe-area-context react-native-teleport zustand
37
23
  ```
38
24
 
39
- In your app entry:
25
+ ## Quick Start
26
+
27
+ ### 1. Setup Provider and Host
40
28
 
41
29
  ```tsx
42
30
  import {
31
+ BottomSheetManagerProvider,
43
32
  BottomSheetHost,
44
- BottomSheetManager,
45
- initBottomSheetCoordinator,
33
+ BottomSheetScaleView,
46
34
  } from 'react-native-bottom-sheet-stack';
47
-
48
- initBottomSheetCoordinator();
35
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
36
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
49
37
 
50
38
  export default function App() {
51
39
  return (
52
- <BottomSheetManager id="default">
53
- <BottomSheetHost />
54
- {/* your app content */}
55
- </BottomSheetManager>
40
+ <SafeAreaProvider>
41
+ <GestureHandlerRootView style={{ flex: 1 }}>
42
+ <BottomSheetManagerProvider id="default">
43
+ <BottomSheetScaleView>
44
+ <YourAppContent />
45
+ </BottomSheetScaleView>
46
+ <BottomSheetHost />
47
+ </BottomSheetManagerProvider>
48
+ </GestureHandlerRootView>
49
+ </SafeAreaProvider>
56
50
  );
57
51
  }
58
52
  ```
59
53
 
60
- In a component:
54
+ ### 2. Create a Bottom Sheet Component
55
+
56
+ Use `BottomSheetManaged` instead of `BottomSheet` from `@gorhom/bottom-sheet`:
61
57
 
62
58
  ```tsx
63
- import { useBottomSheetManager } from 'react-native-bottom-sheet-stack';
59
+ import { forwardRef } from 'react';
60
+ import { View, Text } from 'react-native';
61
+ import { BottomSheetView } from '@gorhom/bottom-sheet';
62
+ import { BottomSheetManaged, useBottomSheetState } from 'react-native-bottom-sheet-stack';
64
63
 
65
- export default function YouComponent() {
66
- const { openBottomSheet } = useBottomSheetManager();
64
+ const MySheet = forwardRef((props, ref) => {
65
+ const { close } = useBottomSheetState();
67
66
 
68
67
  return (
69
- <TouchableOpacity onPress={() => openBottomSheet(<YourBottomSheet />, { mode: 'switch' })}>
70
- <Text>Open Bottom Sheet</Text>
71
- </TouchableOpacity>
68
+ <BottomSheetManaged ref={ref} snapPoints={['50%']}>
69
+ <BottomSheetView>
70
+ <View style={{ padding: 20 }}>
71
+ <Text>Hello from Bottom Sheet!</Text>
72
+ <Button title="Close" onPress={close} />
73
+ </View>
74
+ </BottomSheetView>
75
+ </BottomSheetManaged>
72
76
  );
77
+ });
78
+ ```
79
+
80
+ ### 3. Open Bottom Sheets
81
+
82
+ ```tsx
83
+ import { useBottomSheetManager } from 'react-native-bottom-sheet-stack';
84
+
85
+ function MyComponent() {
86
+ const { openBottomSheet } = useBottomSheetManager();
87
+
88
+ const handleOpen = () => {
89
+ openBottomSheet(<MySheet />, {
90
+ mode: 'push', // 'push' | 'switch' | 'replace'
91
+ scaleBackground: true,
92
+ });
93
+ };
94
+
95
+ return <Button title="Open Sheet" onPress={handleOpen} />;
73
96
  }
74
97
  ```
75
98
 
76
- Define your bottom sheet:
99
+ ## Navigation Modes
100
+
101
+ | Mode | Description |
102
+ |------|-------------|
103
+ | `push` | Stack a new sheet on top. Previous sheet remains visible underneath. |
104
+ | `switch` | Hide current sheet and show new one. Previous sheet is restored when new one closes. |
105
+ | `replace` | Close current sheet and open new one. Previous sheet is removed from stack. |
106
+
107
+ ## Scale Animation
108
+
109
+ Wrap your app content in `BottomSheetScaleView` to enable iOS-style scaling:
110
+
111
+ ```tsx
112
+ <BottomSheetManagerProvider
113
+ id="default"
114
+ scaleConfig={{ scale: 0.92, translateY: 0, borderRadius: 24 }}
115
+ >
116
+ <BottomSheetScaleView>
117
+ <YourAppContent />
118
+ </BottomSheetScaleView>
119
+ <BottomSheetHost />
120
+ </BottomSheetManagerProvider>
121
+ ```
122
+
123
+ > **Important:** `BottomSheetHost` must be **outside** of `BottomSheetScaleView`. If you wrap `BottomSheetHost` inside `BottomSheetScaleView`, the bottom sheets themselves will also scale, which is not the desired behavior.
124
+
125
+ Open sheets with `scaleBackground: true`:
77
126
 
78
127
  ```tsx
79
- import { BottomSheetManaged } from 'react-native-bottom-sheet-stack';
128
+ openBottomSheet(<MySheet />, { scaleBackground: true });
129
+ ```
130
+
131
+ ## Context Preservation (Portal API)
132
+
133
+ The imperative `openBottomSheet()` API stores content in a Zustand store and renders it in `BottomSheetHost`. This means **React context from your component tree is lost**.
134
+
135
+ For cases where you need context (themes, auth, i18n, etc.), use the **portal-based API**:
136
+
137
+ ```tsx
138
+ import {
139
+ BottomSheetPortal,
140
+ useBottomSheetControl,
141
+ } from 'react-native-bottom-sheet-stack';
142
+
143
+ function MyComponent() {
144
+ const { open, close, isOpen } = useBottomSheetControl('my-sheet');
80
145
 
81
- export default function YourBottomSheet() {
82
146
  return (
83
- <BottomSheetManaged snapPoints={['50%']}>
84
- {/* Sheet content */}
85
- </BottomSheetManaged>
147
+ <View>
148
+ {/* Declare the portal - content is rendered here in your React tree */}
149
+ <BottomSheetPortal id="my-sheet">
150
+ <MySheet />
151
+ </BottomSheetPortal>
152
+
153
+ {/* Control it imperatively */}
154
+ <Button title="Open" onPress={() => open({ scaleBackground: true })} />
155
+ </View>
86
156
  );
87
157
  }
88
- ```
158
+ ```
159
+
160
+ ### How It Works
161
+
162
+ | API | Context | Use Case |
163
+ |-----|---------|----------|
164
+ | `openBottomSheet()` | Lost | Dynamic sheets, simple cases |
165
+ | `BottomSheetPortal` | Preserved | Sheets needing theme, auth, i18n, etc. |
166
+
167
+ The portal API uses [react-native-teleport](https://github.com/nicklockwood/react-native-teleport) to render content in your component tree while displaying it in `BottomSheetHost`.
168
+
169
+ ### Type-Safe Portal IDs
170
+
171
+ You can get autocomplete and type checking for portal sheet IDs by augmenting the `BottomSheetPortalRegistry` interface.
172
+
173
+ **Step 1:** Create a type declaration file in your project (e.g., `src/types/bottom-sheet.d.ts`):
174
+
175
+ ```tsx
176
+ import 'react-native-bottom-sheet-stack';
177
+
178
+ declare module 'react-native-bottom-sheet-stack' {
179
+ interface BottomSheetPortalRegistry {
180
+ 'settings-sheet': true;
181
+ 'profile-sheet': true;
182
+ 'confirm-dialog': true;
183
+ }
184
+ }
185
+ ```
186
+
187
+ **Step 2:** Make sure the file is included in your `tsconfig.json`:
188
+
189
+ ```json
190
+ {
191
+ "compilerOptions": {
192
+ // ...
193
+ },
194
+ "include": [
195
+ "src/**/*",
196
+ "src/types/**/*.d.ts" // include your declaration files
197
+ ]
198
+ }
199
+ ```
200
+
201
+ **Step 3:** Now TypeScript will autocomplete and validate the `id` prop:
202
+
203
+ ```tsx
204
+ // ✅ Valid - 'settings-sheet' is in registry
205
+ <BottomSheetPortal id="settings-sheet">
206
+ const control = useBottomSheetControl('settings-sheet');
207
+
208
+ // ❌ Error - 'unknown-sheet' is not in registry
209
+ <BottomSheetPortal id="unknown-sheet">
210
+ const control = useBottomSheetControl('unknown-sheet');
211
+ ```
212
+
213
+ If you don't augment the registry, the `id` accepts any `string` for flexibility.
214
+
215
+ ## API Reference
216
+
217
+ ### Components
218
+
219
+ #### `BottomSheetManagerProvider`
220
+
221
+ | Prop | Type | Description |
222
+ |------|------|-------------|
223
+ | `id` | `string` | Unique identifier for this stack group |
224
+ | `scaleConfig` | `ScaleConfig` | Optional scale animation configuration |
225
+
226
+ #### `BottomSheetHost`
227
+
228
+ Renders the bottom sheet stack. Place after your app content inside `BottomSheetManagerProvider`.
229
+
230
+ #### `BottomSheetScaleView`
231
+
232
+ Wrapper that applies scale animation to its children when sheets are opened with `scaleBackground: true`.
233
+
234
+ #### `BottomSheetManaged`
235
+
236
+ Drop-in replacement for `BottomSheet` from `@gorhom/bottom-sheet`. Accepts all the same props.
237
+
238
+ #### `BottomSheetPortal`
239
+
240
+ | Prop | Type | Description |
241
+ |------|------|-------------|
242
+ | `id` | `BottomSheetPortalId` | Unique identifier for this portal sheet (type-safe if registry is augmented) |
243
+ | `children` | `ReactElement` | The bottom sheet component to render |
244
+
245
+ ### Hooks
246
+
247
+ #### `useBottomSheetManager()`
248
+
249
+ ```tsx
250
+ const {
251
+ openBottomSheet, // (content, options?) => id
252
+ close, // (id) => void
253
+ clearAll, // () => void
254
+ } = useBottomSheetManager();
255
+ ```
256
+
257
+ #### `useBottomSheetState()`
258
+
259
+ Use inside a bottom sheet component:
260
+
261
+ ```tsx
262
+ const {
263
+ bottomSheetState, // { id, status, groupId, ... }
264
+ close, // () => void
265
+ } = useBottomSheetState();
266
+ ```
267
+
268
+ #### `useBottomSheetControl(id: BottomSheetPortalId)`
269
+
270
+ Control portal-based sheets:
271
+
272
+ ```tsx
273
+ const {
274
+ open, // (options?) => void
275
+ close, // () => void
276
+ isOpen, // boolean
277
+ status, // 'opening' | 'open' | 'closing' | 'hidden' | null
278
+ } = useBottomSheetControl('my-sheet');
279
+ ```
280
+
281
+ ### Types
282
+
283
+ #### `BottomSheetPortalRegistry`
284
+
285
+ Interface to augment for type-safe portal IDs. See [Type-Safe Portal IDs](#type-safe-portal-ids).
286
+
287
+ #### `BottomSheetPortalId`
288
+
289
+ Type for portal sheet IDs. If `BottomSheetPortalRegistry` is augmented, this is a union of registered keys. Otherwise, it's `string`.
290
+
291
+ ## Example
292
+
293
+ See the [example app](./example) for a full demo including:
294
+ - Navigation flow (push, switch, replace)
295
+ - Nested scale animations
296
+ - Context preservation comparison
297
+
298
+ ## License
299
+
300
+ MIT
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","BottomSheetContext","exports","createContext","undefined","useMaybeBottomSheetContext","context","useContext"],"sourceRoot":"../../src","sources":["BottomSheet.context.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,gBAAG,IAAAE,oBAAa,EAE7CC,SAAS,CAAC;AAEL,SAASC,0BAA0BA,CAAA,EAAG;EAC3C,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACN,kBAAkB,CAAC;EAE9C,OAAOK,OAAO;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","BottomSheetContext","exports","createContext","undefined","useMaybeBottomSheetContext","context","useContext"],"sourceRoot":"../../src","sources":["BottomSheet.context.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,gBAAG,IAAAE,oBAAa,EAE7CC,SAAS,CAAC;AAEL,SAAAC,2BAAA;EACL,MAAAC,OAAA,GAAgB,IAAAC,iBAAU,EAACN,kBAAkB,CAAC;EAAC,OAExCK,OAAO;AAAA","ignoreList":[]}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BottomSheetBackdrop = BottomSheetBackdrop;
7
+ var _compilerRuntime = require("react/compiler-runtime");
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ var _animatedRegistry = require("./animatedRegistry");
11
+ var _bottomSheet = require("./bottomSheet.store");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ const AnimatedPressable = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.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
+ function BottomSheetBackdrop(t0) {
23
+ const $ = (0, _compilerRuntime.c)(8);
24
+ const {
25
+ sheetId,
26
+ onPress
27
+ } = t0;
28
+ let t1;
29
+ if ($[0] !== sheetId) {
30
+ t1 = state => state.sheetsById[sheetId]?.status;
31
+ $[0] = sheetId;
32
+ $[1] = t1;
33
+ } else {
34
+ t1 = $[1];
35
+ }
36
+ const status = (0, _bottomSheet.useBottomSheetStore)(t1);
37
+ const animatedIndex = (0, _animatedRegistry.getAnimatedIndex)(sheetId);
38
+ const isVisible = status === "opening" || status === "open";
39
+ const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
40
+ const opacity = (0, _reactNativeReanimated.interpolate)(animatedIndex.value, [-1, 0], [0, 1], _reactNativeReanimated.Extrapolation.CLAMP);
41
+ return {
42
+ opacity
43
+ };
44
+ });
45
+ let t2;
46
+ if ($[2] !== animatedStyle) {
47
+ t2 = [styles.backdrop, animatedStyle];
48
+ $[2] = animatedStyle;
49
+ $[3] = t2;
50
+ } else {
51
+ t2 = $[3];
52
+ }
53
+ const t3 = isVisible ? "auto" : "none";
54
+ let t4;
55
+ if ($[4] !== onPress || $[5] !== t2 || $[6] !== t3) {
56
+ t4 = /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedPressable, {
57
+ style: t2,
58
+ onPress: onPress,
59
+ pointerEvents: t3
60
+ });
61
+ $[4] = onPress;
62
+ $[5] = t2;
63
+ $[6] = t3;
64
+ $[7] = t4;
65
+ } else {
66
+ t4 = $[7];
67
+ }
68
+ return t4;
69
+ }
70
+ const styles = _reactNative.StyleSheet.create({
71
+ backdrop: {
72
+ ..._reactNative.StyleSheet.absoluteFillObject,
73
+ backgroundColor: 'rgba(0, 0, 0, 0.5)'
74
+ }
75
+ });
76
+ //# sourceMappingURL=BottomSheetBackdrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_reactNativeReanimated","_interopRequireWildcard","_animatedRegistry","_bottomSheet","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","AnimatedPressable","Animated","createAnimatedComponent","Pressable","BottomSheetBackdrop","t0","$","_compilerRuntime","c","sheetId","onPress","t1","state","sheetsById","status","useBottomSheetStore","animatedIndex","getAnimatedIndex","isVisible","animatedStyle","useAnimatedStyle","opacity","interpolate","value","Extrapolation","CLAMP","t2","styles","backdrop","t3","t4","jsx","style","pointerEvents","StyleSheet","create","absoluteFillObject","backgroundColor"],"sourceRoot":"../../src","sources":["BottomSheetBackdrop.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC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