@draftbit/core 50.2.3-67f2d7.2 → 50.2.3-9ed7ea.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 +2 -4
- package/lib/typescript/src/components/BottomSheet/BottomSheet.js +6 -5
- 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 +6 -5
- package/src/components/BottomSheet/BottomSheet.js.map +1 -1
- package/src/components/BottomSheet/BottomSheet.tsx +7 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "50.2.3-
|
|
3
|
+
"version": "50.2.3-9ed7ea.2+9ed7ea6",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/theme": "^50.2.3-
|
|
44
|
+
"@draftbit/theme": "^50.2.3-9ed7ea.2+9ed7ea6",
|
|
45
45
|
"@expo/vector-icons": "^14.0.0",
|
|
46
46
|
"@gorhom/bottom-sheet": "5.0.0-alpha.7",
|
|
47
47
|
"@material-ui/core": "^4.11.0",
|
|
@@ -118,5 +118,5 @@
|
|
|
118
118
|
],
|
|
119
119
|
"testEnvironment": "node"
|
|
120
120
|
},
|
|
121
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "9ed7ea68eb2d6dd2cd9079307c9b9509da621177"
|
|
122
122
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyleSheet, Dimensions, } from "react-native";
|
|
3
3
|
import BottomSheetComponent, { BottomSheetScrollView, } from "@gorhom/bottom-sheet";
|
|
4
|
-
import {
|
|
4
|
+
import { useTheme } from "@draftbit/theme";
|
|
5
5
|
import { useDeepCompareMemo } from "../../utilities";
|
|
6
6
|
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(({
|
|
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) => {
|
|
11
|
+
const theme = useTheme();
|
|
11
12
|
const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background.brand;
|
|
12
13
|
const snapPoints = snapPointsProp !== null && snapPointsProp !== void 0 ? snapPointsProp : [
|
|
13
14
|
topSnapPosition,
|
|
@@ -28,14 +29,14 @@ const BottomSheet = React.forwardRef(({ theme, snapPoints: snapPointsProp, topSn
|
|
|
28
29
|
return (React.createElement(BottomSheetComponent, { ref: ref, snapPoints: mappedSnapPoints, index: initialSnapIndex !== undefined
|
|
29
30
|
? mappedSnapPoints.length - initialSnapIndex - 1
|
|
30
31
|
: getSnapIndexFromPosition(initialSnapPosition), handleIndicatorStyle: [
|
|
31
|
-
{ backgroundColor: handleColor },
|
|
32
|
+
{ backgroundColor: handleColor !== null && handleColor !== void 0 ? handleColor : theme.colors.border.brand },
|
|
32
33
|
!showHandle ? { display: "none" } : {},
|
|
33
34
|
], backgroundStyle: {
|
|
34
35
|
backgroundColor,
|
|
35
36
|
borderTopLeftRadius: topBorderRadius,
|
|
36
37
|
borderTopRightRadius: topBorderRadius,
|
|
37
38
|
borderWidth,
|
|
38
|
-
borderColor,
|
|
39
|
+
borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : theme.colors.border.brand,
|
|
39
40
|
}, onChange: (index) => onSettle === null || onSettle === void 0 ? void 0 : onSettle(mappedSnapPoints.length - index - 1) },
|
|
40
41
|
React.createElement(BottomSheetScrollView, { contentContainerStyle: [styles.contentContainerStyle, style], ...rest }, children)));
|
|
41
42
|
});
|
|
@@ -77,5 +78,5 @@ const styles = StyleSheet.create({
|
|
|
77
78
|
paddingVertical: 10,
|
|
78
79
|
},
|
|
79
80
|
});
|
|
80
|
-
export default
|
|
81
|
+
export default BottomSheet;
|
|
81
82
|
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -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;
|
|
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,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIrD,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;AAwBrD,iBAAiB;AACjB,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YAAY,GAAG,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAAC,aAAqB;IACjD,MAAM,YAAY,GAAG,SAAS,CAAC;IAC/B,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,EAAE;QACnB,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,aAAa,CAAC;SACtB;KACF;IACD,OAAO,SAAS,CAAC;AACnB,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"}
|
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
import BottomSheetComponent, {
|
|
11
11
|
BottomSheetScrollView,
|
|
12
12
|
} from "@gorhom/bottom-sheet";
|
|
13
|
-
import
|
|
14
|
-
import { withTheme } from "@draftbit/theme";
|
|
13
|
+
import { useTheme } from "@draftbit/theme";
|
|
15
14
|
import { useDeepCompareMemo } from "../../utilities";
|
|
16
15
|
|
|
17
16
|
type SnapPosition = "top" | "middle" | "bottom";
|
|
@@ -38,7 +37,6 @@ export interface BottomSheetProps extends ScrollViewProps {
|
|
|
38
37
|
borderColor?: string;
|
|
39
38
|
onSettle?: (index: number) => void;
|
|
40
39
|
style?: StyleProp<ViewStyle>;
|
|
41
|
-
theme: ReadTheme;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
// Clarification:
|
|
@@ -47,7 +45,6 @@ export interface BottomSheetProps extends ScrollViewProps {
|
|
|
47
45
|
const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
48
46
|
(
|
|
49
47
|
{
|
|
50
|
-
theme,
|
|
51
48
|
snapPoints: snapPointsProp,
|
|
52
49
|
topSnapPosition = "10%",
|
|
53
50
|
middleSnapPosition = "50%",
|
|
@@ -55,10 +52,10 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
|
55
52
|
initialSnapIndex,
|
|
56
53
|
initialSnapPosition = "bottom",
|
|
57
54
|
showHandle = true,
|
|
58
|
-
handleColor
|
|
55
|
+
handleColor,
|
|
59
56
|
topBorderRadius = 20,
|
|
60
57
|
borderWidth = 1,
|
|
61
|
-
borderColor
|
|
58
|
+
borderColor,
|
|
62
59
|
onSettle,
|
|
63
60
|
style,
|
|
64
61
|
children,
|
|
@@ -66,6 +63,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
|
66
63
|
},
|
|
67
64
|
ref
|
|
68
65
|
) => {
|
|
66
|
+
const theme = useTheme();
|
|
69
67
|
const backgroundColor =
|
|
70
68
|
(style as ViewStyle)?.backgroundColor || theme.colors.background.brand;
|
|
71
69
|
|
|
@@ -101,7 +99,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
|
101
99
|
: getSnapIndexFromPosition(initialSnapPosition)
|
|
102
100
|
}
|
|
103
101
|
handleIndicatorStyle={[
|
|
104
|
-
{ backgroundColor: handleColor },
|
|
102
|
+
{ backgroundColor: handleColor ?? theme.colors.border.brand },
|
|
105
103
|
!showHandle ? { display: "none" } : {},
|
|
106
104
|
]}
|
|
107
105
|
backgroundStyle={{
|
|
@@ -109,7 +107,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
|
|
|
109
107
|
borderTopLeftRadius: topBorderRadius,
|
|
110
108
|
borderTopRightRadius: topBorderRadius,
|
|
111
109
|
borderWidth,
|
|
112
|
-
borderColor,
|
|
110
|
+
borderColor: borderColor ?? theme.colors.border.brand,
|
|
113
111
|
}}
|
|
114
112
|
onChange={(index) => onSettle?.(mappedSnapPoints.length - index - 1)}
|
|
115
113
|
>
|
|
@@ -166,4 +164,4 @@ const styles = StyleSheet.create({
|
|
|
166
164
|
},
|
|
167
165
|
});
|
|
168
166
|
|
|
169
|
-
export default
|
|
167
|
+
export default BottomSheet;
|