@draftbit/core 46.4.4-287a83.2 → 46.4.4-2fce56.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.
Files changed (53) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +25 -5
  2. package/lib/commonjs/components/CircleImage.js +2 -16
  3. package/lib/commonjs/index.js +0 -8
  4. package/lib/commonjs/mappings/TextField.js +12 -2
  5. package/lib/module/components/CardContainerShortImage.js +5 -19
  6. package/lib/module/components/Carousel.js +10 -35
  7. package/lib/module/components/CircleImage.js +2 -17
  8. package/lib/module/components/DeprecatedButton.js +4 -21
  9. package/lib/module/components/NumberInput.js +2 -13
  10. package/lib/module/components/RadioButton/RadioButton.js +2 -15
  11. package/lib/module/components/Touchable.js +2 -18
  12. package/lib/module/constants.js +0 -1
  13. package/lib/module/index.js +0 -1
  14. package/lib/module/mappings/TextField.js +12 -2
  15. package/lib/typescript/src/index.d.ts +0 -1
  16. package/lib/typescript/src/index.d.ts.map +1 -1
  17. package/lib/typescript/src/mappings/TextField.d.ts +20 -0
  18. package/lib/typescript/src/mappings/TextField.d.ts.map +1 -1
  19. package/package.json +3 -5
  20. package/src/index.js +0 -1
  21. package/src/index.tsx +0 -1
  22. package/src/mappings/TextField.js +12 -2
  23. package/src/mappings/TextField.ts +12 -2
  24. package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +0 -68
  25. package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +0 -97
  26. package/lib/commonjs/components/BottomSheet/index.js +0 -15
  27. package/lib/commonjs/components/BottomSheet/types.js +0 -5
  28. package/lib/commonjs/mappings/BottomSheet.js +0 -22
  29. package/lib/module/components/BottomSheet/BottomSheet.native.js +0 -50
  30. package/lib/module/components/BottomSheet/BottomSheet.web.js +0 -78
  31. package/lib/module/components/BottomSheet/index.js +0 -2
  32. package/lib/module/components/BottomSheet/types.js +0 -1
  33. package/lib/module/mappings/BottomSheet.js +0 -13
  34. package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +0 -5
  35. package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts.map +0 -1
  36. package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +0 -5
  37. package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts.map +0 -1
  38. package/lib/typescript/src/components/BottomSheet/index.d.ts +0 -2
  39. package/lib/typescript/src/components/BottomSheet/index.d.ts.map +0 -1
  40. package/lib/typescript/src/components/BottomSheet/types.d.ts +0 -9
  41. package/lib/typescript/src/components/BottomSheet/types.d.ts.map +0 -1
  42. package/lib/typescript/src/mappings/BottomSheet.d.ts +0 -20
  43. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +0 -1
  44. package/src/components/BottomSheet/BottomSheet.native.js +0 -37
  45. package/src/components/BottomSheet/BottomSheet.native.tsx +0 -60
  46. package/src/components/BottomSheet/BottomSheet.web.js +0 -56
  47. package/src/components/BottomSheet/BottomSheet.web.tsx +0 -90
  48. package/src/components/BottomSheet/index.js +0 -2
  49. package/src/components/BottomSheet/index.tsx +0 -2
  50. package/src/components/BottomSheet/types.js +0 -1
  51. package/src/components/BottomSheet/types.tsx +0 -8
  52. package/src/mappings/BottomSheet.js +0 -20
  53. package/src/mappings/BottomSheet.ts +0 -25
@@ -77,7 +77,7 @@ const SEED_DATA_PROPS = {
77
77
  propType: PROP_TYPES.BOOLEAN,
78
78
  },
