@mustmove/bottom-sheet 1.0.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 +66 -0
- package/mock.js +231 -0
- package/package.json +107 -0
- package/src/components/bottomSheet/BottomSheet.tsx +1885 -0
- package/src/components/bottomSheet/BottomSheetBody.tsx +44 -0
- package/src/components/bottomSheet/BottomSheetContent.tsx +261 -0
- package/src/components/bottomSheet/constants.ts +58 -0
- package/src/components/bottomSheet/index.ts +2 -0
- package/src/components/bottomSheet/styles.ts +11 -0
- package/src/components/bottomSheet/types.d.ts +358 -0
- package/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx +165 -0
- package/src/components/bottomSheetBackdrop/constants.ts +22 -0
- package/src/components/bottomSheetBackdrop/index.ts +2 -0
- package/src/components/bottomSheetBackdrop/styles.ts +8 -0
- package/src/components/bottomSheetBackdrop/types.d.ts +58 -0
- package/src/components/bottomSheetBackground/BottomSheetBackground.tsx +20 -0
- package/src/components/bottomSheetBackground/BottomSheetBackgroundContainer.tsx +35 -0
- package/src/components/bottomSheetBackground/index.ts +2 -0
- package/src/components/bottomSheetBackground/styles.ts +9 -0
- package/src/components/bottomSheetBackground/types.d.ts +12 -0
- package/src/components/bottomSheetDebugView/BottomSheetDebugView.tsx +26 -0
- package/src/components/bottomSheetDebugView/ReText.tsx +72 -0
- package/src/components/bottomSheetDebugView/ReText.webx.tsx +55 -0
- package/src/components/bottomSheetDebugView/index.ts +1 -0
- package/src/components/bottomSheetDebugView/styles.ts +19 -0
- package/src/components/bottomSheetDebugView/styles.web.ts +20 -0
- package/src/components/bottomSheetDraggableView/BottomSheetDraggableView.tsx +123 -0
- package/src/components/bottomSheetDraggableView/index.ts +1 -0
- package/src/components/bottomSheetDraggableView/types.d.ts +9 -0
- package/src/components/bottomSheetFooter/BottomSheetFooter.tsx +119 -0
- package/src/components/bottomSheetFooter/BottomSheetFooterContainer.tsx +43 -0
- package/src/components/bottomSheetFooter/index.ts +3 -0
- package/src/components/bottomSheetFooter/styles.ts +12 -0
- package/src/components/bottomSheetFooter/types.d.ts +41 -0
- package/src/components/bottomSheetGestureHandlersProvider/BottomSheetGestureHandlersProvider.tsx +69 -0
- package/src/components/bottomSheetGestureHandlersProvider/index.ts +1 -0
- package/src/components/bottomSheetGestureHandlersProvider/types.d.ts +8 -0
- package/src/components/bottomSheetHandle/BottomSheetHandle.tsx +51 -0
- package/src/components/bottomSheetHandle/BottomSheetHandleContainer.tsx +187 -0
- package/src/components/bottomSheetHandle/constants.ts +12 -0
- package/src/components/bottomSheetHandle/index.ts +6 -0
- package/src/components/bottomSheetHandle/styles.ts +23 -0
- package/src/components/bottomSheetHandle/types.d.ts +52 -0
- package/src/components/bottomSheetHostingContainer/BottomSheetHostingContainer.tsx +130 -0
- package/src/components/bottomSheetHostingContainer/index.ts +2 -0
- package/src/components/bottomSheetHostingContainer/styles.ts +5 -0
- package/src/components/bottomSheetHostingContainer/styles.web.ts +11 -0
- package/src/components/bottomSheetHostingContainer/types.d.ts +17 -0
- package/src/components/bottomSheetModal/BottomSheetModal.tsx +482 -0
- package/src/components/bottomSheetModal/constants.ts +4 -0
- package/src/components/bottomSheetModal/index.ts +6 -0
- package/src/components/bottomSheetModal/types.d.ts +67 -0
- package/src/components/bottomSheetModalProvider/BottomSheetModalProvider.tsx +211 -0
- package/src/components/bottomSheetModalProvider/index.ts +1 -0
- package/src/components/bottomSheetModalProvider/types.d.ts +12 -0
- package/src/components/bottomSheetRefreshControl/BottomSheetRefreshControl.android.tsx +84 -0
- package/src/components/bottomSheetRefreshControl/BottomSheetRefreshControl.tsx +1 -0
- package/src/components/bottomSheetRefreshControl/index.ts +20 -0
- package/src/components/bottomSheetScrollable/BottomSheetDraggableScrollable.tsx +23 -0
- package/src/components/bottomSheetScrollable/BottomSheetFlashList.tsx +88 -0
- package/src/components/bottomSheetScrollable/BottomSheetFlashList.web.tsx +1 -0
- package/src/components/bottomSheetScrollable/BottomSheetFlatList.tsx +26 -0
- package/src/components/bottomSheetScrollable/BottomSheetScrollView.tsx +27 -0
- package/src/components/bottomSheetScrollable/BottomSheetSectionList.tsx +29 -0
- package/src/components/bottomSheetScrollable/BottomSheetVirtualizedList.tsx +27 -0
- package/src/components/bottomSheetScrollable/ScrollableContainer.android.tsx +55 -0
- package/src/components/bottomSheetScrollable/ScrollableContainer.tsx +22 -0
- package/src/components/bottomSheetScrollable/ScrollableContainer.web.tsx +102 -0
- package/src/components/bottomSheetScrollable/createBottomSheetScrollableComponent.tsx +153 -0
- package/src/components/bottomSheetScrollable/index.ts +15 -0
- package/src/components/bottomSheetScrollable/styles.ts +8 -0
- package/src/components/bottomSheetScrollable/types.d.ts +280 -0
- package/src/components/bottomSheetScrollable/useBottomSheetContentSizeSetter.ts +32 -0
- package/src/components/bottomSheetTextInput/BottomSheetTextInput.tsx +127 -0
- package/src/components/bottomSheetTextInput/index.ts +2 -0
- package/src/components/bottomSheetTextInput/types.ts +3 -0
- package/src/components/bottomSheetView/BottomSheetView.tsx +93 -0
- package/src/components/bottomSheetView/index.ts +1 -0
- package/src/components/bottomSheetView/styles.ts +10 -0
- package/src/components/bottomSheetView/types.d.ts +24 -0
- package/src/components/touchables/Touchables.ios.tsx +5 -0
- package/src/components/touchables/Touchables.tsx +5 -0
- package/src/components/touchables/index.ts +20 -0
- package/src/constants.ts +159 -0
- package/src/contexts/external.ts +8 -0
- package/src/contexts/gesture.ts +13 -0
- package/src/contexts/index.ts +15 -0
- package/src/contexts/internal.ts +65 -0
- package/src/contexts/modal/external.ts +11 -0
- package/src/contexts/modal/internal.ts +25 -0
- package/src/hooks/index.ts +29 -0
- package/src/hooks/useAnimatedDetents.ts +119 -0
- package/src/hooks/useAnimatedKeyboard.ts +174 -0
- package/src/hooks/useAnimatedLayout.ts +109 -0
- package/src/hooks/useBottomSheet.ts +12 -0
- package/src/hooks/useBottomSheetContentContainerStyle.ts +88 -0
- package/src/hooks/useBottomSheetGestureHandlers.ts +12 -0
- package/src/hooks/useBottomSheetInternal.ts +25 -0
- package/src/hooks/useBottomSheetModal.ts +12 -0
- package/src/hooks/useBottomSheetModalInternal.ts +25 -0
- package/src/hooks/useBottomSheetScrollableCreator.tsx +60 -0
- package/src/hooks/useBottomSheetSpringConfigs.ts +11 -0
- package/src/hooks/useBottomSheetTimingConfigs.ts +36 -0
- package/src/hooks/useBoundingClientRect.ts +77 -0
- package/src/hooks/useGestureEventsHandlersDefault.tsx +436 -0
- package/src/hooks/useGestureEventsHandlersDefault.web.tsx +418 -0
- package/src/hooks/useGestureHandler.ts +90 -0
- package/src/hooks/usePropsValidator.ts +108 -0
- package/src/hooks/useReactiveSharedValue.ts +45 -0
- package/src/hooks/useScrollEventsHandlersDefault.ts +167 -0
- package/src/hooks/useScrollHandler.ts +72 -0
- package/src/hooks/useScrollHandler.web.ts +181 -0
- package/src/hooks/useScrollable.ts +131 -0
- package/src/hooks/useScrollableSetter.ts +56 -0
- package/src/hooks/useStableCallback.ts +26 -0
- package/src/index.ts +79 -0
- package/src/types.d.ts +336 -0
- package/src/utilities/animate.ts +56 -0
- package/src/utilities/clamp.ts +8 -0
- package/src/utilities/easingExp.ts +10 -0
- package/src/utilities/findNodeHandle.ts +1 -0
- package/src/utilities/findNodeHandle.web.ts +33 -0
- package/src/utilities/getKeyboardAnimationConfigs.ts +44 -0
- package/src/utilities/getRefNativeTag.web.ts +6 -0
- package/src/utilities/id.ts +6 -0
- package/src/utilities/index.ts +7 -0
- package/src/utilities/isFabricInstalled.ts +9 -0
- package/src/utilities/logger.ts +55 -0
- package/src/utilities/noop.ts +7 -0
- package/src/utilities/normalizeSnapPoint.ts +17 -0
- package/src/utilities/snapPoint.ts +11 -0
- package/src/utilities/validateSnapPoint.ts +20 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
4
|
+
import { useBottomSheetInternal } from '../../hooks';
|
|
5
|
+
import type { BottomSheetProps } from '../bottomSheet/types';
|
|
6
|
+
import { styles } from './styles';
|
|
7
|
+
|
|
8
|
+
type BottomSheetBodyProps = {
|
|
9
|
+
style?: BottomSheetProps['style'];
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function BottomSheetBodyComponent({ style, children }: BottomSheetBodyProps) {
|
|
14
|
+
//#region hooks
|
|
15
|
+
const { animatedIndex, animatedPosition } = useBottomSheetInternal();
|
|
16
|
+
//#endregion
|
|
17
|
+
|
|
18
|
+
//#region styles
|
|
19
|
+
const containerAnimatedStyle = useAnimatedStyle(
|
|
20
|
+
() => ({
|
|
21
|
+
opacity: Platform.OS === 'android' && animatedIndex.get() === -1 ? 0 : 1,
|
|
22
|
+
transform: [
|
|
23
|
+
{
|
|
24
|
+
translateY: animatedPosition.get(),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
}),
|
|
28
|
+
[animatedPosition, animatedIndex]
|
|
29
|
+
);
|
|
30
|
+
const containerStyle = useMemo(
|
|
31
|
+
() => [style, styles.container, containerAnimatedStyle],
|
|
32
|
+
[style, containerAnimatedStyle]
|
|
33
|
+
);
|
|
34
|
+
//#endregion
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Animated.View style={containerStyle} collapsable={true}>
|
|
38
|
+
{children}
|
|
39
|
+
</Animated.View>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const BottomSheetBody = memo(BottomSheetBodyComponent);
|
|
44
|
+
BottomSheetBody.displayName = 'BottomSheetBody';
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import type { ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
type AnimatedStyle,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useDerivedValue,
|
|
7
|
+
} from 'react-native-reanimated';
|
|
8
|
+
import {
|
|
9
|
+
INITIAL_LAYOUT_VALUE,
|
|
10
|
+
KEYBOARD_BEHAVIOR,
|
|
11
|
+
KEYBOARD_STATUS,
|
|
12
|
+
} from '../../constants';
|
|
13
|
+
import { useBottomSheetInternal } from '../../hooks';
|
|
14
|
+
import type { NullableAccessibilityProps } from '../../types';
|
|
15
|
+
import { animate } from '../../utilities';
|
|
16
|
+
import BottomSheetDraggableView from '../bottomSheetDraggableView';
|
|
17
|
+
import {} from './constants';
|
|
18
|
+
import type { BottomSheetProps } from './types';
|
|
19
|
+
|
|
20
|
+
type BottomSheetContent = {
|
|
21
|
+
style?: AnimatedStyle<ViewStyle>;
|
|
22
|
+
} & Pick<
|
|
23
|
+
BottomSheetProps,
|
|
24
|
+
| 'children'
|
|
25
|
+
| 'detached'
|
|
26
|
+
| 'animationConfigs'
|
|
27
|
+
| 'overrideReduceMotion'
|
|
28
|
+
| 'keyboardBehavior'
|
|
29
|
+
> &
|
|
30
|
+
NullableAccessibilityProps &
|
|
31
|
+
ViewProps;
|
|
32
|
+
|
|
33
|
+
function BottomSheetContentComponent({
|
|
34
|
+
detached,
|
|
35
|
+
animationConfigs,
|
|
36
|
+
overrideReduceMotion,
|
|
37
|
+
keyboardBehavior,
|
|
38
|
+
accessible,
|
|
39
|
+
accessibilityLabel,
|
|
40
|
+
accessibilityHint,
|
|
41
|
+
accessibilityRole,
|
|
42
|
+
children,
|
|
43
|
+
}: BottomSheetContent) {
|
|
44
|
+
//#region hooks
|
|
45
|
+
const {
|
|
46
|
+
enableDynamicSizing,
|
|
47
|
+
overDragResistanceFactor,
|
|
48
|
+
enableContentPanningGesture,
|
|
49
|
+
animatedPosition,
|
|
50
|
+
animatedLayoutState,
|
|
51
|
+
animatedDetentsState,
|
|
52
|
+
animatedSheetHeight,
|
|
53
|
+
animatedKeyboardState,
|
|
54
|
+
isInTemporaryPosition,
|
|
55
|
+
} = useBottomSheetInternal();
|
|
56
|
+
//#endregion
|
|
57
|
+
|
|
58
|
+
//#region variables
|
|
59
|
+
const animatedContentHeightMax = useDerivedValue(() => {
|
|
60
|
+
const { containerHeight, handleHeight } = animatedLayoutState.get();
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* if container height is not yet calculated, then we exit the method
|
|
64
|
+
*/
|
|
65
|
+
if (containerHeight === INITIAL_LAYOUT_VALUE) {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
status: keyboardStatus,
|
|
71
|
+
heightWithinContainer: keyboardHeightWithinContainer,
|
|
72
|
+
} = animatedKeyboardState.get();
|
|
73
|
+
|
|
74
|
+
let contentHeight = animatedSheetHeight.get() - Math.max(0, handleHeight);
|
|
75
|
+
|
|
76
|
+
switch (keyboardBehavior) {
|
|
77
|
+
case KEYBOARD_BEHAVIOR.extend:
|
|
78
|
+
if (keyboardStatus === KEYBOARD_STATUS.SHOWN) {
|
|
79
|
+
contentHeight = contentHeight - keyboardHeightWithinContainer;
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
|
|
83
|
+
case KEYBOARD_BEHAVIOR.fillParent:
|
|
84
|
+
if (!isInTemporaryPosition.get()) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (keyboardStatus === KEYBOARD_STATUS.SHOWN) {
|
|
89
|
+
contentHeight =
|
|
90
|
+
containerHeight - handleHeight - keyboardHeightWithinContainer;
|
|
91
|
+
} else {
|
|
92
|
+
contentHeight = containerHeight - handleHeight;
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case KEYBOARD_BEHAVIOR.interactive: {
|
|
97
|
+
if (!isInTemporaryPosition.get()) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (keyboardStatus === KEYBOARD_STATUS.SHOWN) {
|
|
102
|
+
if (
|
|
103
|
+
keyboardHeightWithinContainer + animatedSheetHeight.get() >
|
|
104
|
+
containerHeight
|
|
105
|
+
) {
|
|
106
|
+
contentHeight =
|
|
107
|
+
containerHeight - keyboardHeightWithinContainer - handleHeight;
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
/**
|
|
111
|
+
* When keyboard is hidden but sheet is still in temporary position
|
|
112
|
+
* (e.g. keyboardBlurBehavior="none"), use the actual position-based
|
|
113
|
+
* height instead of the snap-point based animatedSheetHeight.
|
|
114
|
+
* This prevents white space at the bottom of the sheet.
|
|
115
|
+
*/
|
|
116
|
+
contentHeight =
|
|
117
|
+
containerHeight -
|
|
118
|
+
animatedPosition.get() -
|
|
119
|
+
Math.max(0, handleHeight);
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* before the container is measured, `contentHeight` value will be below zero,
|
|
127
|
+
* which will lead to freeze the scrollable.
|
|
128
|
+
*
|
|
129
|
+
* @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470)
|
|
130
|
+
*/
|
|
131
|
+
return Math.max(contentHeight, 0);
|
|
132
|
+
}, [
|
|
133
|
+
animatedLayoutState,
|
|
134
|
+
animatedKeyboardState,
|
|
135
|
+
animatedSheetHeight,
|
|
136
|
+
animatedPosition,
|
|
137
|
+
isInTemporaryPosition,
|
|
138
|
+
keyboardBehavior,
|
|
139
|
+
]);
|
|
140
|
+
const animatedPaddingBottom = useDerivedValue(() => {
|
|
141
|
+
const containerHeight = animatedLayoutState.get().containerHeight;
|
|
142
|
+
/**
|
|
143
|
+
* if container height is not yet calculated, then we exit the method
|
|
144
|
+
*/
|
|
145
|
+
if (containerHeight === INITIAL_LAYOUT_VALUE) {
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const { highestDetentPosition } = animatedDetentsState.get();
|
|
150
|
+
|
|
151
|
+
const highestSnapPoint = Math.max(
|
|
152
|
+
highestDetentPosition ?? 0,
|
|
153
|
+
animatedPosition.get()
|
|
154
|
+
);
|
|
155
|
+
/**
|
|
156
|
+
* added safe area to prevent the sheet from floating above
|
|
157
|
+
* the bottom of the screen, when sheet being over dragged or
|
|
158
|
+
* when the sheet is resized.
|
|
159
|
+
*/
|
|
160
|
+
const overDragSafePaddingBottom =
|
|
161
|
+
Math.sqrt(highestSnapPoint - containerHeight * -1) *
|
|
162
|
+
overDragResistanceFactor;
|
|
163
|
+
|
|
164
|
+
let paddingBottom = overDragSafePaddingBottom;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* if keyboard is open, then we try to add padding to prevent content
|
|
168
|
+
* from being covered by the keyboard.
|
|
169
|
+
*/
|
|
170
|
+
const {
|
|
171
|
+
status: keyboardStatus,
|
|
172
|
+
heightWithinContainer: keyboardHeightWithinContainer,
|
|
173
|
+
} = animatedKeyboardState.get();
|
|
174
|
+
if (keyboardStatus === KEYBOARD_STATUS.SHOWN) {
|
|
175
|
+
paddingBottom = overDragSafePaddingBottom + keyboardHeightWithinContainer;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return paddingBottom;
|
|
179
|
+
}, [
|
|
180
|
+
overDragResistanceFactor,
|
|
181
|
+
animatedPosition,
|
|
182
|
+
animatedLayoutState,
|
|
183
|
+
animatedDetentsState,
|
|
184
|
+
animatedKeyboardState,
|
|
185
|
+
]);
|
|
186
|
+
//#endregion
|
|
187
|
+
|
|
188
|
+
//#region styles
|
|
189
|
+
const contentMaskContainerAnimatedStyle = useAnimatedStyle(() => {
|
|
190
|
+
const { containerHeight, contentHeight } = animatedLayoutState.get();
|
|
191
|
+
/**
|
|
192
|
+
* if container height is not yet calculated, then we exit the method
|
|
193
|
+
*/
|
|
194
|
+
if (containerHeight === INITIAL_LAYOUT_VALUE) {
|
|
195
|
+
return {};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* if dynamic sizing is enabled, and content height
|
|
200
|
+
* is still not set, then we exit method.
|
|
201
|
+
*/
|
|
202
|
+
if (enableDynamicSizing && contentHeight === INITIAL_LAYOUT_VALUE) {
|
|
203
|
+
return {};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const paddingBottom = detached ? 0 : animatedPaddingBottom.get();
|
|
207
|
+
const height = animatedContentHeightMax.get() + paddingBottom;
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
paddingBottom: animate({
|
|
211
|
+
point: paddingBottom,
|
|
212
|
+
configs: animationConfigs,
|
|
213
|
+
overrideReduceMotion,
|
|
214
|
+
}),
|
|
215
|
+
height: animate({
|
|
216
|
+
point: height,
|
|
217
|
+
configs: animationConfigs,
|
|
218
|
+
overrideReduceMotion,
|
|
219
|
+
}),
|
|
220
|
+
};
|
|
221
|
+
}, [
|
|
222
|
+
overDragResistanceFactor,
|
|
223
|
+
enableDynamicSizing,
|
|
224
|
+
detached,
|
|
225
|
+
animationConfigs,
|
|
226
|
+
overrideReduceMotion,
|
|
227
|
+
animatedLayoutState,
|
|
228
|
+
animatedContentHeightMax,
|
|
229
|
+
animatedLayoutState,
|
|
230
|
+
]);
|
|
231
|
+
const contentContainerStyle = useMemo(
|
|
232
|
+
() => [
|
|
233
|
+
detached
|
|
234
|
+
? { overflow: 'visible' as const }
|
|
235
|
+
: { overflow: 'hidden' as const },
|
|
236
|
+
contentMaskContainerAnimatedStyle,
|
|
237
|
+
],
|
|
238
|
+
[contentMaskContainerAnimatedStyle, detached]
|
|
239
|
+
);
|
|
240
|
+
//#endregion
|
|
241
|
+
|
|
242
|
+
//#region render
|
|
243
|
+
const DraggableView = enableContentPanningGesture
|
|
244
|
+
? BottomSheetDraggableView
|
|
245
|
+
: Animated.View;
|
|
246
|
+
return (
|
|
247
|
+
<DraggableView
|
|
248
|
+
accessible={accessible}
|
|
249
|
+
accessibilityLabel={accessibilityLabel}
|
|
250
|
+
accessibilityHint={accessibilityHint}
|
|
251
|
+
accessibilityRole={accessibilityRole}
|
|
252
|
+
style={contentContainerStyle}
|
|
253
|
+
>
|
|
254
|
+
{children}
|
|
255
|
+
</DraggableView>
|
|
256
|
+
);
|
|
257
|
+
//#endregion
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export const BottomSheetContent = memo(BottomSheetContentComponent);
|
|
261
|
+
BottomSheetContent.displayName = 'BottomSheetContent';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KEYBOARD_BEHAVIOR,
|
|
3
|
+
KEYBOARD_BLUR_BEHAVIOR,
|
|
4
|
+
KEYBOARD_INPUT_MODE,
|
|
5
|
+
SCREEN_HEIGHT,
|
|
6
|
+
} from '../../constants';
|
|
7
|
+
|
|
8
|
+
// default values
|
|
9
|
+
const DEFAULT_HANDLE_HEIGHT = 24;
|
|
10
|
+
const DEFAULT_OVER_DRAG_RESISTANCE_FACTOR = 2.5;
|
|
11
|
+
const DEFAULT_ENABLE_CONTENT_PANNING_GESTURE = true;
|
|
12
|
+
const DEFAULT_ENABLE_HANDLE_PANNING_GESTURE = true;
|
|
13
|
+
const DEFAULT_ENABLE_OVER_DRAG = true;
|
|
14
|
+
const DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE = false;
|
|
15
|
+
const DEFAULT_ANIMATE_ON_MOUNT = true;
|
|
16
|
+
const DEFAULT_DYNAMIC_SIZING = true;
|
|
17
|
+
|
|
18
|
+
// keyboard
|
|
19
|
+
const DEFAULT_KEYBOARD_BEHAVIOR = KEYBOARD_BEHAVIOR.interactive;
|
|
20
|
+
const DEFAULT_KEYBOARD_BLUR_BEHAVIOR = KEYBOARD_BLUR_BEHAVIOR.none;
|
|
21
|
+
const DEFAULT_KEYBOARD_INPUT_MODE = KEYBOARD_INPUT_MODE.adjustPan;
|
|
22
|
+
const DEFAULT_ENABLE_BLUR_KEYBOARD_ON_GESTURE = false;
|
|
23
|
+
const DEFAULT_KEYBOARD_INDEX = -998;
|
|
24
|
+
|
|
25
|
+
// initial values
|
|
26
|
+
const INITIAL_VALUE = Number.NEGATIVE_INFINITY;
|
|
27
|
+
const INITIAL_SNAP_POINT = -999;
|
|
28
|
+
const INITIAL_POSITION = SCREEN_HEIGHT;
|
|
29
|
+
|
|
30
|
+
// accessibility
|
|
31
|
+
const DEFAULT_ACCESSIBLE = true;
|
|
32
|
+
const DEFAULT_ACCESSIBILITY_LABEL = 'Bottom Sheet';
|
|
33
|
+
const DEFAULT_ACCESSIBILITY_ROLE = 'adjustable';
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
DEFAULT_HANDLE_HEIGHT,
|
|
37
|
+
DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,
|
|
38
|
+
DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,
|
|
39
|
+
DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,
|
|
40
|
+
DEFAULT_ENABLE_OVER_DRAG,
|
|
41
|
+
DEFAULT_ENABLE_PAN_DOWN_TO_CLOSE,
|
|
42
|
+
DEFAULT_DYNAMIC_SIZING,
|
|
43
|
+
DEFAULT_ANIMATE_ON_MOUNT,
|
|
44
|
+
// keyboard
|
|
45
|
+
DEFAULT_KEYBOARD_BEHAVIOR,
|
|
46
|
+
DEFAULT_KEYBOARD_BLUR_BEHAVIOR,
|
|
47
|
+
DEFAULT_KEYBOARD_INPUT_MODE,
|
|
48
|
+
DEFAULT_ENABLE_BLUR_KEYBOARD_ON_GESTURE,
|
|
49
|
+
DEFAULT_KEYBOARD_INDEX,
|
|
50
|
+
// layout
|
|
51
|
+
INITIAL_POSITION,
|
|
52
|
+
INITIAL_SNAP_POINT,
|
|
53
|
+
INITIAL_VALUE,
|
|
54
|
+
// accessibility
|
|
55
|
+
DEFAULT_ACCESSIBLE,
|
|
56
|
+
DEFAULT_ACCESSIBILITY_LABEL,
|
|
57
|
+
DEFAULT_ACCESSIBILITY_ROLE,
|
|
58
|
+
};
|