@draftbit/core 49.7.6 → 49.7.7-ba2f6c.2
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/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +1 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheet.js +8 -3
- package/lib/typescript/src/components/BottomSheet/BottomSheet.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/BottomSheet/BottomSheet.js +8 -3
- package/src/components/BottomSheet/BottomSheet.js.map +1 -1
- package/src/components/BottomSheet/BottomSheet.tsx +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "49.7.
|
|
3
|
+
"version": "49.7.7-ba2f6c.2+ba2f6c0",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@dotlottie/react-player": "1.6.1",
|
|
44
44
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
45
|
-
"@draftbit/theme": "49.7.
|
|
45
|
+
"@draftbit/theme": "^49.7.7-ba2f6c.2+ba2f6c0",
|
|
46
46
|
"@expo/vector-icons": "^13.0.0",
|
|
47
47
|
"@gorhom/bottom-sheet": "5.0.0-alpha.7",
|
|
48
48
|
"@lottiefiles/react-lottie-player": "3.5.3",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
],
|
|
121
121
|
"testEnvironment": "node"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "ba2f6c09749aac6bf01271ef53289e32024bae12"
|
|
124
124
|
}
|
|
@@ -7,7 +7,7 @@ const windowHeight = Dimensions.get("window").height;
|
|
|
7
7
|
// Clarification:
|
|
8
8
|
// Input of snap points is sorted top -> bottom where each value represents distance from top
|
|
9
9
|
// Implementation using `@gorhom/bottom-sheet` is sorted bottom -> top where each value represents distance from bottom
|
|
10
|
-
const BottomSheet = React.forwardRef(({ snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor, topBorderRadius = 20, borderWidth = 1, borderColor, onSettle, style, children, ...rest }, ref) => {
|
|
10
|
+
const BottomSheet = React.forwardRef(({ snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor, topBorderRadius = 20, borderWidth = 1, borderColor, enableDynamicSizing = true, onSettle, style, children, ...rest }, ref) => {
|
|
11
11
|
const theme = useTheme();
|
|
12
12
|
const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background.brand;
|
|
13
13
|
const snapPoints = snapPointsProp !== null && snapPointsProp !== void 0 ? snapPointsProp : [
|
|
@@ -26,7 +26,7 @@ const BottomSheet = React.forwardRef(({ snapPoints: snapPointsProp, topSnapPosit
|
|
|
26
26
|
return 2;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
return (React.createElement(BottomSheetComponent, { ref: ref, snapPoints: mappedSnapPoints, index: initialSnapIndex !== undefined
|
|
29
|
+
return (React.createElement(BottomSheetComponent, { ref: ref, enableDynamicSizing: enableDynamicSizing, snapPoints: mappedSnapPoints, index: initialSnapIndex !== undefined
|
|
30
30
|
? mappedSnapPoints.length - initialSnapIndex - 1
|
|
31
31
|
: getSnapIndexFromPosition(initialSnapPosition), handleIndicatorStyle: [
|
|
32
32
|
{ backgroundColor: handleColor !== null && handleColor !== void 0 ? handleColor : theme.colors.border.brand },
|
|
@@ -37,7 +37,12 @@ const BottomSheet = React.forwardRef(({ snapPoints: snapPointsProp, topSnapPosit
|
|
|
37
37
|
borderTopRightRadius: topBorderRadius,
|
|
38
38
|
borderWidth,
|
|
39
39
|
borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : theme.colors.border.brand,
|
|
40
|
-
}, onChange: (index) =>
|
|
40
|
+
}, onChange: (index) =>
|
|
41
|
+
// Convert bottom-sheet index to match our top-to-bottom ordering
|
|
42
|
+
// When dynamic sizing is enabled, we don't need to subtract 1 since an extra snap point may be added
|
|
43
|
+
enableDynamicSizing
|
|
44
|
+
? onSettle === null || onSettle === void 0 ? void 0 : onSettle(mappedSnapPoints.length - index)
|
|
45
|
+
: onSettle === null || onSettle === void 0 ? void 0 : onSettle(mappedSnapPoints.length - index - 1) },
|
|
41
46
|
React.createElement(BottomSheetScrollView, { contentContainerStyle: [styles.contentContainerStyle, style], ...rest }, children)));
|
|
42
47
|
});
|
|
43
48
|
// @gorhom/bottom-sheet has a different format for snap points and requires some manipulation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,EAIV,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,oBAAoB,EAAE,EAC3B,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI3E,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,EAIV,UAAU,GAC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B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,6FAA6F;AAC7F,SAAS,qCAAqC,CAC5C,UAA+B;IAE/B,qGAAqG;IACrG,MAAM,kBAAkB,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;IAErD,oHAAoH;IACpH,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,aAAa,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAClD,IAAI,aAAa,KAAK,SAAS,EAAE;gBAC/B,OAAO,GAAG,GAAG,GAAG,aAAa,GAAG,CAAC;aAClC;YACD,OAAO,KAAK,CAAC;SACd;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACpC,OAAO,YAAY,GAAG,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,qBAAqB,EAAE;QACrB,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;KACpB;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -35,6 +35,7 @@ export interface BottomSheetProps extends ScrollViewProps {
|
|
|
35
35
|
topBorderRadius?: number;
|
|
36
36
|
borderWidth?: number;
|
|
37
37
|
borderColor?: string;
|
|
38
|
+
enableDynamicSizing?: boolean;
|
|
38
39
|
onSettle?: (index: number) => void;
|
|
39
40
|
style?: StyleProp<ViewStyle>;
|
|
40
41
|
}
|
|
@@ -56,6 +57,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
|
56
57
|
topBorderRadius = 20,
|
|
57
58
|
borderWidth = 1,
|
|
58
59
|
borderColor,
|
|
60
|
+
enableDynamicSizing = true,
|
|
59
61
|
onSettle,
|
|
60
62
|
style,
|
|
61
63
|
children,
|
|
@@ -92,6 +94,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
|
92
94
|
return (
|
|
93
95
|
<BottomSheetComponent
|
|
94
96
|
ref={ref}
|
|
97
|
+
enableDynamicSizing={enableDynamicSizing}
|
|
95
98
|
snapPoints={mappedSnapPoints}
|
|
96
99
|
index={
|
|
97
100
|
initialSnapIndex !== undefined
|
|
@@ -109,7 +112,13 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
|
109
112
|
borderWidth,
|
|
110
113
|
borderColor: borderColor ?? theme.colors.border.brand,
|
|
111
114
|
}}
|
|
112
|
-
onChange={(index) =>
|
|
115
|
+
onChange={(index) =>
|
|
116
|
+
// Convert bottom-sheet index to match our top-to-bottom ordering
|
|
117
|
+
// When dynamic sizing is enabled, we don't need to subtract 1 since an extra snap point may be added
|
|
118
|
+
enableDynamicSizing
|
|
119
|
+
? onSettle?.(mappedSnapPoints.length - index)
|
|
120
|
+
: onSettle?.(mappedSnapPoints.length - index - 1)
|
|
121
|
+
}
|
|
113
122
|
>
|
|
114
123
|
<BottomSheetScrollView
|
|
115
124
|
contentContainerStyle={[styles.contentContainerStyle, style]}
|