@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
|
@@ -1,141 +1,22 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
import Animated, { Easing, interpolate, interpolateColor, runOnJS, useAnimatedReaction, useAnimatedStyle, useSharedValue, withSpring, withTiming } from "react-native-reanimated";
|
|
3
|
-
import { BottomSheetBackdrop, BottomSheetModal, BottomSheetModalProvider } from "@gorhom/bottom-sheet";
|
|
4
2
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
3
|
import { useTheme } from "@react-navigation/native";
|
|
6
|
-
import { StatusBar } from "react-native";
|
|
7
4
|
import * as React from "react";
|
|
8
5
|
import { BottomSheetActions } from "./router";
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
6
|
+
import BottomSheet from "../sheet";
|
|
7
|
+
function BottomSheetScreen({
|
|
8
|
+
children,
|
|
12
9
|
navigation,
|
|
13
|
-
descriptor,
|
|
14
|
-
isFullScreen,
|
|
15
|
-
previousIndex,
|
|
16
|
-
defaultStyle,
|
|
17
|
-
themeBackgroundStyle,
|
|
18
|
-
themeHandleIndicatorStyle
|
|
19
|
-
}) {
|
|
20
|
-
const {
|
|
21
|
-
options,
|
|
22
|
-
render
|
|
23
|
-
} = descriptor;
|
|
24
|
-
const {
|
|
25
|
-
index = 0,
|
|
26
|
-
snapPoints = DEFAULT_SNAP_POINTS,
|
|
27
|
-
animatedIndex: defaultAnimatedIndex,
|
|
28
|
-
onAnimate,
|
|
29
|
-
handleStyle,
|
|
30
|
-
backgroundStyle,
|
|
31
|
-
handleIndicatorStyle,
|
|
32
|
-
enableDynamicSizing,
|
|
33
|
-
iosModalSheetTypeOfAnimation,
|
|
34
|
-
clickThrough,
|
|
35
|
-
style,
|
|
36
|
-
...sheetProps
|
|
37
|
-
} = options;
|
|
38
|
-
|
|
39
|
-
// Calculate safe index
|
|
40
|
-
const safeIndex = Math.min(route.snapToIndex ?? index, snapPoints.length - 1);
|
|
41
|
-
|
|
42
|
-
// Create animatedIndex for this sheet
|
|
43
|
-
const animatedIndex = useSharedValue(0);
|
|
44
|
-
|
|
45
|
-
// Use animated reaction to watch animatedIndex and update isFullScreen reactively
|
|
46
|
-
useAnimatedReaction(() => animatedIndex.value, index => {
|
|
47
|
-
"worklet";
|
|
48
|
-
|
|
49
|
-
if (defaultAnimatedIndex) {
|
|
50
|
-
defaultAnimatedIndex.set(index);
|
|
51
|
-
}
|
|
52
|
-
if (!iosModalSheetTypeOfAnimation) {
|
|
53
|
-
if (isFullScreen.value > 0) isFullScreen.set(0);
|
|
54
|
-
previousIndex.set(index);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (isFullScreen.value < 0) {
|
|
58
|
-
isFullScreen.set(0);
|
|
59
|
-
}
|
|
60
|
-
const isClosing = index < 0 || previousIndex.value >= 0 && index < previousIndex.value - 0.05;
|
|
61
|
-
previousIndex.set(index);
|
|
62
|
-
if (isClosing) {
|
|
63
|
-
if (isFullScreen.value > 0.01) {
|
|
64
|
-
isFullScreen.set(withTiming(0, {
|
|
65
|
-
duration: 150 * 0.85,
|
|
66
|
-
easing: Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const points = ["%90", "90%"];
|
|
72
|
-
const fullScreenIndex = snapPoints.findIndex(p => points.includes(p));
|
|
73
|
-
if (index >= fullScreenIndex - 0.5 && index <= fullScreenIndex + 0.5) {
|
|
74
|
-
isFullScreen.set(1);
|
|
75
|
-
} else if (index >= 0) {
|
|
76
|
-
isFullScreen.set(0);
|
|
77
|
-
}
|
|
78
|
-
}, [snapPoints, iosModalSheetTypeOfAnimation]);
|
|
79
|
-
return /*#__PURE__*/React.createElement(BottomSheetModalScreen, _extends({
|
|
80
|
-
route: route,
|
|
81
|
-
navigation: navigation,
|
|
82
|
-
index: safeIndex,
|
|
83
|
-
snapPoints: enableDynamicSizing ? undefined : snapPoints,
|
|
84
|
-
enableDynamicSizing: enableDynamicSizing,
|
|
85
|
-
animatedIndex: animatedIndex,
|
|
86
|
-
clickThrough: clickThrough,
|
|
87
|
-
animationConfigs: {
|
|
88
|
-
duration: 300,
|
|
89
|
-
easing: Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
90
|
-
},
|
|
91
|
-
onAnimate: (from, to, ...args) => {
|
|
92
|
-
if (to >= isFullScreen.value && to > snapPoints.length - 1) {
|
|
93
|
-
isFullScreen.set(0);
|
|
94
|
-
} else if (to > 0 && to === previousIndex.value && isFullScreen.value === 0) {
|
|
95
|
-
isFullScreen.set(1);
|
|
96
|
-
}
|
|
97
|
-
onAnimate?.(from, to, ...args);
|
|
98
|
-
},
|
|
99
|
-
topInset: 0,
|
|
100
|
-
bottomInset: 0,
|
|
101
|
-
style: [defaultStyle, style],
|
|
102
|
-
backgroundStyle: [themeBackgroundStyle, backgroundStyle],
|
|
103
|
-
handleIndicatorStyle: [themeHandleIndicatorStyle, handleIndicatorStyle],
|
|
104
|
-
handleStyle: [themeBackgroundStyle, {
|
|
105
|
-
borderRadius: 24
|
|
106
|
-
}, handleStyle]
|
|
107
|
-
}, sheetProps), render?.());
|
|
108
|
-
}
|
|
109
|
-
function BottomSheetModalScreen({
|
|
110
10
|
route,
|
|
111
|
-
navigation,
|
|
112
|
-
clickThrough,
|
|
113
|
-
opacity,
|
|
114
|
-
animatedIndex,
|
|
115
|
-
onChange,
|
|
116
|
-
children,
|
|
117
11
|
...props
|
|
118
12
|
}) {
|
|
119
13
|
const ref = React.useRef(null);
|
|
120
14
|
const lastSnapIndexRef = React.useRef(route.snapToIndex ?? props.index ?? 0);
|
|
121
15
|
|
|
122
|
-
// Present on mount.
|
|
123
|
-
React.useEffect(() => {
|
|
124
|
-
ref.current?.present();
|
|
125
|
-
}, []);
|
|
126
|
-
|
|
127
|
-
// Track mount state to avoid dismissing on unmount
|
|
128
|
-
const isMounted = React.useRef(true);
|
|
129
|
-
React.useEffect(() => {
|
|
130
|
-
return () => {
|
|
131
|
-
isMounted.current = false;
|
|
132
|
-
};
|
|
133
|
-
}, []);
|
|
134
|
-
|
|
135
16
|
// Handle route closing state
|
|
136
17
|
React.useEffect(() => {
|
|
137
18
|
if (route.closing) {
|
|
138
|
-
ref.current?.
|
|
19
|
+
ref.current?.close();
|
|
139
20
|
}
|
|
140
21
|
}, [route.closing]);
|
|
141
22
|
|
|
@@ -146,36 +27,26 @@ function BottomSheetModalScreen({
|
|
|
146
27
|
lastSnapIndexRef.current = route.snapToIndex;
|
|
147
28
|
}
|
|
148
29
|
}, [route.snapToIndex, route.snapToKey]);
|
|
149
|
-
const handleChange = React.useCallback(newIndex => {
|
|
30
|
+
const handleChange = React.useCallback((newIndex, position, type) => {
|
|
31
|
+
navigation.emit({
|
|
32
|
+
type: "sheetOnChange",
|
|
33
|
+
target: route.key,
|
|
34
|
+
data: {
|
|
35
|
+
index: newIndex,
|
|
36
|
+
position,
|
|
37
|
+
type
|
|
38
|
+
}
|
|
39
|
+
});
|
|
150
40
|
const currentIndex = lastSnapIndexRef.current;
|
|
151
41
|
lastSnapIndexRef.current = newIndex;
|
|
152
42
|
if (newIndex >= 0 && newIndex !== currentIndex) {
|
|
153
43
|
navigation.dispatch(BottomSheetActions.snapTo(newIndex));
|
|
154
44
|
}
|
|
155
45
|
}, [navigation]);
|
|
156
|
-
|
|
157
|
-
// BottomSheetModal will call onDismiss on unmount, but we don't want that
|
|
158
|
-
// since we handle navigation state separately
|
|
159
|
-
if (isMounted.current) {
|
|
160
|
-
navigation.dispatch({
|
|
161
|
-
...BottomSheetActions.remove(),
|
|
162
|
-
source: route.key
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}, [navigation, route.key]);
|
|
166
|
-
return /*#__PURE__*/React.createElement(BottomSheetModal, _extends({}, props, {
|
|
46
|
+
return /*#__PURE__*/React.createElement(BottomSheet, _extends({
|
|
167
47
|
ref: ref,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
animatedIndex: animatedIndex,
|
|
171
|
-
index: props.index,
|
|
172
|
-
backdropComponent: backdropProps => /*#__PURE__*/React.createElement(BottomSheetBackdrop, _extends({}, backdropProps, {
|
|
173
|
-
appearsOnIndex: 0,
|
|
174
|
-
disappearsOnIndex: -1,
|
|
175
|
-
enableTouchThrough: !!clickThrough,
|
|
176
|
-
opacity: opacity ?? 0.45
|
|
177
|
-
}))
|
|
178
|
-
}), children);
|
|
48
|
+
onChange: handleChange
|
|
49
|
+
}, props), children);
|
|
179
50
|
}
|
|
180
51
|
export function BottomSheetView({
|
|
181
52
|
state,
|
|
@@ -186,98 +57,83 @@ export function BottomSheetView({
|
|
|
186
57
|
colors
|
|
187
58
|
} = useTheme();
|
|
188
59
|
const {
|
|
189
|
-
top,
|
|
190
60
|
bottom,
|
|
191
61
|
left,
|
|
192
62
|
right
|
|
193
63
|
} = useSafeAreaInsets();
|
|
194
64
|
const themeBackgroundStyle = React.useMemo(() => ({
|
|
195
65
|
borderCurve: "continuous",
|
|
196
|
-
backgroundColor: colors.card
|
|
197
|
-
borderTopLeftRadius: 20,
|
|
198
|
-
borderTopRightRadius: 20
|
|
66
|
+
backgroundColor: colors.card
|
|
199
67
|
}), [colors.card]);
|
|
200
68
|
const themeHandleIndicatorStyle = React.useMemo(() => ({
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
width: 50
|
|
69
|
+
borderCurve: "continuous",
|
|
70
|
+
backgroundColor: colors.border
|
|
204
71
|
}), [colors.border]);
|
|
205
72
|
const defaultStyle = React.useMemo(() => ({
|
|
206
73
|
paddingBottom: bottom,
|
|
207
74
|
paddingLeft: left,
|
|
208
75
|
paddingRight: right
|
|
209
76
|
}), [bottom, left, right]);
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const previousIndex = useSharedValue(-1);
|
|
214
|
-
const colorStyle = useAnimatedStyle(() => ({
|
|
215
|
-
flex: 1,
|
|
216
|
-
backgroundColor: withSpring(interpolateColor(isFullScreen.value, [0, 1], ["transparent", "#000"]), {
|
|
217
|
-
duration: 150
|
|
218
|
-
})
|
|
219
|
-
}));
|
|
220
|
-
const animatedStyle = useAnimatedStyle(() => ({
|
|
221
|
-
flex: 1,
|
|
222
|
-
overflow: "hidden",
|
|
223
|
-
borderRadius: interpolate(isFullScreen.value, [0, 0.8, 1], [0, 20, 24], "clamp"),
|
|
224
|
-
transform: [{
|
|
225
|
-
scaleX: withSpring(interpolate(isFullScreen.value, [0, 0.8], [1, 0.92], "clamp"), {
|
|
226
|
-
duration: 150
|
|
227
|
-
})
|
|
228
|
-
}, {
|
|
229
|
-
translateY: withSpring(interpolate(isFullScreen.value, [0, 0.8, 1], [0, top, top + 5], "clamp"), {
|
|
230
|
-
duration: 150,
|
|
231
|
-
dampingRatio: 1.5
|
|
232
|
-
})
|
|
233
|
-
}]
|
|
234
|
-
}), [top]);
|
|
235
|
-
|
|
236
|
-
// Since background color is white, we need to set status bar to light
|
|
237
|
-
const setStatusBar = StatusBar.setBarStyle;
|
|
238
|
-
useAnimatedReaction(() => isFullScreen.value, currentValue => {
|
|
239
|
-
"worklet";
|
|
240
|
-
|
|
241
|
-
if (currentValue > -1) {
|
|
242
|
-
runOnJS(setStatusBar)(currentValue >= 0.5 ? "light-content" : "default");
|
|
243
|
-
}
|
|
244
|
-
}, []);
|
|
245
|
-
|
|
246
|
-
// Get the base (first) route - this is the main content
|
|
247
|
-
const baseRoute = state.routes[0];
|
|
248
|
-
if (!baseRoute) {
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
const baseDescriptor = descriptors[baseRoute.key];
|
|
252
|
-
if (!baseDescriptor) {
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Sheet routes are all routes after the base route
|
|
257
|
-
const sheetRoutes = state.routes.slice(1);
|
|
258
|
-
const hasSheets = sheetRoutes.length > 0;
|
|
259
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Animated.View, {
|
|
260
|
-
style: colorStyle
|
|
261
|
-
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
262
|
-
style: animatedStyle
|
|
263
|
-
}, baseDescriptor.render?.())), hasSheets && /*#__PURE__*/React.createElement(BottomSheetModalProvider, null, sheetRoutes.map(route => {
|
|
264
|
-
// Skip routes that are being removed
|
|
265
|
-
if (route.closing && !descriptors[route.key]) {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
77
|
+
const [baseRoute, ...sheetRoutes] = state.routes;
|
|
78
|
+
const baseDescriptor = baseRoute ? descriptors[baseRoute.key] : null;
|
|
79
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, baseDescriptor?.render(), sheetRoutes.map(route => {
|
|
268
80
|
const descriptor = descriptors[route.key];
|
|
269
81
|
if (!descriptor) return null;
|
|
270
|
-
|
|
82
|
+
const {
|
|
83
|
+
options,
|
|
84
|
+
render
|
|
85
|
+
} = descriptor;
|
|
86
|
+
const {
|
|
87
|
+
index = 0,
|
|
88
|
+
style,
|
|
89
|
+
backgroundStyle,
|
|
90
|
+
handleIndicatorStyle,
|
|
91
|
+
handleStyle,
|
|
92
|
+
...props
|
|
93
|
+
} = options;
|
|
94
|
+
return /*#__PURE__*/React.createElement(BottomSheetScreen, _extends({
|
|
271
95
|
key: route.key,
|
|
96
|
+
id: route.key,
|
|
272
97
|
route: route,
|
|
98
|
+
index: index,
|
|
273
99
|
navigation: navigation,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
100
|
+
style: [defaultStyle, style],
|
|
101
|
+
backgroundStyle: [themeBackgroundStyle, backgroundStyle],
|
|
102
|
+
handleIndicatorStyle: [themeHandleIndicatorStyle, handleIndicatorStyle],
|
|
103
|
+
handleStyle: [themeBackgroundStyle, {
|
|
104
|
+
borderRadius: 24
|
|
105
|
+
}, handleStyle],
|
|
106
|
+
onClose: data => {
|
|
107
|
+
navigation.dispatch({
|
|
108
|
+
...BottomSheetActions.remove(),
|
|
109
|
+
source: route.key
|
|
110
|
+
});
|
|
111
|
+
navigation.emit({
|
|
112
|
+
type: "sheetDismiss",
|
|
113
|
+
target: route.key,
|
|
114
|
+
data
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
onBeforeShow: data => {
|
|
118
|
+
navigation.emit({
|
|
119
|
+
type: "sheetPresent",
|
|
120
|
+
target: route.key,
|
|
121
|
+
data
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
onAnimate: (fromIndex, toIndex, fromPosition, toPosition) => {
|
|
125
|
+
navigation.emit({
|
|
126
|
+
type: "sheetOnAnimate",
|
|
127
|
+
target: route.key,
|
|
128
|
+
data: {
|
|
129
|
+
fromIndex,
|
|
130
|
+
toIndex,
|
|
131
|
+
fromPosition,
|
|
132
|
+
toPosition
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, props), render());
|
|
137
|
+
}));
|
|
282
138
|
}
|
|
283
139
|
//# sourceMappingURL=view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Animated","Easing","interpolate","interpolateColor","runOnJS","useAnimatedReaction","useAnimatedStyle","useSharedValue","withSpring","withTiming","BottomSheetBackdrop","BottomSheetModal","BottomSheetModalProvider","useSafeAreaInsets","useTheme","StatusBar","React","BottomSheetActions","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","length","value","set","isClosing","duration","easing","bezier","points","fullScreenIndex","findIndex","p","includes","createElement","BottomSheetModalScreen","_extends","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","snapTo","handleDismiss","remove","source","key","onDismiss","backdropComponent","backdropProps","appearsOnIndex","disappearsOnIndex","enableTouchThrough","BottomSheetView","state","descriptors","colors","top","bottom","left","right","useMemo","borderCurve","backgroundColor","card","borderTopLeftRadius","borderTopRightRadius","border","height","width","paddingBottom","paddingLeft","paddingRight","colorStyle","flex","animatedStyle","overflow","transform","scaleX","translateY","dampingRatio","setStatusBar","setBarStyle","currentValue","baseRoute","routes","baseDescriptor","sheetRoutes","slice","hasSheets","Fragment","View","map"],"sourceRoot":"../../../src","sources":["router/view.tsx"],"mappings":";AAAA,OAAOA,QAAQ,IACbC,MAAM,EACNC,WAAW,EACXC,gBAAgB,EAChBC,OAAO,EAEPC,mBAAmB,EACnBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SACEC,mBAAmB,EACnBC,gBAAgB,EAChBC,wBAAwB,QACnB,sBAAsB;AAC7B,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAAwBC,QAAQ,QAAQ,0BAA0B;AAClE,SAASC,SAAS,QAAmB,cAAc;AACnD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAW9B,SAASC,kBAAkB,QAAQ,UAAU;AAE7C,MAAMC,mBAAmB,GAAG,CAAC,KAAK,CAAC;AAEn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E/B,KAAA,CAAA2C,aAAA,CAAA3C,KAAA,CAAAyH,QAAA,qBAEEzH,KAAA,CAAA2C,aAAA,CAAC3D,QAAQ,CAAC0I,IAAI;IAACjG,KAAK,EAAE+E;EAAW,gBAC/BxG,KAAA,CAAA2C,aAAA,CAAC3D,QAAQ,CAAC0I,IAAI;IAACjG,KAAK,EAAEiF;EAAc,GAAEW,cAAc,CAACxG,MAAM,GAAG,CAAiB,CAClE,CAAC,EAGf2G,SAAS,iBACRxH,KAAA,CAAA2C,aAAA,CAAC/C,wBAAwB,QACtB0H,WAAW,CAACK,GAAG,CAAEvH,KAAK,IAAK;IAC1B;IACA,IAAIA,KAAK,CAAC6D,OAAO,IAAI,CAACqB,WAAW,CAAClF,KAAK,CAACyE,GAAG,CAAC,EAAE;MAC5C,OAAO,IAAI;IACb;IAEA,MAAMvE,UAAU,GAAGgF,WAAW,CAAClF,KAAK,CAACyE,GAAG,CAAC;IACzC,IAAI,CAACvE,UAAU,EAAE,OAAO,IAAI;IAE5B,oBACEN,KAAA,CAAA2C,aAAA,CAACxC,oBAAoB;MACnB0E,GAAG,EAAEzE,KAAK,CAACyE,GAAI;MACfzE,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":["useSafeAreaInsets","useTheme","React","BottomSheetActions","BottomSheet","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","snapTo","createElement","_extends","onChange","BottomSheetView","state","descriptors","colors","bottom","left","right","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,SAASA,iBAAiB,QAAQ,gCAAgC;AAClE,SAAwBC,QAAQ,QAAQ,0BAA0B;AAElE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAS9B,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,OAAOC,WAAW,MAAM,UAAU;AAQlC,SAASC,iBAAiBA,CAAC;EACzBC,QAAQ;EACRC,UAAU;EACVC,KAAK;EACL,GAAGC;AAIL,CAAC,EAAE;EACD,MAAMC,GAAG,GAAGR,KAAK,CAACS,MAAM,CAAsB,IAAI,CAAC;EACnD,MAAMC,gBAAgB,GAAGV,KAAK,CAACS,MAAM,CAACH,KAAK,CAACK,WAAW,IAAIJ,KAAK,CAACK,KAAK,IAAI,CAAC,CAAC;;EAE5E;EACAZ,KAAK,CAACa,SAAS,CAAC,MAAM;IACpB,IAAIP,KAAK,CAACQ,OAAO,EAAE;MACjBN,GAAG,CAACO,OAAO,EAAEC,KAAK,CAAC,CAAC;IACtB;EACF,CAAC,EAAE,CAACV,KAAK,CAACQ,OAAO,CAAC,CAAC;;EAEnB;EACAd,KAAK,CAACa,SAAS,CAAC,MAAM;IACpB,IAAIP,KAAK,CAACK,WAAW,IAAI,IAAI,IAAIL,KAAK,CAACK,WAAW,KAAKD,gBAAgB,CAACK,OAAO,EAAE;MAC/EP,GAAG,CAACO,OAAO,EAAEJ,WAAW,CAACL,KAAK,CAACK,WAAW,CAAC;MAC3CD,gBAAgB,CAACK,OAAO,GAAGT,KAAK,CAACK,WAAW;IAC9C;EACF,CAAC,EAAE,CA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AE,CAACb,YAAY,EAAEa,KAAK,CAAE;MAC7BC,eAAe,EAAE,CAACrB,oBAAoB,EAAEqB,eAAe,CAAE;MACzDC,oBAAoB,EAAE,CAACjB,yBAAyB,EAAEiB,oBAAoB,CAAE;MACxEC,WAAW,EAAE,CAACvB,oBAAoB,EAAE;QAAEyB,YAAY,EAAE;MAAG,CAAC,EAAEF,WAAW,CAAE;MACvEG,OAAO,EAAGxC,IAAI,IAAK;QACjBrB,UAAU,CAACuB,QAAQ,CAAC;UAClB,GAAG3B,kBAAkB,CAACkE,MAAM,CAAC,CAAC;UAC9BC,MAAM,EAAE9D,KAAK,CAACmB;QAChB,CAAC,CAAC;QACFpB,UAAU,CAACkB,IAAI,CAAC;UACdD,IAAI,EAAE,cAAc;UACpBE,MAAM,EAAElB,KAAK,CAACmB,GAAG;UACjBC;QACF,CAAC,CAAC;MACJ,CAAE;MACF2C,YAAY,EAAG3C,IAAI,IAAK;QACtBrB,UAAU,CAACkB,IAAI,CAAC;UACdD,IAAI,EAAE,cAAc;UACpBE,MAAM,EAAElB,KAAK,CAACmB,GAAG;UACjBC;QACF,CAAC,CAAC;MACJ,CAAE;MACF4C,SAAS,EAAEA,CAACC,SAAS,EAAEC,OAAO,EAAEC,YAAY,EAAEC,UAAU,KAAK;QAC3DrE,UAAU,CAACkB,IAAI,CAAC;UACdD,IAAI,EAAE,gBAAgB;UACtBE,MAAM,EAAElB,KAAK,CAACmB,GAAG;UACjBC,IAAI,EAAE;YAAE6C,SAAS;YAAEC,OAAO;YAAEC,YAAY;YAAEC;UAAW;QACvD,CAAC,CAAC;MACJ;IAAE,GACEnE,KAAK,GAERiD,MAAM,CAAC,CACS,CAAC;EAExB,CAAC,CACD,CAAC;AAEP","ignoreList":[]}
|
package/lib/module/sheet.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
import RNBottomSheet, { BottomSheetBackdrop, BottomSheetFlatList, BottomSheetFooter, BottomSheetFooterContainer, BottomSheetHandle, BottomSheetScrollView, BottomSheetSectionList, BottomSheetTextInput, BottomSheetView, BottomSheetVirtualizedList } from "@gorhom/bottom-sheet";
|
|
3
3
|
import { BackHandler, Platform, StyleSheet, View } from "react-native";
|
|
4
|
-
import {
|
|
4
|
+
import { interpolate, useAnimatedReaction, useSharedValue } from "react-native-reanimated";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
|
-
import { useTheme } from "@react-navigation/native";
|
|
7
6
|
import React from "react";
|
|
8
|
-
import { useProviderContext,
|
|
7
|
+
import { useProviderContext, useSheetIDContext, useSheetRef, useSheetSharedContext, useStackBehaviorContext } from "./provider";
|
|
9
8
|
import { PrivateManager } from "./manager";
|
|
10
9
|
import { eventManager } from "./events";
|
|
10
|
+
const FULL_SCREEN_POINTS = Platform.OS === "ios" ? ["%90", "90%"] : ["%93", "93%"];
|
|
11
11
|
const useSheetManager = ({
|
|
12
12
|
id,
|
|
13
13
|
onHide,
|
|
@@ -38,69 +38,64 @@ const useSheetManager = ({
|
|
|
38
38
|
};
|
|
39
39
|
const BottomSheetComponent = /*#__PURE__*/React.forwardRef(({
|
|
40
40
|
children,
|
|
41
|
-
snapPoints,
|
|
42
41
|
onClose,
|
|
43
42
|
onBeforeShow,
|
|
44
43
|
stackBehavior = "switch",
|
|
45
44
|
hardwareBackPressToClose = true,
|
|
46
45
|
enableDynamicSizing = false,
|
|
47
46
|
handleIndicatorStyle,
|
|
48
|
-
iosModalSheetTypeOfAnimation
|
|
47
|
+
iosModalSheetTypeOfAnimation,
|
|
48
|
+
snapPoints: defaultSnapPoints,
|
|
49
49
|
animatedIndex: defaultAnimatedIndex,
|
|
50
50
|
backgroundStyle,
|
|
51
51
|
onAnimate,
|
|
52
52
|
handleStyle,
|
|
53
53
|
style,
|
|
54
|
-
|
|
54
|
+
passThrough,
|
|
55
55
|
opacity,
|
|
56
56
|
...props
|
|
57
57
|
}, ref) => {
|
|
58
58
|
const currentSheetRef = useSheetRef();
|
|
59
59
|
const currentCtx = useProviderContext();
|
|
60
60
|
const stackContext = useStackBehaviorContext();
|
|
61
|
-
const {
|
|
62
|
-
isFullScreen,
|
|
63
|
-
iosModalSheetTypeOfAnimation,
|
|
64
|
-
duration
|
|
65
|
-
} = useSheetAnimationContext();
|
|
66
61
|
const animatedIndex = useSharedValue(0);
|
|
67
|
-
const previousIndex = useSharedValue(-1);
|
|
68
62
|
const [currentStackBehavior, setCurrentStackBehavior] = React.useState(stackBehavior);
|
|
69
63
|
const isPushed = currentStackBehavior === "push";
|
|
70
|
-
const {
|
|
71
|
-
colors
|
|
72
|
-
} = useTheme();
|
|
73
64
|
const {
|
|
74
65
|
bottom,
|
|
75
66
|
left,
|
|
76
67
|
right
|
|
77
68
|
} = useSafeAreaInsets();
|
|
78
|
-
const themeBackgroundStyle = React.useMemo(() => ({
|
|
79
|
-
borderCurve: "continuous",
|
|
80
|
-
backgroundColor: colors.card,
|
|
81
|
-
borderTopLeftRadius: 20,
|
|
82
|
-
borderTopRightRadius: 20
|
|
83
|
-
}), [colors.card]);
|
|
84
|
-
const themeHandleIndicatorStyle = React.useMemo(() => ({
|
|
85
|
-
backgroundColor: colors.border,
|
|
86
|
-
height: 5,
|
|
87
|
-
width: 50
|
|
88
|
-
}), [colors.border]);
|
|
89
69
|
const defaultStyle = React.useMemo(() => ({
|
|
90
70
|
paddingBottom: bottom,
|
|
91
71
|
paddingLeft: left,
|
|
92
72
|
paddingRight: right
|
|
93
73
|
}), [bottom, left, right]);
|
|
74
|
+
const {
|
|
75
|
+
isFullScreen
|
|
76
|
+
} = useSheetSharedContext();
|
|
77
|
+
const [snapPoints, fullScreenIndex] = React.useMemo(() => {
|
|
78
|
+
let resolved = defaultSnapPoints;
|
|
79
|
+
if (Platform.OS === "android" && iosModalSheetTypeOfAnimation && Array.isArray(resolved)) {
|
|
80
|
+
resolved = resolved.map(p => p === "90%" || p === "%90" ? "93%" : p);
|
|
81
|
+
}
|
|
82
|
+
const fullScreenIndex = resolved instanceof Array ? resolved.findIndex(p => FULL_SCREEN_POINTS.includes(p)) : resolved?.value?.findIndex(p => FULL_SCREEN_POINTS.includes(p)) || -1;
|
|
83
|
+
return [resolved, fullScreenIndex];
|
|
84
|
+
}, [defaultSnapPoints, iosModalSheetTypeOfAnimation]);
|
|
94
85
|
const valueRef = React.useRef(null);
|
|
95
86
|
const bottomSheetRef = React.useRef(null);
|
|
96
87
|
const hardwareBackPressEvent = React.useRef(null);
|
|
97
88
|
const id = useSheetIDContext();
|
|
98
89
|
const sheetId = props.id || id;
|
|
90
|
+
const hideSheetRef = React.useRef(null);
|
|
99
91
|
useSheetManager({
|
|
100
92
|
id: sheetId,
|
|
101
93
|
onHide: (data, dismiss, behavior) => {
|
|
94
|
+
// Update state for future renders, but also pass behavior directly
|
|
95
|
+
// so hideSheet doesn't read a stale closure value (React state update
|
|
96
|
+
// is async — hideSheet runs before the re-render).
|
|
102
97
|
if (behavior) setCurrentStackBehavior(behavior);
|
|
103
|
-
|
|
98
|
+
hideSheetRef.current(data, true, dismiss, behavior);
|
|
104
99
|
},
|
|
105
100
|
onBeforeShow: (data, behavior) => {
|
|
106
101
|
if (behavior) setCurrentStackBehavior(behavior);
|
|
@@ -119,68 +114,61 @@ const BottomSheetComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
119
114
|
});
|
|
120
115
|
useAnimatedReaction(() => animatedIndex.value, index => {
|
|
121
116
|
"worklet";
|
|
117
|
+
|
|
122
118
|
if (defaultAnimatedIndex) {
|
|
123
119
|
defaultAnimatedIndex.set(index);
|
|
124
120
|
}
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
previousIndex.set(index);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (isFullScreen.value < 0) {
|
|
131
|
-
isFullScreen.set(0);
|
|
132
|
-
}
|
|
133
|
-
const isClosing = index < 0 || previousIndex.value >= 0 && index < previousIndex.value - 0.05;
|
|
134
|
-
previousIndex.set(index);
|
|
135
|
-
if (isClosing) {
|
|
136
|
-
if (isFullScreen.value > 0.01) {
|
|
137
|
-
isFullScreen.set(withTiming(0, {
|
|
138
|
-
duration: duration * 0.85,
|
|
139
|
-
easing: Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
return;
|
|
121
|
+
if (iosModalSheetTypeOfAnimation) {
|
|
122
|
+
isFullScreen.set(interpolate(index, [fullScreenIndex - 1, fullScreenIndex, fullScreenIndex + 1], [0, 1, 0]));
|
|
143
123
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
}, [snapPoints, iosModalSheetTypeOfAnimation, pageAnimation, duration]);
|
|
152
|
-
const hideSheet = React.useCallback((data, fromManager, dismiss) => {
|
|
124
|
+
}, [iosModalSheetTypeOfAnimation]);
|
|
125
|
+
const hideSheet = React.useCallback((data, fromManager, dismiss, incomingBehavior) => {
|
|
126
|
+
// Use the freshly-delivered behavior from the event when available.
|
|
127
|
+
// currentStackBehavior comes from React state which may not have flushed
|
|
128
|
+
// yet when this callback fires synchronously from the manager.
|
|
129
|
+
const activeBehavior = incomingBehavior ?? currentStackBehavior;
|
|
153
130
|
let value = data ?? valueRef.current;
|
|
154
131
|
hardwareBackPressEvent.current?.remove();
|
|
155
132
|
const closeValue = onClose?.(value);
|
|
156
133
|
if (closeValue !== undefined) value = closeValue;
|
|
157
|
-
if (dismiss &&
|
|
134
|
+
if (dismiss && activeBehavior === "push") {
|
|
135
|
+
// For push behavior, a "dismiss" event means another sheet wants to
|
|
136
|
+
// appear on top — do not close this sheet.
|
|
158
137
|
if (fromManager) valueRef.current = data;
|
|
159
138
|
return;
|
|
160
139
|
}
|
|
161
|
-
if (
|
|
140
|
+
if (activeBehavior !== "replace" || !dismiss) {
|
|
162
141
|
bottomSheetRef.current?.close();
|
|
163
142
|
}
|
|
164
143
|
if (sheetId) {
|
|
165
144
|
const hasHistory = PrivateManager.history.length > 0;
|
|
166
|
-
const shouldRestorePrevious =
|
|
167
|
-
eventManager.publish(`onclose_${sheetId}`, value, currentCtx, hasHistory || !!dismiss,
|
|
145
|
+
const shouldRestorePrevious = activeBehavior !== "replace";
|
|
146
|
+
eventManager.publish(`onclose_${sheetId}`, value, currentCtx, hasHistory || !!dismiss, activeBehavior);
|
|
168
147
|
if (shouldRestorePrevious) {
|
|
169
148
|
if (dismiss) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
149
|
+
// it will surface naturally when the push sheet is closed.
|
|
150
|
+
if (activeBehavior !== "push") {
|
|
151
|
+
PrivateManager.history.push({
|
|
152
|
+
id: sheetId,
|
|
153
|
+
context: currentCtx,
|
|
154
|
+
behavior: activeBehavior
|
|
155
|
+
});
|
|
156
|
+
}
|
|
175
157
|
} else if (hasHistory) {
|
|
176
|
-
const
|
|
177
|
-
|
|
158
|
+
const otherSheetsStillOpen = PrivateManager.stack().some(s => !(s.id === sheetId && s.context === currentCtx));
|
|
159
|
+
if (!otherSheetsStillOpen) {
|
|
160
|
+
const prev = PrivateManager.history.pop();
|
|
161
|
+
eventManager.publish(`show_wrap_${prev.id}`, undefined, prev.context, true, prev.behavior);
|
|
162
|
+
}
|
|
178
163
|
}
|
|
179
164
|
}
|
|
180
165
|
PrivateManager.remove(sheetId, currentCtx);
|
|
181
166
|
}
|
|
182
167
|
if (fromManager) valueRef.current = data;
|
|
183
168
|
}, [sheetId, currentCtx, onClose, currentStackBehavior]);
|
|
169
|
+
React.useEffect(() => {
|
|
170
|
+
hideSheetRef.current = hideSheet;
|
|
171
|
+
}, [hideSheet]);
|
|
184
172
|
const getInstance = React.useCallback(() => ({
|
|
185
173
|
close(options = {}) {
|
|
186
174
|
valueRef.current = options.value;
|
|
@@ -210,20 +198,16 @@ const BottomSheetComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
210
198
|
React.useEffect(() => {
|
|
211
199
|
if (Platform.OS === "android" && hardwareBackPressToClose) {
|
|
212
200
|
hardwareBackPressEvent.current = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
213
|
-
|
|
201
|
+
// Go through hideSheet so internal state (PrivateManager, events,
|
|
202
|
+
// history) is updated correctly — not just the visual sheet.
|
|
203
|
+
hideSheetRef.current(undefined, true, false);
|
|
214
204
|
return true;
|
|
215
205
|
});
|
|
216
206
|
}
|
|
217
207
|
return () => hardwareBackPressEvent.current?.remove();
|
|
218
208
|
}, [hardwareBackPressToClose]);
|
|
219
209
|
React.useImperativeHandle(ref, getInstance, [getInstance]);
|
|
220
|
-
const zIndex = React.useMemo(() =>
|
|
221
|
-
if (!sheetId) return 0;
|
|
222
|
-
if (isPushed) {
|
|
223
|
-
return PrivateManager.zIndex(sheetId, currentCtx);
|
|
224
|
-
}
|
|
225
|
-
return 0;
|
|
226
|
-
}, [sheetId, isPushed, currentCtx]);
|
|
210
|
+
const zIndex = React.useMemo(() => isPushed && sheetId ? PrivateManager.zIndex(sheetId, currentCtx) : 0, [sheetId, isPushed, currentCtx]);
|
|
227
211
|
const backdropOpacity = React.useMemo(() => {
|
|
228
212
|
if (isPushed && stackContext.previousSheetId) {
|
|
229
213
|
return (opacity || 0.45) * 0.6;
|
|
@@ -238,31 +222,23 @@ const BottomSheetComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
238
222
|
}, /*#__PURE__*/React.createElement(RNBottomSheet, _extends({
|
|
239
223
|
enableDynamicSizing: enableDynamicSizing,
|
|
240
224
|
backdropComponent: backdropProps => /*#__PURE__*/React.createElement(BottomSheetBackdrop, _extends({
|
|
241
|
-
enableTouchThrough: !!
|
|
225
|
+
enableTouchThrough: !!passThrough,
|
|
242
226
|
opacity: backdropOpacity,
|
|
243
227
|
disappearsOnIndex: -1,
|
|
244
228
|
appearsOnIndex: 0
|
|
245
229
|
}, backdropProps)),
|
|
246
|
-
onAnimate: (from, to, ...args) => {
|
|
247
|
-
const snapPointLen = Array.isArray(snapPoints) ? snapPoints.length : snapPoints?.value?.length ?? 0;
|
|
248
|
-
if (to >= isFullScreen.value && to > snapPointLen - 1) {
|
|
249
|
-
isFullScreen.set(0);
|
|
250
|
-
} else if (to > 0 && to === previousIndex.value && isFullScreen.value === 0) {
|
|
251
|
-
isFullScreen.set(1);
|
|
252
|
-
}
|
|
253
|
-
onAnimate?.(from, to, ...args);
|
|
254
|
-
},
|
|
255
230
|
topInset: 0,
|
|
256
231
|
bottomInset: 0
|
|
257
232
|
}, props, {
|
|
258
233
|
ref: bottomSheetRef,
|
|
259
234
|
onClose: hideSheet,
|
|
235
|
+
onAnimate: onAnimate,
|
|
260
236
|
animatedIndex: animatedIndex,
|
|
261
237
|
style: [defaultStyle, style],
|
|
262
|
-
snapPoints: enableDynamicSizing ? undefined : snapPoints
|
|
263
|
-
handleIndicatorStyle:
|
|
264
|
-
backgroundStyle:
|
|
265
|
-
handleStyle:
|
|
238
|
+
snapPoints: enableDynamicSizing ? undefined : snapPoints,
|
|
239
|
+
handleIndicatorStyle: handleIndicatorStyle,
|
|
240
|
+
backgroundStyle: backgroundStyle,
|
|
241
|
+
handleStyle: handleStyle
|
|
266
242
|
}), children));
|
|
267
243
|
});
|
|
268
244
|
const BottomSheet = /*#__PURE__*/React.memo(BottomSheetComponent);
|