79
79
  disabled: {
80
- group: GROUPS.basic,
80
+ group: GROUPS.data,
81
81
  label: "Disabled",
82
82
  description:
83
83
  "Whether the input should be disabled. Will prevent input and show a greyed out state.",
@@ -88,7 +88,7 @@ const SEED_DATA_PROPS = {
88
88
  required: false,
89
89
  },
90
90
  editable: {
91
- group: GROUPS.advanced,
91
+ group: GROUPS.data,
92
92
  label: "Editable",
93
93
  description: "If false, the text is not editable",
94
94
  editable: true,
@@ -97,6 +97,16 @@ const SEED_DATA_PROPS = {
97
97
  formType: FORM_TYPES.boolean,
98
98
  propType: PROP_TYPES.BOOLEAN,
99
99
  },
100
+ blurOnSubmit: {
101
+ group: GROUPS.advanced,
102
+ label: "Blur On Submit",
103
+ description: "If true, the text field will blur when submitted. ",
104
+ editable: true,
105
+ required: false,
106
+ defaultValue: null,
107
+ formType: FORM_TYPES.boolean,
108
+ propType: PROP_TYPES.BOOLEAN,
109
+ },
100
110
  keyboardAppearance: {
101
111
  group: GROUPS.advanced,
102
112
  label: "Keyboard Appearance",
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
13
-
14
- var _utilities = require("../../utilities");
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
- const BottomSheetComponent = _ref => {
21
- let {
22
- style,
23
- children,
24
- step
25
- } = _ref;
26
- const bottomSheetRef = (0, _react.useRef)(null);
27
- const {
28
- viewStyles
29
- } = (0, _utilities.extractStyles)(style); // variables
30
-
31
- const snapPoints = (0, _react.useMemo)(() => ["25%", "50%", "90%"], []); // callbacks
32
-
33
- const handleSheetChanges = (0, _react.useCallback)(index => {
34
- console.log("handleSheetChanges", index);
35
- }, []);
36
-
37
- _react.default.useEffect(() => {
38
- if (step === -1) {
39
- var _bottomSheetRef$curre;
40
-
41
- bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
42
- }
43
- }, [step]);
44
-
45
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
46
- style: [containerStyle.container, viewStyles, {
47
- backgroundColor: step !== -1 ? "grey" : "transparent"
48
- }]
49
- }, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, {
50
- ref: bottomSheetRef,
51
- index: step,
52
- snapPoints: snapPoints,
53
- onChange: handleSheetChanges
54
- }, /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetView, null, children)));
55
- };
56
-
57
- var _default = BottomSheetComponent;
58
- exports.default = _default;
59
-
60
- const containerStyle = _reactNative.StyleSheet.create({
61
- container: {
62
- flex: 1
63
- },
64
- contentContainer: {
65
- flex: 1,
66
- alignItems: "center"
67
- }
68
- });
@@ -1,97 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _reactNativeScrollBottomSheet = _interopRequireDefault(require("react-native-scroll-bottom-sheet"));
13
-
14
- var _utilities = require("../../utilities");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- const windowHeight = _reactNative.Dimensions.get("window").height;
19
-
20
- const BottomSheetComponent = _ref => {
21
- let {
22
- style,
23
- children,
24
- step
25
- } = _ref;
26
- const {
27
- viewStyles
28
- } = (0, _utilities.extractStyles)(style);
29
-
30
- const bottomSheetRef = _react.default.useRef();
31
-
32
- const webStep = _react.default.useMemo(() => step + 1, [step]);
33
-
34
- const snapPoints = _react.default.useMemo(() => ["25%", "50%", windowHeight - 200], []);
35
-
36
- _react.default.useEffect(() => {
37
- var _bottomSheetRef$curre;
38
-
39
- bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep); // bottomSheetRef.current.snapTo(step);
40
- }, [webStep, step, snapPoints]);
41
-
42
- if (step === -1) {
43
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
44
- }
45
-
46
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
47
- style: styles.container
48
- }, /*#__PURE__*/_react.default.createElement(_reactNativeScrollBottomSheet.default, {
49
- ref: bottomSheetRef,
50
- componentType: "ScrollView",
51
- snapPoints: snapPoints,
52
- initialSnapIndex: 0,
53
- renderHandle: () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
54
- style: styles.header
55
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
56
- style: styles.panelHandle
57
- })),
58
- contentContainerStyle: styles.contentContainerStyle
59
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
60
- style: { ...styles.container,
61
- ...viewStyles,
62
- backgroundColor: webStep !== -1 ? "grey" : "transparent"
63
- }
64
- }, children)));
65
- };
66
-
67
- var _default = BottomSheetComponent;
68
- exports.default = _default;
69
-
70
- const styles = _reactNative.StyleSheet.create({
71
- container: {
72
- flex: 1
73
- },
74
- contentContainerStyle: {
75
- padding: 16
76
- },
77
- header: {
78
- alignItems: "center",
79
- backgroundColor: "white",
80
- paddingVertical: 20,
81
- borderTopLeftRadius: 20,
82
- borderTopRightRadius: 20
83
- },
84
- panelHandle: {
85
- width: 40,
86
- height: 2,
87
- backgroundColor: "rgba(0,0,0,0.3)",
88
- borderRadius: 4
89
- },
90
- item: {
91
- padding: 20,
92
- justifyContent: "center",
93
- backgroundColor: "white",
94
- alignItems: "center",
95
- marginVertical: 10
96
- }
97
- });
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "BottomSheet", {
7
- enumerable: true,
8
- get: function () {
9
- return _BottomSheet.default;
10
- }
11
- });
12
-
13
- var _BottomSheet = _interopRequireDefault(require("./BottomSheet"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
-
8
- var _types = require("@draftbit/types");
9
-
10
- const SEED_DATA = {
11
- name: "Bottom Sheet",
12
- tag: "BottomSheet",
13
- category: _types.COMPONENT_TYPES.container,
14
- stylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
15
- props: {
16
- step: (0, _types.createNumberProp)({
17
- label: "Step",
18
- description: "Step can be -1, 0, 1, or 2."
19
- })
20
- }
21
- };
22
- exports.SEED_DATA = SEED_DATA;
@@ -1,50 +0,0 @@
1
- import React, { useCallback, useMemo, useRef } from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
4
- import { extractStyles } from "../../utilities";
5
-
6
- const BottomSheetComponent = _ref => {
7
- let {
8
- style,
9
- children,
10
- step
11
- } = _ref;
12
- const bottomSheetRef = useRef(null);
13
- const {
14
- viewStyles
15
- } = extractStyles(style); // variables
16
-
17
- const snapPoints = useMemo(() => ["25%", "50%", "90%"], []); // callbacks
18
-
19
- const handleSheetChanges = useCallback(index => {
20
- console.log("handleSheetChanges", index);
21
- }, []);
22
- React.useEffect(() => {
23
- if (step === -1) {
24
- var _bottomSheetRef$curre;
25
-
26
- bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
27
- }
28
- }, [step]);
29
- return /*#__PURE__*/React.createElement(View, {
30
- style: [containerStyle.container, viewStyles, {
31
- backgroundColor: step !== -1 ? "grey" : "transparent"
32
- }]
33
- }, /*#__PURE__*/React.createElement(BottomSheet, {
34
- ref: bottomSheetRef,
35
- index: step,
36
- snapPoints: snapPoints,
37
- onChange: handleSheetChanges
38
- }, /*#__PURE__*/React.createElement(BottomSheetView, null, children)));
39
- };
40
-
41
- export default BottomSheetComponent;
42
- const containerStyle = StyleSheet.create({
43
- container: {
44
- flex: 1
45
- },
46
- contentContainer: {
47
- flex: 1,
48
- alignItems: "center"
49
- }
50
- });
@@ -1,78 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, View, Dimensions } from "react-native";
3
- import ScrollBottomSheet from "react-native-scroll-bottom-sheet";
4
- import { extractStyles } from "../../utilities";
5
- const windowHeight = Dimensions.get("window").height;
6
-
7
- const BottomSheetComponent = _ref => {
8
- let {
9
- style,
10
- children,
11
- step
12
- } = _ref;
13
- const {
14
- viewStyles
15
- } = extractStyles(style);
16
- const bottomSheetRef = React.useRef();
17
- const webStep = React.useMemo(() => step + 1, [step]);
18
- const snapPoints = React.useMemo(() => ["25%", "50%", windowHeight - 200], []);
19
- React.useEffect(() => {
20
- var _bottomSheetRef$curre;
21
-
22
- bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep); // bottomSheetRef.current.snapTo(step);
23
- }, [webStep, step, snapPoints]);
24
-
25
- if (step === -1) {
26
- return /*#__PURE__*/React.createElement(React.Fragment, null);
27
- }
28
-
29
- return /*#__PURE__*/React.createElement(View, {
30
- style: styles.container
31
- }, /*#__PURE__*/React.createElement(ScrollBottomSheet, {
32
- ref: bottomSheetRef,
33
- componentType: "ScrollView",
34
- snapPoints: snapPoints,
35
- initialSnapIndex: 0,
36
- renderHandle: () => /*#__PURE__*/React.createElement(View, {
37
- style: styles.header
38
- }, /*#__PURE__*/React.createElement(View, {
39
- style: styles.panelHandle
40
- })),
41
- contentContainerStyle: styles.contentContainerStyle
42
- }, /*#__PURE__*/React.createElement(View, {
43
- style: { ...styles.container,
44
- ...viewStyles,
45
- backgroundColor: webStep !== -1 ? "grey" : "transparent"
46
- }
47
- }, children)));
48
- };
49
-
50
- export default BottomSheetComponent;
51
- const styles = StyleSheet.create({
52
- container: {
53
- flex: 1
54
- },
55
- contentContainerStyle: {
56
- padding: 16
57
- },
58
- header: {
59
- alignItems: "center",
60
- backgroundColor: "white",
61
- paddingVertical: 20,
62
- borderTopLeftRadius: 20,
63
- borderTopRightRadius: 20
64
- },
65
- panelHandle: {
66
- width: 40,
67
- height: 2,
68
- backgroundColor: "rgba(0,0,0,0.3)",
69
- borderRadius: 4
70
- },
71
- item: {
72
- padding: 20,
73
- justifyContent: "center",
74
- backgroundColor: "white",
75
- alignItems: "center",
76
- marginVertical: 10
77
- }
78
- });
@@ -1,2 +0,0 @@
1
- //@ts-ignore
2
- export { default as BottomSheet } from "./BottomSheet";
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import { COMPONENT_TYPES, createNumberProp, StylesPanelSections } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "Bottom Sheet",
4
- tag: "BottomSheet",
5
- category: COMPONENT_TYPES.container,
6
- stylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
7
- props: {
8
- step: createNumberProp({
9
- label: "Step",
10
- description: "Step can be -1, 0, 1, or 2."
11
- })
12
- }
13
- };
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- import { BottomSheetProps } from "./types";
3
- declare const BottomSheetComponent: React.FC<BottomSheetProps>;
4
- export default BottomSheetComponent;
5
- //# sourceMappingURL=BottomSheet.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BottomSheet.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/BottomSheet/BottomSheet.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwCpD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- import { BottomSheetProps } from "./types";
3
- declare const BottomSheetComponent: React.FC<BottomSheetProps>;
4
- export default BottomSheetComponent;
5
- //# sourceMappingURL=BottomSheet.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BottomSheet.web.d.ts","sourceRoot":"","sources":["../../../../../src/components/BottomSheet/BottomSheet.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAI3C,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAiDpD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default as BottomSheet } from "./BottomSheet";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/BottomSheet/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { StyleProp, ViewStyle, TextStyle } from "react-native";
3
- export interface BottomSheetProps {
4
- style: StyleProp<ViewStyle | TextStyle>;
5
- children: React.ReactNode;
6
- step: number;
7
- isOpen?: Boolean;
8
- }
9
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/BottomSheet/types.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -1,20 +0,0 @@
1
- export declare const SEED_DATA: {
2
- name: string;
3
- tag: string;
4
- category: string;
5
- stylesPanelSections: string[];
6
- props: {
7
- step: {
8
- label: string;
9
- description: string;
10
- formType: string;
11
- propType: string;
12
- group: string;
13
- defaultValue: null;
14
- editable: boolean;
15
- required: boolean;
16
- step: number;
17
- };
18
- };
19
- };
20
- //# sourceMappingURL=BottomSheet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/mappings/BottomSheet.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAkBrB,CAAC"}
@@ -1,37 +0,0 @@
1
- import React, { useCallback, useMemo, useRef } from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
4
- import { extractStyles } from "../../utilities";
5
- const BottomSheetComponent = ({ style, children, step, }) => {
6
- const bottomSheetRef = useRef(null);
7
- const { viewStyles } = extractStyles(style);
8
- // variables
9
- const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
10
- // callbacks
11
- const handleSheetChanges = useCallback((index) => {
12
- console.log("handleSheetChanges", index);
13
- }, []);
14
- React.useEffect(() => {
15
- var _a;
16
- if (step === -1) {
17
- (_a = bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
18
- }
19
- }, [step]);
20
- return (React.createElement(View, { style: [
21
- containerStyle.container,
22
- viewStyles,
23
- { backgroundColor: step !== -1 ? "grey" : "transparent" },
24
- ] },
25
- React.createElement(BottomSheet, { ref: bottomSheetRef, index: step, snapPoints: snapPoints, onChange: handleSheetChanges },
26
- React.createElement(BottomSheetView, null, children))));
27
- };
28
- export default BottomSheetComponent;
29
- const containerStyle = StyleSheet.create({
30
- container: {
31
- flex: 1,
32
- },
33
- contentContainer: {
34
- flex: 1,
35
- alignItems: "center",
36
- },
37
- });
@@ -1,60 +0,0 @@
1
- import React, { useCallback, useMemo, useRef } from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
4
-
5
- import { extractStyles } from "../../utilities";
6
- import { BottomSheetProps } from "./types";
7
-
8
- const BottomSheetComponent: React.FC<BottomSheetProps> = ({
9
- style,
10
- children,
11
- step,
12
- }) => {
13
- const bottomSheetRef = useRef<BottomSheet>(null);
14
- const { viewStyles } = extractStyles(style);
15
-
16
- // variables
17
- const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
18
-
19
- // callbacks
20
- const handleSheetChanges = useCallback((index: number) => {
21
- console.log("handleSheetChanges", index);
22
- }, []);
23
-
24
- React.useEffect(() => {
25
- if (step === -1) {
26
- bottomSheetRef?.current?.close();
27
- }
28
- }, [step]);
29
-
30
- return (
31
- <View
32
- style={[
33
- containerStyle.container,
34
- viewStyles,
35
- { backgroundColor: step !== -1 ? "grey" : "transparent" },
36
- ]}
37
- >
38
- <BottomSheet
39
- ref={bottomSheetRef}
40
- index={step}
41
- snapPoints={snapPoints}
42
- onChange={handleSheetChanges}
43
- >
44
- <BottomSheetView>{children}</BottomSheetView>
45
- </BottomSheet>
46
- </View>
47
- );
48
- };
49
-
50
- export default BottomSheetComponent;
51
-
52
- const containerStyle = StyleSheet.create({
53
- container: {
54
- flex: 1,
55
- },
56
- contentContainer: {
57
- flex: 1,
58
- alignItems: "center",
59
- },
60
- });
@@ -1,56 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, View, Dimensions } from "react-native";
3
- import ScrollBottomSheet from "react-native-scroll-bottom-sheet";
4
- import { extractStyles } from "../../utilities";
5
- const windowHeight = Dimensions.get("window").height;
6
- const BottomSheetComponent = ({ style, children, step, }) => {
7
- const { viewStyles } = extractStyles(style);
8
- const bottomSheetRef = React.useRef();
9
- const webStep = React.useMemo(() => step + 1, [step]);
10
- const snapPoints = React.useMemo(() => ["25%", "50%", windowHeight - 200], []);
11
- React.useEffect(() => {
12
- var _a;
13
- (_a = bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.snapTo(snapPoints.length - webStep);
14
- // bottomSheetRef.current.snapTo(step);
15
- }, [webStep, step, snapPoints]);
16
- if (step === -1) {
17
- return React.createElement(React.Fragment, null);
18
- }
19
- return (React.createElement(View, { style: styles.container },
20
- React.createElement(ScrollBottomSheet, { ref: bottomSheetRef, componentType: "ScrollView", snapPoints: snapPoints, initialSnapIndex: 0, renderHandle: () => (React.createElement(View, { style: styles.header },
21
- React.createElement(View, { style: styles.panelHandle }))), contentContainerStyle: styles.contentContainerStyle },
22
- React.createElement(View, { style: {
23
- ...styles.container,
24
- ...viewStyles,
25
- backgroundColor: webStep !== -1 ? "grey" : "transparent",
26
- } }, children))));
27
- };
28
- export default BottomSheetComponent;
29
- const styles = StyleSheet.create({
30
- container: {
31
- flex: 1,
32
- },
33
- contentContainerStyle: {
34
- padding: 16,
35
- },
36
- header: {
37
- alignItems: "center",
38
- backgroundColor: "white",
39
- paddingVertical: 20,
40
- borderTopLeftRadius: 20,
41
- borderTopRightRadius: 20,
42
- },
43
- panelHandle: {
44
- width: 40,
45
- height: 2,
46
- backgroundColor: "rgba(0,0,0,0.3)",
47
- borderRadius: 4,
48
- },
49
- item: {
50
- padding: 20,
51
- justifyContent: "center",
52
- backgroundColor: "white",
53
- alignItems: "center",
54
- marginVertical: 10,
55
- },
56
- });