ncore-react-native-sheet 1.0.0-alpha.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/LICENSE +21 -0
- package/README.md +7 -0
- package/lib/commonjs/constants.js +10 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/index.js +494 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/styles.js +53 -0
- package/lib/commonjs/styles.js.map +1 -0
- package/lib/commonjs/types.js +8 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/constants.js +6 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/index.js +488 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/styles.js +49 -0
- package/lib/module/styles.js.map +1 -0
- package/lib/module/types.js +6 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/constants.d.ts +3 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/styles.d.ts +45 -0
- package/lib/typescript/src/styles.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +44 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +149 -0
- package/src/constants.ts +6 -0
- package/src/index.tsx +631 -0
- package/src/styles.ts +51 -0
- package/src/types.ts +54 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useImperativeHandle, forwardRef, useEffect, useState, Fragment, useMemo, useRef, createElement as _createElement } from "react";
|
|
4
|
+
import { TouchableWithoutFeedback, PanResponder, ScrollView, Animated, FlatList, View } from "react-native";
|
|
5
|
+
import styleSheet from "./styles";
|
|
6
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
7
|
+
import { windowHeight } from "./constants";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const ANIMATION_TO_SNAP_DURATION = 75;
|
|
10
|
+
const ANIMATION_CLOSE_DURATION = 400;
|
|
11
|
+
const ANIMATION_OPEN_DURATION = 300;
|
|
12
|
+
const VELOCITY_CLOSE = 1.2;
|
|
13
|
+
const Sheet = ({
|
|
14
|
+
handlerColor = "#c4c2c2",
|
|
15
|
+
panGestureEnabled = true,
|
|
16
|
+
snapPoint: snapPointProp,
|
|
17
|
+
isCanFullScreenOnSnap,
|
|
18
|
+
withSafeArea = true,
|
|
19
|
+
handler = "inside",
|
|
20
|
+
autoHeight = true,
|
|
21
|
+
headerComponent,
|
|
22
|
+
footerComponent,
|
|
23
|
+
scrollViewProps,
|
|
24
|
+
onOverlayPress,
|
|
25
|
+
withFullScreen,
|
|
26
|
+
flatListProps,
|
|
27
|
+
contentStyle,
|
|
28
|
+
overlayStyle,
|
|
29
|
+
rootStyle,
|
|
30
|
+
onClosed,
|
|
31
|
+
onOpened,
|
|
32
|
+
children,
|
|
33
|
+
...props
|
|
34
|
+
}, ref) => {
|
|
35
|
+
const insets = useSafeAreaInsets();
|
|
36
|
+
let maxHeight = withSafeArea ? windowHeight - insets.top : windowHeight;
|
|
37
|
+
let snapPoint = snapPointProp || maxHeight;
|
|
38
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
39
|
+
const contentContainerHeight = useRef(0);
|
|
40
|
+
const headerContainerHeight = useRef(0);
|
|
41
|
+
const isScrollable = useRef(false);
|
|
42
|
+
const contentHeight = useRef(0);
|
|
43
|
+
const listHeight = useRef(0);
|
|
44
|
+
const moveHeight = useRef(new Animated.Value(snapPoint)).current;
|
|
45
|
+
const beforeYPosition = useRef(new Animated.Value(0)).current;
|
|
46
|
+
const height = useRef(new Animated.Value(snapPoint)).current;
|
|
47
|
+
const overlayOpacity = useRef(new Animated.Value(0)).current;
|
|
48
|
+
const moveYPosition = useRef(new Animated.Value(0)).current;
|
|
49
|
+
const opening = useRef(new Animated.Value(0)).current;
|
|
50
|
+
const isAtBottomRef = useRef(false);
|
|
51
|
+
const scrollOffsetRef = useRef(0);
|
|
52
|
+
const isScrolling = useRef(false);
|
|
53
|
+
const flatListRef = useRef(null);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
isAtBottomRef.current = false;
|
|
56
|
+
scrollOffsetRef.current = 0;
|
|
57
|
+
if (snapPointProp && snapPointProp > windowHeight || withFullScreen) {
|
|
58
|
+
snapPoint = maxHeight;
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
const checkScrollability = (contentH, listH) => {
|
|
62
|
+
if (listH > 0 && contentH > listH) {
|
|
63
|
+
isScrollable.current = true;
|
|
64
|
+
} else {
|
|
65
|
+
isScrollable.current = false;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const calculateAutoHeight = (contentHeight, headerHeight) => {
|
|
69
|
+
moveHeight.setValue(contentHeight + headerHeight);
|
|
70
|
+
height.setValue(contentHeight + headerHeight);
|
|
71
|
+
snapPoint = contentHeight + headerHeight;
|
|
72
|
+
};
|
|
73
|
+
useImperativeHandle(ref, () => ({
|
|
74
|
+
close,
|
|
75
|
+
open
|
|
76
|
+
}), []);
|
|
77
|
+
const open = () => {
|
|
78
|
+
opening.setValue(1);
|
|
79
|
+
openAnimate();
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
if (onOpened) onOpened();
|
|
82
|
+
opening.setValue(0);
|
|
83
|
+
}, ANIMATION_OPEN_DURATION);
|
|
84
|
+
};
|
|
85
|
+
const close = () => {
|
|
86
|
+
closeAnimate();
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
if (flatListProps && flatListProps.data?.length) {
|
|
89
|
+
flatListRef?.current?.scrollToIndex({
|
|
90
|
+
index: 0,
|
|
91
|
+
animated: false
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (onClosed) onClosed();
|
|
95
|
+
}, ANIMATION_CLOSE_DURATION);
|
|
96
|
+
};
|
|
97
|
+
const openAnimate = () => {
|
|
98
|
+
setIsVisible(true);
|
|
99
|
+
let toValue = (withFullScreen ? withSafeArea ? windowHeight - insets.top : windowHeight : snapPoint) * -1;
|
|
100
|
+
Animated.parallel([Animated.timing(moveYPosition, {
|
|
101
|
+
toValue: toValue,
|
|
102
|
+
useNativeDriver: false,
|
|
103
|
+
duration: ANIMATION_OPEN_DURATION
|
|
104
|
+
}), Animated.timing(overlayOpacity, {
|
|
105
|
+
toValue: .1,
|
|
106
|
+
useNativeDriver: false,
|
|
107
|
+
duration: ANIMATION_OPEN_DURATION
|
|
108
|
+
}), Animated.timing(beforeYPosition, {
|
|
109
|
+
toValue: toValue,
|
|
110
|
+
useNativeDriver: false,
|
|
111
|
+
duration: ANIMATION_OPEN_DURATION
|
|
112
|
+
})]).start();
|
|
113
|
+
};
|
|
114
|
+
const closeAnimate = () => {
|
|
115
|
+
Animated.parallel([Animated.timing(beforeYPosition, {
|
|
116
|
+
toValue: 50,
|
|
117
|
+
useNativeDriver: false,
|
|
118
|
+
duration: ANIMATION_CLOSE_DURATION
|
|
119
|
+
}), Animated.timing(moveYPosition, {
|
|
120
|
+
toValue: 50,
|
|
121
|
+
useNativeDriver: false,
|
|
122
|
+
duration: ANIMATION_CLOSE_DURATION
|
|
123
|
+
}), Animated.timing(height, {
|
|
124
|
+
toValue: snapPoint,
|
|
125
|
+
useNativeDriver: false,
|
|
126
|
+
duration: ANIMATION_CLOSE_DURATION
|
|
127
|
+
}), Animated.timing(moveHeight, {
|
|
128
|
+
toValue: snapPoint,
|
|
129
|
+
useNativeDriver: false,
|
|
130
|
+
duration: ANIMATION_CLOSE_DURATION
|
|
131
|
+
}), Animated.timing(overlayOpacity, {
|
|
132
|
+
toValue: 0,
|
|
133
|
+
useNativeDriver: false,
|
|
134
|
+
duration: ANIMATION_CLOSE_DURATION
|
|
135
|
+
})]).start(e => {
|
|
136
|
+
if (e.finished) {
|
|
137
|
+
setIsVisible(false);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const disableScroll = () => {
|
|
142
|
+
if (flatListProps) {
|
|
143
|
+
flatListRef.current?.setNativeProps({
|
|
144
|
+
scrollEnabled: false
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const enableScroll = () => {
|
|
149
|
+
isAtBottomRef.current = false;
|
|
150
|
+
if (flatListProps) {
|
|
151
|
+
flatListRef.current?.setNativeProps({
|
|
152
|
+
scrollEnabled: true
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const onMoveShouldSetPanResponderContent = (e, gestureState) => {
|
|
157
|
+
const {
|
|
158
|
+
dy
|
|
159
|
+
} = gestureState;
|
|
160
|
+
if (!isScrolling) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// FlatList scroll ediyorsa panResponder devreye girmesin
|
|
165
|
+
if (scrollOffsetRef.current < 0 && dy < 0) {
|
|
166
|
+
// flatlist altta değilken yukarı kaydırma scroll'a gitmeli
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// FlatList alttayken yukarı çekiyorsa → devreye girsin
|
|
171
|
+
if (isAtBottomRef.current && dy < 0) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Aşağı çekme (her zaman sheet)
|
|
176
|
+
if (dy > 5 && scrollOffsetRef.current <= 0) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
if (!isScrollable.current) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
};
|
|
184
|
+
const onPanResponderGrant = (e, gestureState) => {
|
|
185
|
+
const {
|
|
186
|
+
dy,
|
|
187
|
+
dx,
|
|
188
|
+
y0
|
|
189
|
+
} = gestureState;
|
|
190
|
+
disableScroll();
|
|
191
|
+
|
|
192
|
+
// @ts-ignore
|
|
193
|
+
const extra = height._value - snapPoint;
|
|
194
|
+
|
|
195
|
+
// @ts-ignore
|
|
196
|
+
beforeYPosition.setValue(beforeYPosition._value - extra);
|
|
197
|
+
height.setValue(snapPoint);
|
|
198
|
+
};
|
|
199
|
+
const onPanResponderMove = (e, gestureState) => {
|
|
200
|
+
const {
|
|
201
|
+
dy,
|
|
202
|
+
moveY
|
|
203
|
+
} = gestureState;
|
|
204
|
+
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
const _beforeYPosition = beforeYPosition._value;
|
|
207
|
+
const newYPosition = _beforeYPosition + dy;
|
|
208
|
+
if (newYPosition > -snapPoint) {
|
|
209
|
+
// Snap altı
|
|
210
|
+
moveHeight.setValue(snapPoint);
|
|
211
|
+
moveYPosition.setValue(newYPosition);
|
|
212
|
+
} else {
|
|
213
|
+
// Snap üstü
|
|
214
|
+
if (!panGestureEnabled) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const absNewY = Math.abs(newYPosition);
|
|
218
|
+
const extra = Math.max(0, absNewY - snapPoint);
|
|
219
|
+
const expandedHeight = Math.min(snapPoint + extra, maxHeight);
|
|
220
|
+
moveHeight.setValue(expandedHeight);
|
|
221
|
+
moveYPosition.setValue(-snapPoint);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const onPanResponderEnd = (e, gestureState) => {
|
|
225
|
+
const {
|
|
226
|
+
vy,
|
|
227
|
+
dy
|
|
228
|
+
} = gestureState;
|
|
229
|
+
enableScroll();
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
const moveHeightValue = moveHeight._value;
|
|
232
|
+
// @ts-ignore
|
|
233
|
+
const currentYValue = moveYPosition._value;
|
|
234
|
+
const isBelowSnap = moveHeightValue === snapPoint;
|
|
235
|
+
|
|
236
|
+
// @ts-ignore
|
|
237
|
+
const _moveYPosition = moveHeight._value;
|
|
238
|
+
let targetHeight = snapPoint;
|
|
239
|
+
let targetY = snapPoint * -1;
|
|
240
|
+
if (vy > VELOCITY_CLOSE) {
|
|
241
|
+
close();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const dists = {
|
|
245
|
+
distToTop: {
|
|
246
|
+
value: isBelowSnap && !withFullScreen ? windowHeight * 10 : Math.abs(moveHeightValue - windowHeight),
|
|
247
|
+
action: () => {
|
|
248
|
+
targetHeight = maxHeight;
|
|
249
|
+
targetY = snapPoint * -1;
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
distToBottom: {
|
|
253
|
+
value: isBelowSnap ? Math.abs(currentYValue) : Math.abs(moveHeightValue),
|
|
254
|
+
action: () => {
|
|
255
|
+
close();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
if (snapPointProp) {
|
|
260
|
+
dists.distToSnap = {
|
|
261
|
+
value: isBelowSnap ? Math.abs(currentYValue + snapPoint) : Math.abs(moveHeightValue - snapPoint),
|
|
262
|
+
action: () => {
|
|
263
|
+
targetHeight = snapPoint;
|
|
264
|
+
targetY = snapPoint * -1;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const [key, distItem] = Object.entries(dists).reduce((min, curr) => curr[1].value < min[1].value ? curr : min);
|
|
269
|
+
distItem.action();
|
|
270
|
+
if (key === "distToBottom") {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
Animated.parallel([Animated.timing(moveHeight, {
|
|
274
|
+
toValue: targetHeight,
|
|
275
|
+
useNativeDriver: false,
|
|
276
|
+
duration: ANIMATION_TO_SNAP_DURATION
|
|
277
|
+
}), Animated.timing(moveYPosition, {
|
|
278
|
+
toValue: targetY,
|
|
279
|
+
useNativeDriver: false,
|
|
280
|
+
duration: ANIMATION_TO_SNAP_DURATION
|
|
281
|
+
})]).start();
|
|
282
|
+
beforeYPosition.setValue(targetY);
|
|
283
|
+
height.setValue(targetHeight);
|
|
284
|
+
};
|
|
285
|
+
const panResponderHandle = useMemo(() => PanResponder.create({
|
|
286
|
+
//onStartShouldSetPanResponder: (evt, gestureState) => true,
|
|
287
|
+
onMoveShouldSetPanResponder: () => true,
|
|
288
|
+
onPanResponderGrant: onPanResponderGrant,
|
|
289
|
+
onPanResponderMove: onPanResponderMove,
|
|
290
|
+
onPanResponderEnd: onPanResponderEnd
|
|
291
|
+
}), []);
|
|
292
|
+
const panResponderContent = useMemo(() => PanResponder.create({
|
|
293
|
+
//onStartShouldSetPanResponder: (evt, gestureState) => true,
|
|
294
|
+
onMoveShouldSetPanResponder: onMoveShouldSetPanResponderContent,
|
|
295
|
+
onPanResponderGrant: onPanResponderGrant,
|
|
296
|
+
onPanResponderMove: onPanResponderMove,
|
|
297
|
+
onPanResponderEnd: onPanResponderEnd
|
|
298
|
+
}), []);
|
|
299
|
+
const renderOverlay = () => {
|
|
300
|
+
return /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
301
|
+
style: {
|
|
302
|
+
...styleSheet.overlayTouchable,
|
|
303
|
+
...overlayStyle
|
|
304
|
+
},
|
|
305
|
+
onPress: () => {
|
|
306
|
+
if (onOverlayPress) {
|
|
307
|
+
onOverlayPress();
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
311
|
+
style: {
|
|
312
|
+
...styleSheet.overlayView,
|
|
313
|
+
opacity: overlayOpacity
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
const renderHandler = () => {
|
|
319
|
+
if (withFullScreen && withSafeArea) {
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
return /*#__PURE__*/_jsx(View, {
|
|
323
|
+
style: {
|
|
324
|
+
...styleSheet.handler,
|
|
325
|
+
backgroundColor: handlerColor
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
const renderHeader = () => {
|
|
330
|
+
return /*#__PURE__*/_createElement(Animated.View, {
|
|
331
|
+
...panResponderHandle.panHandlers,
|
|
332
|
+
key: "bottomSheet-header-key",
|
|
333
|
+
onLayout: e => {
|
|
334
|
+
if (withFullScreen) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (!autoHeight || snapPointProp) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
//@ts-ignore
|
|
341
|
+
if (opening._value !== 1) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const absNewHeight = Math.abs(e.nativeEvent.layout.height);
|
|
345
|
+
const layoutHeight = Math.min(absNewHeight, maxHeight);
|
|
346
|
+
headerContainerHeight.current = layoutHeight;
|
|
347
|
+
calculateAutoHeight(contentContainerHeight.current, layoutHeight);
|
|
348
|
+
},
|
|
349
|
+
style: [styleSheet.handlerContainer, handler === "outside" ? {
|
|
350
|
+
position: "absolute",
|
|
351
|
+
top: -24
|
|
352
|
+
} : null]
|
|
353
|
+
}, renderHandler(), renderHeaderComponent());
|
|
354
|
+
};
|
|
355
|
+
const renderHeaderComponent = () => {
|
|
356
|
+
if (!headerComponent) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
return headerComponent;
|
|
360
|
+
};
|
|
361
|
+
const renderContentItems = () => {
|
|
362
|
+
if (flatListProps) {
|
|
363
|
+
return /*#__PURE__*/_createElement(FlatList, {
|
|
364
|
+
...flatListProps,
|
|
365
|
+
key: "bottomSheet-flatlist-key",
|
|
366
|
+
ref: flatListRef,
|
|
367
|
+
scrollEnabled: true,
|
|
368
|
+
onLayout: e => {
|
|
369
|
+
const height = e.nativeEvent.layout.height;
|
|
370
|
+
listHeight.current = height;
|
|
371
|
+
checkScrollability(contentHeight.current, height);
|
|
372
|
+
},
|
|
373
|
+
onContentSizeChange: (w, h) => {
|
|
374
|
+
isAtBottomRef.current = false;
|
|
375
|
+
contentHeight.current = h;
|
|
376
|
+
checkScrollability(h, listHeight.current);
|
|
377
|
+
},
|
|
378
|
+
onScroll: e => {
|
|
379
|
+
const {
|
|
380
|
+
layoutMeasurement,
|
|
381
|
+
contentOffset,
|
|
382
|
+
contentSize
|
|
383
|
+
} = e.nativeEvent;
|
|
384
|
+
scrollOffsetRef.current = contentOffset.y;
|
|
385
|
+
const paddingToBottom = 12; // tolerans
|
|
386
|
+
isAtBottomRef.current = layoutMeasurement.height + contentOffset.y >= contentSize.height - paddingToBottom;
|
|
387
|
+
},
|
|
388
|
+
onTouchStart: () => {
|
|
389
|
+
isScrolling.current = true;
|
|
390
|
+
},
|
|
391
|
+
onTouchEnd: () => {
|
|
392
|
+
isScrolling.current = false;
|
|
393
|
+
},
|
|
394
|
+
scrollEventThrottle: 16
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
if (scrollViewProps) {
|
|
398
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
399
|
+
...scrollViewProps,
|
|
400
|
+
scrollEnabled: true,
|
|
401
|
+
onLayout: e => {
|
|
402
|
+
const height = e.nativeEvent.layout.height;
|
|
403
|
+
listHeight.current = height;
|
|
404
|
+
checkScrollability(contentHeight.current, height);
|
|
405
|
+
},
|
|
406
|
+
onContentSizeChange: (w, h) => {
|
|
407
|
+
isAtBottomRef.current = false;
|
|
408
|
+
contentHeight.current = h;
|
|
409
|
+
checkScrollability(h, listHeight.current);
|
|
410
|
+
},
|
|
411
|
+
onScroll: e => {
|
|
412
|
+
const {
|
|
413
|
+
layoutMeasurement,
|
|
414
|
+
contentOffset,
|
|
415
|
+
contentSize
|
|
416
|
+
} = e.nativeEvent;
|
|
417
|
+
scrollOffsetRef.current = contentOffset.y;
|
|
418
|
+
const paddingToBottom = 12; // tolerans
|
|
419
|
+
isAtBottomRef.current = layoutMeasurement.height + contentOffset.y >= contentSize.height - paddingToBottom;
|
|
420
|
+
},
|
|
421
|
+
onTouchStart: () => {
|
|
422
|
+
isScrolling.current = true;
|
|
423
|
+
},
|
|
424
|
+
onTouchEnd: () => {
|
|
425
|
+
isScrolling.current = false;
|
|
426
|
+
},
|
|
427
|
+
scrollEventThrottle: 16,
|
|
428
|
+
children: children
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
return children;
|
|
432
|
+
};
|
|
433
|
+
const renderFooterComponent = () => {
|
|
434
|
+
if (!footerComponent) {
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
return footerComponent;
|
|
438
|
+
};
|
|
439
|
+
const renderContent = () => {
|
|
440
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
441
|
+
onLayout: e => {
|
|
442
|
+
if (withFullScreen) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
if (!autoHeight || snapPointProp) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
//@ts-ignore
|
|
449
|
+
if (opening._value !== 1) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const absNewHeight = Math.abs(withSafeArea ? e.nativeEvent.layout.height + insets.bottom : e.nativeEvent.layout.height);
|
|
453
|
+
const layoutHeight = Math.min(absNewHeight, maxHeight);
|
|
454
|
+
contentContainerHeight.current = layoutHeight;
|
|
455
|
+
calculateAutoHeight(layoutHeight, headerContainerHeight.current);
|
|
456
|
+
},
|
|
457
|
+
style: {
|
|
458
|
+
...styleSheet.bottomViewChildContainer,
|
|
459
|
+
...contentStyle,
|
|
460
|
+
flex: withFullScreen || !autoHeight || snapPointProp ? 1 : 0
|
|
461
|
+
},
|
|
462
|
+
...panResponderContent.panHandlers,
|
|
463
|
+
children: [renderContentItems(), renderFooterComponent()]
|
|
464
|
+
}, "bottomSheet-content-key");
|
|
465
|
+
};
|
|
466
|
+
const renderView = () => {
|
|
467
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
468
|
+
style: {
|
|
469
|
+
backgroundColor: "#fff",
|
|
470
|
+
borderRadius: 8,
|
|
471
|
+
...rootStyle,
|
|
472
|
+
...styleSheet.bottomViewContainer,
|
|
473
|
+
//@ts-ignore
|
|
474
|
+
height: moveHeight._value > 0 ? moveHeight : "auto",
|
|
475
|
+
bottom: snapPoint * -1,
|
|
476
|
+
transform: [{
|
|
477
|
+
translateY: moveYPosition
|
|
478
|
+
}]
|
|
479
|
+
},
|
|
480
|
+
children: [renderHeader(), renderContent()]
|
|
481
|
+
}, "bottomSheet-root-view-key");
|
|
482
|
+
};
|
|
483
|
+
return isVisible ? /*#__PURE__*/_jsxs(Fragment, {
|
|
484
|
+
children: [renderOverlay(), renderView()]
|
|
485
|
+
}) : null;
|
|
486
|
+
};
|
|
487
|
+
export default /*#__PURE__*/forwardRef(Sheet);
|
|
488
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useImperativeHandle","forwardRef","useEffect","useState","Fragment","useMemo","useRef","createElement","_createElement","TouchableWithoutFeedback","PanResponder","ScrollView","Animated","FlatList","View","styleSheet","useSafeAreaInsets","windowHeight","jsx","_jsx","jsxs","_jsxs","ANIMATION_TO_SNAP_DURATION","ANIMATION_CLOSE_DURATION","ANIMATION_OPEN_DURATION","VELOCITY_CLOSE","Sheet","handlerColor","panGestureEnabled","snapPoint","snapPointProp","isCanFullScreenOnSnap","withSafeArea","handler","autoHeight","headerComponent","footerComponent","scrollViewProps","onOverlayPress","withFullScreen","flatListProps","contentStyle","overlayStyle","rootStyle","onClosed","onOpened","children","props","ref","insets","maxHeight","top","isVisible","setIsVisible","contentContainerHeight","headerContainerHeight","isScrollable","contentHeight","listHeight","moveHeight","Value","current","beforeYPosition","height","overlayOpacity","moveYPosition","opening","isAtBottomRef","scrollOffsetRef","isScrolling","flatListRef","checkScrollability","contentH","listH","calculateAutoHeight","headerHeight","setValue","close","open","openAnimate","setTimeout","closeAnimate","data","length","scrollToIndex","index","animated","toValue","parallel","timing","useNativeDriver","duration","start","e","finished","disableScroll","setNativeProps","scrollEnabled","enableScroll","onMoveShouldSetPanResponderContent","gestureState","dy","onPanResponderGrant","dx","y0","extra","_value","onPanResponderMove","moveY","_beforeYPosition","newYPosition","absNewY","Math","abs","max","expandedHeight","min","onPanResponderEnd","vy","moveHeightValue","currentYValue","isBelowSnap","_moveYPosition","targetHeight","targetY","dists","distToTop","value","action","distToBottom","distToSnap","key","distItem","Object","entries","reduce","curr","panResponderHandle","create","onMoveShouldSetPanResponder","panResponderContent","renderOverlay","style","overlayTouchable","onPress","overlayView","opacity","renderHandler","backgroundColor","renderHeader","panHandlers","onLayout","absNewHeight","nativeEvent","layout","layoutHeight","handlerContainer","position","renderHeaderComponent","renderContentItems","onContentSizeChange","w","h","onScroll","layoutMeasurement","contentOffset","contentSize","y","paddingToBottom","onTouchStart","onTouchEnd","scrollEventThrottle","renderFooterComponent","renderContent","bottom","bottomViewChildContainer","flex","renderView","borderRadius","bottomViewContainer","transform","translateY"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACRC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACPC,MAAM,EAAAC,aAAA,IAAAC,cAAA,QACH,OAAO;AACd,SAEIC,wBAAwB,EAExBC,YAAY,EACZC,UAAU,EACVC,QAAQ,EACRC,QAAQ,EACRC,IAAI,QACD,cAAc;AACrB,OAAOC,UAAU,MAAM,UAAU;AACjC,SACIC,iBAAiB,QACd,gCAAgC;AAOvC,SACIC,YAAY,QACT,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAErB,MAAMC,0BAA0B,GAAG,EAAE;AACrC,MAAMC,wBAAwB,GAAG,GAAG;AACpC,MAAMC,uBAAuB,GAAG,GAAG;AACnC,MAAMC,cAAc,GAAG,GAAG;AAE1B,MAAMC,KAAyD,GAAGA,CAAC;EAC/DC,YAAY,GAAG,SAAS;EACxBC,iBAAiB,GAAG,IAAI;EACxBC,SAAS,EAAEC,aAAa;EACxBC,qBAAqB;EACrBC,YAAY,GAAG,IAAI;EACnBC,OAAO,GAAG,QAAQ;EAClBC,UAAU,GAAG,IAAI;EACjBC,eAAe;EACfC,eAAe;EACfC,eAAe;EACfC,cAAc;EACdC,cAAc;EACdC,aAAa;EACbC,Y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AM,EAAEJ,UAAU,CAAC+C,MAAM,GAAG,CAAC,GAAG/C,UAAU,GAAG,MAAM;QACnDmH,MAAM,EAAEjJ,SAAS,GAAG,CAAC,CAAC;QACtBuJ,SAAS,EAAE,CACP;UACIC,UAAU,EAAEpH;QAChB,CAAC;MAET,CAAE;MAAAnB,QAAA,GAEDuG,YAAY,CAAC,CAAC,EACdwB,aAAa,CAAC,CAAC;IAAA,GAjBX,2BAkBM,CAAC;EACpB,CAAC;EAED,OAAOzH,SAAS,gBACZ/B,KAAA,CAACjB,QAAQ;IAAA0C,QAAA,GACJ+F,aAAa,CAAC,CAAC,EACfoC,UAAU,CAAC,CAAC;EAAA,CACP,CAAC,GAEX,IAAI;AACZ,CAAC;AAOD,4BAAehL,UAAU,CAACyB,KAAK,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { windowHeight, windowWidth } from "./constants";
|
|
5
|
+
const styleSheet = StyleSheet.create({
|
|
6
|
+
bottomViewContainer: {
|
|
7
|
+
position: "absolute",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
width: windowWidth
|
|
10
|
+
},
|
|
11
|
+
bottomViewChildContainer: {
|
|
12
|
+
overflow: "hidden"
|
|
13
|
+
},
|
|
14
|
+
overlayTouchable: {
|
|
15
|
+
position: "absolute",
|
|
16
|
+
height: windowHeight,
|
|
17
|
+
width: windowWidth,
|
|
18
|
+
bottom: 0,
|
|
19
|
+
right: 0,
|
|
20
|
+
left: 0,
|
|
21
|
+
top: 0
|
|
22
|
+
},
|
|
23
|
+
handlerContainer: {
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
width: "100%",
|
|
27
|
+
padding: 8
|
|
28
|
+
},
|
|
29
|
+
outsideHandlerContainer: {
|
|
30
|
+
justifyContent: "center",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
position: "absolute",
|
|
33
|
+
width: "100%",
|
|
34
|
+
padding: 8,
|
|
35
|
+
top: -24
|
|
36
|
+
},
|
|
37
|
+
handler: {
|
|
38
|
+
position: "relative",
|
|
39
|
+
borderRadius: 4,
|
|
40
|
+
height: 8,
|
|
41
|
+
width: 48
|
|
42
|
+
},
|
|
43
|
+
overlayView: {
|
|
44
|
+
backgroundColor: "black",
|
|
45
|
+
flex: 1
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export default styleSheet;
|
|
49
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","windowHeight","windowWidth","styleSheet","create","bottomViewContainer","position","overflow","width","bottomViewChildContainer","overlayTouchable","height","bottom","right","left","top","handlerContainer","justifyContent","alignItems","padding","outsideHandlerContainer","handler","borderRadius","overlayView","backgroundColor","flex"],"sourceRoot":"../../src","sources":["styles.ts"],"mappings":";;AAAA,SACIA,UAAU,QACP,cAAc;AACrB,SACIC,YAAY,EACZC,WAAW,QACR,aAAa;AACpB,MAAMC,UAAU,GAAGH,UAAU,CAACI,MAAM,CAAC;EACjCC,mBAAmB,EAAE;IACjBC,QAAQ,EAAE,UAAU;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,KAAK,EAAEN;EACX,CAAC;EACDO,wBAAwB,EAAE;IACtBF,QAAQ,EAAE;EACd,CAAC;EACDG,gBAAgB,EAAE;IACdJ,QAAQ,EAAE,UAAU;IACpBK,MAAM,EAAEV,YAAY;IACpBO,KAAK,EAAEN,WAAW;IAClBU,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE,CAAC;IACRC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE;EACT,CAAC;EACDC,gBAAgB,EAAE;IACdC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBV,KAAK,EAAE,MAAM;IACbW,OAAO,EAAE;EACb,CAAC;EACDC,uBAAuB,EAAE;IACrBH,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBZ,QAAQ,EAAE,UAAU;IACpBE,KAAK,EAAE,MAAM;IACbW,OAAO,EAAE,CAAC;IACVJ,GAAG,EAAE,CAAC;EACV,CAAC;EACDM,OAAO,EAAE;IACLf,QAAQ,EAAE,UAAU;IACpBgB,YAAY,EAAE,CAAC;IACfX,MAAM,EAAE,CAAC;IACTH,KAAK,EAAE;EACX,CAAC;EACDe,WAAW,EAAE;IACTC,eAAe,EAAE,OAAO;IACxBC,IAAI,EAAE;EACV;AACJ,CAAC,CAAC;AACF,eAAetB,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAuCC;AAGA;AAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,QAAkC,CAAC;AAC5D,eAAO,MAAM,WAAW,QAAiC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ISheetProps, SheetRef } from "./types";
|
|
3
|
+
export type { ISheetProps, SheetRef } from "./types";
|
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<ISheetProps<any> & React.RefAttributes<SheetRef>>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAef,OAAO,EAEH,WAAW,EAEX,QAAQ,EACX,MAAM,SAAS,CAAC;AAqlBjB,YAAY,EACR,WAAW,EACX,QAAQ,EACX,MAAM,SAAS,CAAC;;AAEjB,wBAAiC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
declare const styleSheet: {
|
|
2
|
+
bottomViewContainer: {
|
|
3
|
+
position: "absolute";
|
|
4
|
+
overflow: "hidden";
|
|
5
|
+
width: number;
|
|
6
|
+
};
|
|
7
|
+
bottomViewChildContainer: {
|
|
8
|
+
overflow: "hidden";
|
|
9
|
+
};
|
|
10
|
+
overlayTouchable: {
|
|
11
|
+
position: "absolute";
|
|
12
|
+
height: number;
|
|
13
|
+
width: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
right: number;
|
|
16
|
+
left: number;
|
|
17
|
+
top: number;
|
|
18
|
+
};
|
|
19
|
+
handlerContainer: {
|
|
20
|
+
justifyContent: "center";
|
|
21
|
+
alignItems: "center";
|
|
22
|
+
width: "100%";
|
|
23
|
+
padding: number;
|
|
24
|
+
};
|
|
25
|
+
outsideHandlerContainer: {
|
|
26
|
+
justifyContent: "center";
|
|
27
|
+
alignItems: "center";
|
|
28
|
+
position: "absolute";
|
|
29
|
+
width: "100%";
|
|
30
|
+
padding: number;
|
|
31
|
+
top: number;
|
|
32
|
+
};
|
|
33
|
+
handler: {
|
|
34
|
+
position: "relative";
|
|
35
|
+
borderRadius: number;
|
|
36
|
+
height: number;
|
|
37
|
+
width: number;
|
|
38
|
+
};
|
|
39
|
+
overlayView: {
|
|
40
|
+
backgroundColor: string;
|
|
41
|
+
flex: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default styleSheet;
|
|
45
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/styles.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Cd,CAAC;AACH,eAAe,UAAU,CAAC"}
|