@umituz/react-native-bottom-sheet 1.2.8 → 1.2.9
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/package.json +1 -1
- package/src/domain/entities/BottomSheet.ts +65 -0
- package/src/index.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-bottom-sheet",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "Modern, performant bottom sheets for React Native with preset configurations, keyboard handling, and smooth animations",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type SnapPoint = string | number;
|
|
4
|
+
|
|
5
|
+
export type BottomSheetPreset = 'small' | 'medium' | 'large' | 'full' | 'custom';
|
|
6
|
+
|
|
7
|
+
export type KeyboardBehavior = 'interactive' | 'extend' | 'fillParent';
|
|
8
|
+
|
|
9
|
+
export interface BottomSheetConfig {
|
|
10
|
+
snapPoints: SnapPoint[];
|
|
11
|
+
initialIndex?: number;
|
|
12
|
+
enableBackdrop?: boolean;
|
|
13
|
+
backdropAppearsOnIndex?: number;
|
|
14
|
+
backdropDisappearsOnIndex?: number;
|
|
15
|
+
keyboardBehavior?: KeyboardBehavior;
|
|
16
|
+
enableHandleIndicator?: boolean;
|
|
17
|
+
enablePanDownToClose?: boolean;
|
|
18
|
+
enableDynamicSizing?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const BottomSheetUtils = {
|
|
22
|
+
getPreset: (preset: BottomSheetPreset): BottomSheetConfig => {
|
|
23
|
+
switch (preset) {
|
|
24
|
+
case 'small':
|
|
25
|
+
return {
|
|
26
|
+
snapPoints: ['25%'],
|
|
27
|
+
enableBackdrop: true,
|
|
28
|
+
enablePanDownToClose: true,
|
|
29
|
+
};
|
|
30
|
+
case 'medium':
|
|
31
|
+
return {
|
|
32
|
+
snapPoints: ['50%'],
|
|
33
|
+
enableBackdrop: true,
|
|
34
|
+
enablePanDownToClose: true,
|
|
35
|
+
};
|
|
36
|
+
case 'large':
|
|
37
|
+
return {
|
|
38
|
+
snapPoints: ['90%'],
|
|
39
|
+
enableBackdrop: true,
|
|
40
|
+
enablePanDownToClose: true,
|
|
41
|
+
};
|
|
42
|
+
case 'full':
|
|
43
|
+
return {
|
|
44
|
+
snapPoints: ['100%'],
|
|
45
|
+
enableBackdrop: true,
|
|
46
|
+
enablePanDownToClose: false,
|
|
47
|
+
};
|
|
48
|
+
default:
|
|
49
|
+
return {
|
|
50
|
+
snapPoints: ['50%'],
|
|
51
|
+
enableBackdrop: true,
|
|
52
|
+
enablePanDownToClose: true,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
createConfig: (config: Partial<BottomSheetConfig>): BottomSheetConfig => {
|
|
58
|
+
return {
|
|
59
|
+
snapPoints: ['50%'],
|
|
60
|
+
enableBackdrop: true,
|
|
61
|
+
enablePanDownToClose: true,
|
|
62
|
+
...config,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './presentation/components/BottomSheet';
|
|
2
|
+
export * from './presentation/components/BottomSheetModal';
|
|
3
|
+
export * from './presentation/components/SafeBottomSheetModalProvider';
|
|
4
|
+
export * from './presentation/hooks/useBottomSheet';
|
|
5
|
+
export * from './presentation/hooks/useBottomSheetModal';
|
|
6
|
+
export * from './domain/entities/BottomSheet';
|