@niibase/bottom-sheet-manager 1.3.0 → 1.4.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.
- package/README.md +204 -193
- package/lib/commonjs/index.js +9 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/manager.js +56 -16
- package/lib/commonjs/manager.js.map +1 -1
- package/lib/commonjs/provider.js +41 -44
- package/lib/commonjs/provider.js.map +1 -1
- package/lib/commonjs/router/index.js +37 -7
- package/lib/commonjs/router/index.js.map +1 -1
- package/lib/commonjs/router/router.js.map +1 -1
- package/lib/commonjs/router/view.js +77 -220
- package/lib/commonjs/router/view.js.map +1 -1
- package/lib/commonjs/sheet.js +61 -85
- package/lib/commonjs/sheet.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/manager.js +56 -16
- package/lib/module/manager.js.map +1 -1
- package/lib/module/provider.js +39 -42
- package/lib/module/provider.js.map +1 -1
- package/lib/module/router/index.js +39 -8
- package/lib/module/router/index.js.map +1 -1
- package/lib/module/router/router.js.map +1 -1
- package/lib/module/router/view.js +76 -220
- package/lib/module/router/view.js.map +1 -1
- package/lib/module/sheet.js +63 -87
- package/lib/module/sheet.js.map +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/manager.d.ts +16 -0
- package/lib/typescript/manager.d.ts.map +1 -1
- package/lib/typescript/provider.d.ts +10 -23
- package/lib/typescript/provider.d.ts.map +1 -1
- package/lib/typescript/router/index.d.ts +21 -7
- package/lib/typescript/router/index.d.ts.map +1 -1
- package/lib/typescript/router/router.d.ts.map +1 -1
- package/lib/typescript/router/types.d.ts +75 -61
- package/lib/typescript/router/types.d.ts.map +1 -1
- package/lib/typescript/router/view.d.ts +3 -3
- package/lib/typescript/router/view.d.ts.map +1 -1
- package/lib/typescript/sheet.d.ts +1 -1
- package/lib/typescript/sheet.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +32 -15
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +14 -15
- package/src/index.ts +7 -7
- package/src/manager.ts +66 -22
- package/src/provider.tsx +72 -53
- package/src/router/index.tsx +46 -9
- package/src/router/router.ts +6 -2
- package/src/router/types.ts +109 -91
- package/src/router/view.tsx +86 -308
- package/src/sheet.tsx +111 -123
- package/src/types.ts +146 -133
|
@@ -4,145 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BottomSheetView = BottomSheetView;
|
|
7
|
-
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
8
|
-
var _bottomSheet = require("@gorhom/bottom-sheet");
|
|
9
7
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
10
8
|
var _native = require("@react-navigation/native");
|
|
11
|
-
var _reactNative = require("react-native");
|
|
12
9
|
var React = _interopRequireWildcard(require("react"));
|
|
13
10
|
var _router = require("./router");
|
|
11
|
+
var _sheet = _interopRequireDefault(require("../sheet"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
route,
|
|
15
|
+
function BottomSheetScreen({
|
|
16
|
+
children,
|
|
19
17
|
navigation,
|
|
20
|
-
descriptor,
|
|
21
|
-
isFullScreen,
|
|
22
|
-
previousIndex,
|
|
23
|
-
defaultStyle,
|
|
24
|
-
themeBackgroundStyle,
|
|
25
|
-
themeHandleIndicatorStyle
|
|
26
|
-
}) {
|
|
27
|
-
const {
|
|
28
|
-
options,
|
|
29
|
-
render
|
|
30
|
-
} = descriptor;
|
|
31
|
-
const {
|
|
32
|
-
index = 0,
|
|
33
|
-
snapPoints = DEFAULT_SNAP_POINTS,
|
|
34
|
-
animatedIndex: defaultAnimatedIndex,
|
|
35
|
-
onAnimate,
|
|
36
|
-
handleStyle,
|
|
37
|
-
backgroundStyle,
|
|
38
|
-
handleIndicatorStyle,
|
|
39
|
-
enableDynamicSizing,
|
|
40
|
-
iosModalSheetTypeOfAnimation,
|
|
41
|
-
clickThrough,
|
|
42
|
-
style,
|
|
43
|
-
...sheetProps
|
|
44
|
-
} = options;
|
|
45
|
-
|
|
46
|
-
// Calculate safe index
|
|
47
|
-
const safeIndex = Math.min(route.snapToIndex ?? index, snapPoints.length - 1);
|
|
48
|
-
|
|
49
|
-
// Create animatedIndex for this sheet
|
|
50
|
-
const animatedIndex = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
51
|
-
|
|
52
|
-
// Use animated reaction to watch animatedIndex and update isFullScreen reactively
|
|
53
|
-
(0, _reactNativeReanimated.useAnimatedReaction)(() => animatedIndex.value, index => {
|
|
54
|
-
"worklet";
|
|
55
|
-
|
|
56
|
-
if (defaultAnimatedIndex) {
|
|
57
|
-
defaultAnimatedIndex.set(index);
|
|
58
|
-
}
|
|
59
|
-
if (!iosModalSheetTypeOfAnimation) {
|
|
60
|
-
if (isFullScreen.value > 0) isFullScreen.set(0);
|
|
61
|
-
previousIndex.set(index);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (isFullScreen.value < 0) {
|
|
65
|
-
isFullScreen.set(0);
|
|
66
|
-
}
|
|
67
|
-
const isClosing = index < 0 || previousIndex.value >= 0 && index < previousIndex.value - 0.05;
|
|
68
|
-
previousIndex.set(index);
|
|
69
|
-
if (isClosing) {
|
|
70
|
-
if (isFullScreen.value > 0.01) {
|
|
71
|
-
isFullScreen.set((0, _reactNativeReanimated.withTiming)(0, {
|
|
72
|
-
duration: 150 * 0.85,
|
|
73
|
-
easing: _reactNativeReanimated.Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const points = ["%90", "90%"];
|
|
79
|
-
const fullScreenIndex = snapPoints.findIndex(p => points.includes(p));
|
|
80
|
-
if (index >= fullScreenIndex - 0.5 && index <= fullScreenIndex + 0.5) {
|
|
81
|
-
isFullScreen.set(1);
|
|
82
|
-
} else if (index >= 0) {
|
|
83
|
-
isFullScreen.set(0);
|
|
84
|
-
}
|
|
85
|
-
}, [snapPoints, iosModalSheetTypeOfAnimation]);
|
|
86
|
-
return /*#__PURE__*/React.createElement(BottomSheetModalScreen, _extends({
|
|
87
|
-
route: route,
|
|
88
|
-
navigation: navigation,
|
|
89
|
-
index: safeIndex,
|
|
90
|
-
snapPoints: enableDynamicSizing ? undefined : snapPoints,
|
|
91
|
-
enableDynamicSizing: enableDynamicSizing,
|
|
92
|
-
animatedIndex: animatedIndex,
|
|
93
|
-
clickThrough: clickThrough,
|
|
94
|
-
animationConfigs: {
|
|
95
|
-
duration: 300,
|
|
96
|
-
easing: _reactNativeReanimated.Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
97
|
-
},
|
|
98
|
-
onAnimate: (from, to, ...args) => {
|
|
99
|
-
if (to >= isFullScreen.value && to > snapPoints.length - 1) {
|
|
100
|
-
isFullScreen.set(0);
|
|
101
|
-
} else if (to > 0 && to === previousIndex.value && isFullScreen.value === 0) {
|
|
102
|
-
isFullScreen.set(1);
|
|
103
|
-
}
|
|
104
|
-
onAnimate?.(from, to, ...args);
|
|
105
|
-
},
|
|
106
|
-
topInset: 0,
|
|
107
|
-
bottomInset: 0,
|
|
108
|
-
style: [defaultStyle, style],
|
|
109
|
-
backgroundStyle: [themeBackgroundStyle, backgroundStyle],
|
|
110
|
-
handleIndicatorStyle: [themeHandleIndicatorStyle, handleIndicatorStyle],
|
|
111
|
-
handleStyle: [themeBackgroundStyle, {
|
|
112
|
-
borderRadius: 24
|
|
113
|
-
}, handleStyle]
|
|
114
|
-
}, sheetProps), render?.());
|
|
115
|
-
}
|
|
116
|
-
function BottomSheetModalScreen({
|
|
117
18
|
route,
|
|
118
|
-
navigation,
|
|
119
|
-
clickThrough,
|
|
120
|
-
opacity,
|
|
121
|
-
animatedIndex,
|
|
122
|
-
onChange,
|
|
123
|
-
children,
|
|
124
19
|
...props
|
|
125
20
|
}) {
|
|
126
21
|
const ref = React.useRef(null);
|
|
127
22
|
const lastSnapIndexRef = React.useRef(route.snapToIndex ?? props.index ?? 0);
|
|
128
23
|
|
|
129
|
-
// Present on mount.
|
|
130
|
-
React.useEffect(() => {
|
|
131
|
-
ref.current?.present();
|
|
132
|
-
}, []);
|
|
133
|
-
|
|
134
|
-
// Track mount state to avoid dismissing on unmount
|
|
135
|
-
const isMounted = React.useRef(true);
|
|
136
|
-
React.useEffect(() => {
|
|
137
|
-
return () => {
|
|
138
|
-
isMounted.current = false;
|
|
139
|
-
};
|
|
140
|
-
}, []);
|
|
141
|
-
|
|
142
24
|
// Handle route closing state
|
|
143
25
|
React.useEffect(() => {
|
|
144
26
|
if (route.closing) {
|
|
145
|
-
ref.current?.
|
|
27
|
+
ref.current?.close();
|
|
146
28
|
}
|
|
147
29
|
}, [route.closing]);
|
|
148
30
|
|
|
@@ -153,36 +35,26 @@ function BottomSheetModalScreen({
|
|
|
153
35
|
lastSnapIndexRef.current = route.snapToIndex;
|
|
154
36
|
}
|
|
155
37
|
}, [route.snapToIndex, route.snapToKey]);
|
|
156
|
-
const handleChange = React.useCallback(newIndex => {
|
|
38
|
+
const handleChange = React.useCallback((newIndex, position, type) => {
|
|
39
|
+
navigation.emit({
|
|
40
|
+
type: "sheetOnChange",
|
|
41
|
+
target: route.key,
|
|
42
|
+
data: {
|
|
43
|
+
index: newIndex,
|
|
44
|
+
position,
|
|
45
|
+
type
|
|
46
|
+
}
|
|
47
|
+
});
|
|
157
48
|
const currentIndex = lastSnapIndexRef.current;
|
|
158
49
|
lastSnapIndexRef.current = newIndex;
|
|
159
50
|
if (newIndex >= 0 && newIndex !== currentIndex) {
|
|
160
51
|
navigation.dispatch(_router.BottomSheetActions.snapTo(newIndex));
|
|
161
52
|
}
|
|
162
53
|
}, [navigation]);
|
|
163
|
-
|
|
164
|
-
// BottomSheetModal will call onDismiss on unmount, but we don't want that
|
|
165
|
-
// since we handle navigation state separately
|
|
166
|
-
if (isMounted.current) {
|
|
167
|
-
navigation.dispatch({
|
|
168
|
-
..._router.BottomSheetActions.remove(),
|
|
169
|
-
source: route.key
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}, [navigation, route.key]);
|
|
173
|
-
return /*#__PURE__*/React.createElement(_bottomSheet.BottomSheetModal, _extends({}, props, {
|
|
54
|
+
return /*#__PURE__*/React.createElement(_sheet.default, _extends({
|
|
174
55
|
ref: ref,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
animatedIndex: animatedIndex,
|
|
178
|
-
index: props.index,
|
|
179
|
-
backdropComponent: backdropProps => /*#__PURE__*/React.createElement(_bottomSheet.BottomSheetBackdrop, _extends({}, backdropProps, {
|
|
180
|
-
appearsOnIndex: 0,
|
|
181
|
-
disappearsOnIndex: -1,
|
|
182
|
-
enableTouchThrough: !!clickThrough,
|
|
183
|
-
opacity: opacity ?? 0.45
|
|
184
|
-
}))
|
|
185
|
-
}), children);
|
|
56
|
+
onChange: handleChange
|
|
57
|
+
}, props), children);
|
|
186
58
|
}
|
|
187
59
|
function BottomSheetView({
|
|
188
60
|
state,
|
|
@@ -193,98 +65,83 @@ function BottomSheetView({
|
|
|
193
65
|
colors
|
|
194
66
|
} = (0, _native.useTheme)();
|
|
195
67
|
const {
|
|
196
|
-
top,
|
|
197
68
|
bottom,
|
|
198
69
|
left,
|
|
199
70
|
right
|
|
200
71
|
} = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
201
72
|
const themeBackgroundStyle = React.useMemo(() => ({
|
|
202
73
|
borderCurve: "continuous",
|
|
203
|
-
backgroundColor: colors.card
|
|
204
|
-
borderTopLeftRadius: 20,
|
|
205
|
-
borderTopRightRadius: 20
|
|
74
|
+
backgroundColor: colors.card
|
|
206
75
|
}), [colors.card]);
|
|
207
76
|
const themeHandleIndicatorStyle = React.useMemo(() => ({
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
width: 50
|
|
77
|
+
borderCurve: "continuous",
|
|
78
|
+
backgroundColor: colors.border
|
|
211
79
|
}), [colors.border]);
|
|
212
80
|
const defaultStyle = React.useMemo(() => ({
|
|
213
81
|
paddingBottom: bottom,
|
|
214
82
|
paddingLeft: left,
|
|
215
83
|
paddingRight: right
|
|
216
84
|
}), [bottom, left, right]);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const previousIndex = (0, _reactNativeReanimated.useSharedValue)(-1);
|
|
221
|
-
const colorStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
222
|
-
flex: 1,
|
|
223
|
-
backgroundColor: (0, _reactNativeReanimated.withSpring)((0, _reactNativeReanimated.interpolateColor)(isFullScreen.value, [0, 1], ["transparent", "#000"]), {
|
|
224
|
-
duration: 150
|
|
225
|
-
})
|
|
226
|
-
}));
|
|
227
|
-
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
228
|
-
flex: 1,
|
|
229
|
-
overflow: "hidden",
|
|
230
|
-
borderRadius: (0, _reactNativeReanimated.interpolate)(isFullScreen.value, [0, 0.8, 1], [0, 20, 24], "clamp"),
|
|
231
|
-
transform: [{
|
|
232
|
-
scaleX: (0, _reactNativeReanimated.withSpring)((0, _reactNativeReanimated.interpolate)(isFullScreen.value, [0, 0.8], [1, 0.92], "clamp"), {
|
|
233
|
-
duration: 150
|
|
234
|
-
})
|
|
235
|
-
}, {
|
|
236
|
-
translateY: (0, _reactNativeReanimated.withSpring)((0, _reactNativeReanimated.interpolate)(isFullScreen.value, [0, 0.8, 1], [0, top, top + 5], "clamp"), {
|
|
237
|
-
duration: 150,
|
|
238
|
-
dampingRatio: 1.5
|
|
239
|
-
})
|
|
240
|
-
}]
|
|
241
|
-
}), [top]);
|
|
242
|
-
|
|
243
|
-
// Since background color is white, we need to set status bar to light
|
|
244
|
-
const setStatusBar = _reactNative.StatusBar.setBarStyle;
|
|
245
|
-
(0, _reactNativeReanimated.useAnimatedReaction)(() => isFullScreen.value, currentValue => {
|
|
246
|
-
"worklet";
|
|
247
|
-
|
|
248
|
-
if (currentValue > -1) {
|
|
249
|
-
(0, _reactNativeReanimated.runOnJS)(setStatusBar)(currentValue >= 0.5 ? "light-content" : "default");
|
|
250
|
-
}
|
|
251
|
-
}, []);
|
|
252
|
-
|
|
253
|
-
// Get the base (first) route - this is the main content
|
|
254
|
-
const baseRoute = state.routes[0];
|
|
255
|
-
if (!baseRoute) {
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
const baseDescriptor = descriptors[baseRoute.key];
|
|
259
|
-
if (!baseDescriptor) {
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// Sheet routes are all routes after the base route
|
|
264
|
-
const sheetRoutes = state.routes.slice(1);
|
|
265
|
-
const hasSheets = sheetRoutes.length > 0;
|
|
266
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, {
|
|
267
|
-
style: colorStyle
|
|
268
|
-
}, /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, {
|
|
269
|
-
style: animatedStyle
|
|
270
|
-
}, baseDescriptor.render?.())), hasSheets && /*#__PURE__*/React.createElement(_bottomSheet.BottomSheetModalProvider, null, sheetRoutes.map(route => {
|
|
271
|
-
// Skip routes that are being removed
|
|
272
|
-
if (route.closing && !descriptors[route.key]) {
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
85
|
+
const [baseRoute, ...sheetRoutes] = state.routes;
|
|
86
|
+
const baseDescriptor = baseRoute ? descriptors[baseRoute.key] : null;
|
|
87
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, baseDescriptor?.render(), sheetRoutes.map(route => {
|
|
275
88
|
const descriptor = descriptors[route.key];
|
|
276
89
|
if (!descriptor) return null;
|
|
277
|
-
|
|
90
|
+
const {
|
|
91
|
+
options,
|
|
92
|
+
render
|
|
93
|
+
} = descriptor;
|
|
94
|
+
const {
|
|
95
|
+
index = 0,
|
|
96
|
+
style,
|
|
97
|
+
backgroundStyle,
|
|
98
|
+
handleIndicatorStyle,
|
|
99
|
+
handleStyle,
|
|
100
|
+
...props
|
|
101
|
+
} = options;
|
|
102
|
+
return /*#__PURE__*/React.createElement(BottomSheetScreen, _extends({
|
|
278
103
|
key: route.key,
|
|
104
|
+
id: route.key,
|
|
279
105
|
route: route,
|
|
106
|
+
index: index,
|
|
280
107
|
navigation: navigation,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
108
|
+
style: [defaultStyle, style],
|
|
109
|
+
backgroundStyle: [themeBackgroundStyle, backgroundStyle],
|
|
110
|
+
handleIndicatorStyle: [themeHandleIndicatorStyle, handleIndicatorStyle],
|
|
111
|
+
handleStyle: [themeBackgroundStyle, {
|
|
112
|
+
borderRadius: 24
|
|
113
|
+
}, handleStyle],
|
|
114
|
+
onClose: data => {
|
|
115
|
+
navigation.dispatch({
|
|
116
|
+
..._router.BottomSheetActions.remove(),
|
|
117
|
+
source: route.key
|
|
118
|
+
});
|
|
119
|
+
navigation.emit({
|
|
120
|
+
type: "sheetDismiss",
|
|
121
|
+
target: route.key,
|
|
122
|
+
data
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
onBeforeShow: data => {
|
|
126
|
+
navigation.emit({
|
|
127
|
+
type: "sheetPresent",
|
|
128
|
+
target: route.key,
|
|
129
|
+
data
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
onAnimate: (fromIndex, toIndex, fromPosition, toPosition) => {
|
|
133
|
+
navigation.emit({
|
|
134
|
+
type: "sheetOnAnimate",
|
|
135
|
+
target: route.key,
|
|
136
|
+
data: {
|
|
137
|
+
fromIndex,
|
|
138
|
+
toIndex,
|
|
139
|
+
fromPosition,
|
|
140
|
+
toPosition
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}, props), render());
|
|
145
|
+
}));
|
|
289
146
|
}
|
|
290
147
|
//# sourceMappingURL=view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeReanimated","_interopRequireWildcard","require","_bottomSheet","_reactNativeSafeAreaContext","_native","_reactNative","React","_router","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","DEFAULT_SNAP_POINTS","AnimatedSheetWrapper","route","navigation","descriptor","isFullScreen","previousIndex","defaultStyle","themeBackgroundStyle","themeHandleIndicatorStyle","options","render","index","snapPoints","animatedIndex","defaultAnimatedIndex","onAnimate","handleStyle","backgroundStyle","handleIndicatorStyle","enableDynamicSizing","iosModalSheetTypeOfAnimation","clickThrough","style","sheetProps","safeIndex","Math","min","snapToIndex","useSharedValue","useAnimatedReaction","value","isClosing","withTiming","duration","easing","Easing","bezier","points","fullScreenIndex","findIndex","p","includes","createElement","BottomSheetModalScreen","undefined","animationConfigs","from","to","args","topInset","bottomInset","borderRadius","opacity","onChange","children","props","ref","useRef","lastSnapIndexRef","useEffect","current","present","isMounted","closing","dismiss","snapToKey","handleChange","useCallback","newIndex","currentIndex","dispatch","BottomSheetActions","snapTo","handleDismiss","remove","source","key","BottomSheetModal","onDismiss","backdropComponent","backdropProps","BottomSheetBackdrop","appearsOnIndex","disappearsOnIndex","enableTouchThrough","BottomSheetView","state","descriptors","colors","useTheme","top","bottom","left","right","useSafeAreaInsets","useMemo","borderCurve","backgroundColor","card","borderTopLeftRadius","borderTopRightRadius","border","height","width","paddingBottom","paddingLeft","paddingRight","colorStyle","useAnimatedStyle","flex","withSpring","interpolateColor","animatedStyle","overflow","interpolate","transform","scaleX","translateY","dampingRatio","setStatusBar","StatusBar","setBarStyle","currentValue","runOnJS","baseRoute","routes","baseDescriptor","sheetRoutes","slice","hasSheets","Fragment","View","BottomSheetModalProvider","map"],"sourceRoot":"../../../src","sources":["router/view.tsx"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAYA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAN,uBAAA,CAAAC,OAAA;AAWA,IAAAM,OAAA,GAAAN,OAAA;AAA8C,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,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AQ,CAACmJ,IAAI;IAAC7G,KAAK,EAAEqF;EAAW,gBAC/BvI,KAAA,CAAAsE,aAAA,CAAC7E,sBAAA,CAAAmB,OAAQ,CAACmJ,IAAI;IAAC7G,KAAK,EAAE0F;EAAc,GAAEc,cAAc,CAACpH,MAAM,GAAG,CAAiB,CAClE,CAAC,EAGfuH,SAAS,iBACR7J,KAAA,CAAAsE,aAAA,CAAC1E,YAAA,CAAAoK,wBAAwB,QACtBL,WAAW,CAACM,GAAG,CAAEpI,KAAK,IAAK;IAC1B;IACA,IAAIA,KAAK,CAAC8D,OAAO,IAAI,CAACwB,WAAW,CAACtF,KAAK,CAAC2E,GAAG,CAAC,EAAE;MAC5C,OAAO,IAAI;IACb;IAEA,MAAMzE,UAAU,GAAGoF,WAAW,CAACtF,KAAK,CAAC2E,GAAG,CAAC;IACzC,IAAI,CAACzE,UAAU,EAAE,OAAO,IAAI;IAE5B,oBACE/B,KAAA,CAAAsE,aAAA,CAAC1C,oBAAoB;MACnB4E,GAAG,EAAE3E,KAAK,CAAC2E,GAAI;MACf3E,KAAK,EAAEA,KAAM;MACbC,UAAU,EAAEA,UAAW;MACvBC,UAAU,EAAEA,UAAW;MACvBC,YAAY,EAAEA,YAAa;MAC3BC,aAAa,EAAEA,aAAc;MAC7BC,YAAY,EAAEA,YAAa;MAC3BC,oBAAoB,EAAEA,oBAAqB;MAC3CC,yBAAyB,EAAEA;IAA0B,CACtD,CAAC;EAEN,CAAC,CACuB,CAE5B,CAAC;AAEP","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNativeSafeAreaContext","require","_native","React","_interopRequireWildcard","_router","_sheet","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","BottomSheetScreen","children","navigation","route","props","ref","useRef","lastSnapIndexRef","snapToIndex","index","useEffect","closing","current","close","snapToKey","handleChange","useCallback","newIndex","position","type","emit","target","key","data","currentIndex","dispatch","BottomSheetActions","snapTo","createElement","onChange","BottomSheetView","state","descriptors","colors","useTheme","bottom","left","right","useSafeAreaInsets","themeBackgroundStyle","useMemo","borderCurve","backgroundColor","card","themeHandleIndicatorStyle","border","defaultStyle","paddingBottom","paddingLeft","paddingRight","baseRoute","sheetRoutes","routes","baseDescriptor","Fragment","render","map","descriptor","options","style","backgroundStyle","handleIndicatorStyle","handleStyle","id","borderRadius","onClose","remove","source","onBeforeShow","onAnimate","fromIndex","toIndex","fromPosition","toPosition"],"sourceRoot":"../../../src","sources":["router/view.tsx"],"mappings":";;;;;;AAAA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAC,uBAAA,CAAAH,OAAA;AASA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AAAmC,SAAAM,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAI,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAA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M,EAAElB,KAAK,CAACmB,GAAG;UACjBC,IAAI,EAAE;YAAE+C,SAAS;YAAEC,OAAO;YAAEC,YAAY;YAAEC;UAAW;QACvD,CAAC,CAAC;MACJ;IAAE,GACErE,KAAK,GAERmD,MAAM,CAAC,CACS,CAAC;EAExB,CAAC,CACD,CAAC;AAEP","ignoreList":[]}
|
package/lib/commonjs/sheet.js
CHANGED
|
@@ -8,7 +8,6 @@ var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _reactNativeReanimated = require("react-native-reanimated");
|
|
10
10
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
11
|
-
var _native = require("@react-navigation/native");
|
|
12
11
|
var _react = _interopRequireDefault(require("react"));
|
|
13
12
|
var _provider = require("./provider");
|
|
14
13
|
var _manager = require("./manager");
|
|
@@ -16,6 +15,7 @@ var _events = require("./events");
|
|
|
16
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
17
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
|
+
const FULL_SCREEN_POINTS = _reactNative.Platform.OS === "ios" ? ["%90", "90%"] : ["%93", "93%"];
|
|
19
19
|
const useSheetManager = ({
|
|
20
20
|
id,
|
|
21
21
|
onHide,
|
|
@@ -46,69 +46,64 @@ const useSheetManager = ({
|
|
|
46
46
|
};
|
|
47
47
|
const BottomSheetComponent = /*#__PURE__*/_react.default.forwardRef(({
|
|
48
48
|
children,
|
|
49
|
-
snapPoints,
|
|
50
49
|
onClose,
|
|
51
50
|
onBeforeShow,
|
|
52
51
|
stackBehavior = "switch",
|
|
53
52
|
hardwareBackPressToClose = true,
|
|
54
53
|
enableDynamicSizing = false,
|
|
55
54
|
handleIndicatorStyle,
|
|
56
|
-
iosModalSheetTypeOfAnimation
|
|
55
|
+
iosModalSheetTypeOfAnimation,
|
|
56
|
+
snapPoints: defaultSnapPoints,
|
|
57
57
|
animatedIndex: defaultAnimatedIndex,
|
|
58
58
|
backgroundStyle,
|
|
59
59
|
onAnimate,
|
|
60
60
|
handleStyle,
|
|
61
61
|
style,
|
|
62
|
-
|
|
62
|
+
passThrough,
|
|
63
63
|
opacity,
|
|
64
64
|
...props
|
|
65
65
|
}, ref) => {
|
|
66
66
|
const currentSheetRef = (0, _provider.useSheetRef)();
|
|
67
67
|
const currentCtx = (0, _provider.useProviderContext)();
|
|
68
68
|
const stackContext = (0, _provider.useStackBehaviorContext)();
|
|
69
|
-
const {
|
|
70
|
-
isFullScreen,
|
|
71
|
-
iosModalSheetTypeOfAnimation,
|
|
72
|
-
duration
|
|
73
|
-
} = (0, _provider.useSheetAnimationContext)();
|
|
74
69
|
const animatedIndex = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
75
|
-
const previousIndex = (0, _reactNativeReanimated.useSharedValue)(-1);
|
|
76
70
|
const [currentStackBehavior, setCurrentStackBehavior] = _react.default.useState(stackBehavior);
|
|
77
71
|
const isPushed = currentStackBehavior === "push";
|
|
78
|
-
const {
|
|
79
|
-
colors
|
|
80
|
-
} = (0, _native.useTheme)();
|
|
81
72
|
const {
|
|
82
73
|
bottom,
|
|
83
74
|
left,
|
|
84
75
|
right
|
|
85
76
|
} = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
86
|
-
const themeBackgroundStyle = _react.default.useMemo(() => ({
|
|
87
|
-
borderCurve: "continuous",
|
|
88
|
-
backgroundColor: colors.card,
|
|
89
|
-
borderTopLeftRadius: 20,
|
|
90
|
-
borderTopRightRadius: 20
|
|
91
|
-
}), [colors.card]);
|
|
92
|
-
const themeHandleIndicatorStyle = _react.default.useMemo(() => ({
|
|
93
|
-
backgroundColor: colors.border,
|
|
94
|
-
height: 5,
|
|
95
|
-
width: 50
|
|
96
|
-
}), [colors.border]);
|
|
97
77
|
const defaultStyle = _react.default.useMemo(() => ({
|
|
98
78
|
paddingBottom: bottom,
|
|
99
79
|
paddingLeft: left,
|
|
100
80
|
paddingRight: right
|
|
101
81
|
}), [bottom, left, right]);
|
|
82
|
+
const {
|
|
83
|
+
isFullScreen
|
|
84
|
+
} = (0, _provider.useSheetSharedContext)();
|
|
85
|
+
const [snapPoints, fullScreenIndex] = _react.default.useMemo(() => {
|
|
86
|
+
let resolved = defaultSnapPoints;
|
|
87
|
+
if (_reactNative.Platform.OS === "android" && iosModalSheetTypeOfAnimation && Array.isArray(resolved)) {
|
|
88
|
+
resolved = resolved.map(p => p === "90%" || p === "%90" ? "93%" : p);
|
|
89
|
+
}
|
|
90
|
+
const fullScreenIndex = resolved instanceof Array ? resolved.findIndex(p => FULL_SCREEN_POINTS.includes(p)) : resolved?.value?.findIndex(p => FULL_SCREEN_POINTS.includes(p)) || -1;
|
|
91
|
+
return [resolved, fullScreenIndex];
|
|
92
|
+
}, [defaultSnapPoints, iosModalSheetTypeOfAnimation]);
|
|
102
93
|
const valueRef = _react.default.useRef(null);
|
|
103
94
|
const bottomSheetRef = _react.default.useRef(null);
|
|
104
95
|
const hardwareBackPressEvent = _react.default.useRef(null);
|
|
105
96
|
const id = (0, _provider.useSheetIDContext)();
|
|
106
97
|
const sheetId = props.id || id;
|
|
98
|
+
const hideSheetRef = _react.default.useRef(null);
|
|
107
99
|
useSheetManager({
|
|
108
100
|
id: sheetId,
|
|
109
101
|
onHide: (data, dismiss, behavior) => {
|
|
102
|
+
// Update state for future renders, but also pass behavior directly
|
|
103
|
+
// so hideSheet doesn't read a stale closure value (React state update
|
|
104
|
+
// is async — hideSheet runs before the re-render).
|
|
110
105
|
if (behavior) setCurrentStackBehavior(behavior);
|
|
111
|
-
|
|
106
|
+
hideSheetRef.current(data, true, dismiss, behavior);
|
|
112
107
|
},
|
|
113
108
|
onBeforeShow: (data, behavior) => {
|
|
114
109
|
if (behavior) setCurrentStackBehavior(behavior);
|
|
@@ -127,68 +122,61 @@ const BottomSheetComponent = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
127
122
|
});
|
|
128
123
|
(0, _reactNativeReanimated.useAnimatedReaction)(() => animatedIndex.value, index => {
|
|
129
124
|
"worklet";
|
|
125
|
+
|
|
130
126
|
if (defaultAnimatedIndex) {
|
|
131
127
|
defaultAnimatedIndex.set(index);
|
|
132
128
|
}
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
previousIndex.set(index);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (isFullScreen.value < 0) {
|
|
139
|
-
isFullScreen.set(0);
|
|
129
|
+
if (iosModalSheetTypeOfAnimation) {
|
|
130
|
+
isFullScreen.set((0, _reactNativeReanimated.interpolate)(index, [fullScreenIndex - 1, fullScreenIndex, fullScreenIndex + 1], [0, 1, 0]));
|
|
140
131
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
easing: _reactNativeReanimated.Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const points = ["%90", "90%"];
|
|
153
|
-
const fullScreenIndex = snapPoints instanceof Array ? snapPoints.findIndex(p => points.includes(p)) : snapPoints?.value?.findIndex(p => points.includes(p)) || -1;
|
|
154
|
-
if (index >= fullScreenIndex - 0.5 && index <= fullScreenIndex + 0.5) {
|
|
155
|
-
isFullScreen.set(1);
|
|
156
|
-
} else if (index >= 0) {
|
|
157
|
-
isFullScreen.set(0);
|
|
158
|
-
}
|
|
159
|
-
}, [snapPoints, iosModalSheetTypeOfAnimation, pageAnimation, duration]);
|
|
160
|
-
const hideSheet = _react.default.useCallback((data, fromManager, dismiss) => {
|
|
132
|
+
}, [iosModalSheetTypeOfAnimation]);
|
|
133
|
+
const hideSheet = _react.default.useCallback((data, fromManager, dismiss, incomingBehavior) => {
|
|
134
|
+
// Use the freshly-delivered behavior from the event when available.
|
|
135
|
+
// currentStackBehavior comes from React state which may not have flushed
|
|
136
|
+
// yet when this callback fires synchronously from the manager.
|
|
137
|
+
const activeBehavior = incomingBehavior ?? currentStackBehavior;
|
|
161
138
|
let value = data ?? valueRef.current;
|
|
162
139
|
hardwareBackPressEvent.current?.remove();
|
|
163
140
|
const closeValue = onClose?.(value);
|
|
164
141
|
if (closeValue !== undefined) value = closeValue;
|
|
165
|
-
if (dismiss &&
|
|
142
|
+
if (dismiss && activeBehavior === "push") {
|
|
143
|
+
// For push behavior, a "dismiss" event means another sheet wants to
|
|
144
|
+
// appear on top — do not close this sheet.
|
|
166
145
|
if (fromManager) valueRef.current = data;
|
|
167
146
|
return;
|
|
168
147
|
}
|
|
169
|
-
if (
|
|
148
|
+
if (activeBehavior !== "replace" || !dismiss) {
|
|
170
149
|
bottomSheetRef.current?.close();
|
|
171
150
|
}
|
|
172
151
|
if (sheetId) {
|
|
173
152
|
const hasHistory = _manager.PrivateManager.history.length > 0;
|
|
174
|
-
const shouldRestorePrevious =
|
|
175
|
-
_events.eventManager.publish(`onclose_${sheetId}`, value, currentCtx, hasHistory || !!dismiss,
|
|
153
|
+
const shouldRestorePrevious = activeBehavior !== "replace";
|
|
154
|
+
_events.eventManager.publish(`onclose_${sheetId}`, value, currentCtx, hasHistory || !!dismiss, activeBehavior);
|
|
176
155
|
if (shouldRestorePrevious) {
|
|
177
156
|
if (dismiss) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
157
|
+
// it will surface naturally when the push sheet is closed.
|
|
158
|
+
if (activeBehavior !== "push") {
|
|
159
|
+
_manager.PrivateManager.history.push({
|
|
160
|
+
id: sheetId,
|
|
161
|
+
context: currentCtx,
|
|
162
|
+
behavior: activeBehavior
|
|
163
|
+
});
|
|
164
|
+
}
|
|
183
165
|
} else if (hasHistory) {
|
|
184
|
-
const
|
|
185
|
-
|
|
166
|
+
const otherSheetsStillOpen = _manager.PrivateManager.stack().some(s => !(s.id === sheetId && s.context === currentCtx));
|
|
167
|
+
if (!otherSheetsStillOpen) {
|
|
168
|
+
const prev = _manager.PrivateManager.history.pop();
|
|
169
|
+
_events.eventManager.publish(`show_wrap_${prev.id}`, undefined, prev.context, true, prev.behavior);
|
|
170
|
+
}
|
|
186
171
|
}
|
|
187
172
|
}
|
|
188
173
|
_manager.PrivateManager.remove(sheetId, currentCtx);
|
|
189
174
|
}
|
|
190
175
|
if (fromManager) valueRef.current = data;
|
|
191
176
|
}, [sheetId, currentCtx, onClose, currentStackBehavior]);
|
|
177
|
+
_react.default.useEffect(() => {
|
|
178
|
+
hideSheetRef.current = hideSheet;
|
|
179
|
+
}, [hideSheet]);
|
|
192
180
|
const getInstance = _react.default.useCallback(() => ({
|
|
193
181
|
close(options = {}) {
|
|
194
182
|
valueRef.current = options.value;
|
|
@@ -218,20 +206,16 @@ const BottomSheetComponent = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
218
206
|
_react.default.useEffect(() => {
|
|
219
207
|
if (_reactNative.Platform.OS === "android" && hardwareBackPressToClose) {
|
|
220
208
|
hardwareBackPressEvent.current = _reactNative.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
221
|
-
|
|
209
|
+
// Go through hideSheet so internal state (PrivateManager, events,
|
|
210
|
+
// history) is updated correctly — not just the visual sheet.
|
|
211
|
+
hideSheetRef.current(undefined, true, false);
|
|
222
212
|
return true;
|
|
223
213
|
});
|
|
224
214
|
}
|
|
225
215
|
return () => hardwareBackPressEvent.current?.remove();
|
|
226
216
|
}, [hardwareBackPressToClose]);
|
|
227
217
|
_react.default.useImperativeHandle(ref, getInstance, [getInstance]);
|
|
228
|
-
const zIndex = _react.default.useMemo(() =>
|
|
229
|
-
if (!sheetId) return 0;
|
|
230
|
-
if (isPushed) {
|
|
231
|
-
return _manager.PrivateManager.zIndex(sheetId, currentCtx);
|
|
232
|
-
}
|
|
233
|
-
return 0;
|
|
234
|
-
}, [sheetId, isPushed, currentCtx]);
|
|
218
|
+
const zIndex = _react.default.useMemo(() => isPushed && sheetId ? _manager.PrivateManager.zIndex(sheetId, currentCtx) : 0, [sheetId, isPushed, currentCtx]);
|
|
235
219
|
const backdropOpacity = _react.default.useMemo(() => {
|
|
236
220
|
if (isPushed && stackContext.previousSheetId) {
|
|
237
221
|
return (opacity || 0.45) * 0.6;
|
|
@@ -246,31 +230,23 @@ const BottomSheetComponent = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
246
230
|
}, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, _extends({
|
|
247
231
|
enableDynamicSizing: enableDynamicSizing,
|
|
248
232
|
backdropComponent: backdropProps => /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetBackdrop, _extends({
|
|
249
|
-
enableTouchThrough: !!
|
|
233
|
+
enableTouchThrough: !!passThrough,
|
|
250
234
|
opacity: backdropOpacity,
|
|
251
235
|
disappearsOnIndex: -1,
|
|
252
236
|
appearsOnIndex: 0
|
|
253
237
|
}, backdropProps)),
|
|
254
|
-
onAnimate: (from, to, ...args) => {
|
|
255
|
-
const snapPointLen = Array.isArray(snapPoints) ? snapPoints.length : snapPoints?.value?.length ?? 0;
|
|
256
|
-
if (to >= isFullScreen.value && to > snapPointLen - 1) {
|
|
257
|
-
isFullScreen.set(0);
|
|
258
|
-
} else if (to > 0 && to === previousIndex.value && isFullScreen.value === 0) {
|
|
259
|
-
isFullScreen.set(1);
|
|
260
|
-
}
|
|
261
|
-
onAnimate?.(from, to, ...args);
|
|
262
|
-
},
|
|
263
238
|
topInset: 0,
|
|
264
239
|
bottomInset: 0
|
|
265
240
|
}, props, {
|
|
266
241
|
ref: bottomSheetRef,
|
|
267
242
|
onClose: hideSheet,
|
|
243
|
+
onAnimate: onAnimate,
|
|
268
244
|
animatedIndex: animatedIndex,
|
|
269
245
|
style: [defaultStyle, style],
|
|
270
|
-
snapPoints: enableDynamicSizing ? undefined : snapPoints
|
|
271
|
-
handleIndicatorStyle:
|
|
272
|
-
backgroundStyle:
|
|
273
|
-
handleStyle:
|
|
246
|
+
snapPoints: enableDynamicSizing ? undefined : snapPoints,
|
|
247
|
+
handleIndicatorStyle: handleIndicatorStyle,
|
|
248
|
+
backgroundStyle: backgroundStyle,
|
|
249
|
+
handleStyle: handleStyle
|
|
274
250
|
}), children));
|
|
275
251
|
});
|
|
276
252
|
const BottomSheet = /*#__PURE__*/_react.default.memo(BottomSheetComponent);
|