@draftbit/core 46.4.4-c18fe1.2 → 46.4.4-d55501.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 (55) hide show
  1. package/lib/commonjs/components/CircleImage.js +1 -15
  2. package/lib/commonjs/components/Container.js +15 -4
  3. package/lib/commonjs/components/Picker/Picker.js +1 -1
  4. package/lib/commonjs/components/TabView/TabView.js +87 -0
  5. package/lib/commonjs/components/TabView/TabViewItem.js +24 -0
  6. package/lib/commonjs/components/TabView/index.js +20 -0
  7. package/lib/commonjs/constants.js +1 -1
  8. package/lib/commonjs/index.js +13 -7
  9. package/lib/commonjs/mappings/TabView.js +77 -0
  10. package/lib/module/components/TabView/TabView.js +79 -0
  11. package/lib/module/components/TabView/TabViewItem.js +17 -0
  12. package/lib/module/components/TabView/index.js +2 -0
  13. package/lib/module/index.js +1 -1
  14. package/lib/module/mappings/TabView.js +70 -0
  15. package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
  16. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
  17. package/lib/typescript/src/components/TabView/index.d.ts +2 -0
  18. package/lib/typescript/src/index.d.ts +1 -1
  19. package/lib/typescript/src/mappings/TabView.d.ts +111 -0
  20. package/package.json +6 -6
  21. package/src/components/TabView/TabView.js +34 -0
  22. package/src/components/TabView/TabView.tsx +97 -0
  23. package/src/components/TabView/TabViewItem.js +5 -0
  24. package/src/components/TabView/TabViewItem.tsx +21 -0
  25. package/src/components/TabView/index.js +2 -0
  26. package/src/components/TabView/index.tsx +2 -0
  27. package/src/index.js +1 -1
  28. package/src/index.tsx +1 -1
  29. package/src/mappings/TabView.js +73 -0
  30. package/src/mappings/TabView.ts +80 -0
  31. package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +0 -58
  32. package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +0 -83
  33. package/lib/commonjs/components/BottomSheet/index.js +0 -13
  34. package/lib/commonjs/components/BottomSheet/types.js +0 -5
  35. package/lib/commonjs/mappings/BottomSheet.js +0 -20
  36. package/lib/module/components/BottomSheet/BottomSheet.native.js +0 -49
  37. package/lib/module/components/BottomSheet/BottomSheet.web.js +0 -75
  38. package/lib/module/components/BottomSheet/index.js +0 -2
  39. package/lib/module/components/BottomSheet/types.js +0 -1
  40. package/lib/module/mappings/BottomSheet.js +0 -13
  41. package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +0 -4
  42. package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +0 -4
  43. package/lib/typescript/src/components/BottomSheet/index.d.ts +0 -1
  44. package/lib/typescript/src/components/BottomSheet/types.d.ts +0 -8
  45. package/lib/typescript/src/mappings/BottomSheet.d.ts +0 -19
  46. package/src/components/BottomSheet/BottomSheet.native.js +0 -37
  47. package/src/components/BottomSheet/BottomSheet.native.tsx +0 -60
  48. package/src/components/BottomSheet/BottomSheet.web.js +0 -56
  49. package/src/components/BottomSheet/BottomSheet.web.tsx +0 -90
  50. package/src/components/BottomSheet/index.js +0 -2
  51. package/src/components/BottomSheet/index.tsx +0 -2
  52. package/src/components/BottomSheet/types.js +0 -1
  53. package/src/components/BottomSheet/types.tsx +0 -8
  54. package/src/mappings/BottomSheet.js +0 -20
  55. package/src/mappings/BottomSheet.ts +0 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.4.4-c18fe1.2+c18fe15",
3
+ "version": "46.4.4-d55501.2+d555017",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,8 +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/types": "^46.4.4-c18fe1.2+c18fe15",
45
- "@gorhom/bottom-sheet": "4.4.5",
44
+ "@draftbit/types": "^46.4.4-d55501.2+d555017",
46
45
  "@material-ui/core": "^4.11.0",
47
46
  "@material-ui/pickers": "^3.2.10",
48
47
  "@react-native-community/slider": "4.2.3",
@@ -55,8 +54,9 @@
55
54
  "lodash.omit": "^4.5.0",
56
55
  "lodash.tonumber": "^4.0.3",
57
56
  "react-native-modal-datetime-picker": "^13.0.0",
58
- "react-native-scroll-bottom-sheet": "0.7.0",
59
- "react-native-svg": "12.3.0",
57
+ "react-native-pager-view": "5.4.24",
58
+ "react-native-svg": "^12.3.0",
59
+ "react-native-tab-view": "^3.3.0",
60
60
  "react-native-typography": "^1.4.1",
61
61
  "react-native-web-swiper": "^2.2.3"
62
62
  },
@@ -83,5 +83,5 @@
83
83
  ]
84
84
  ]
85
85
  },
86
- "gitHead": "c18fe15af829dd9dbc224859aeda8cc5bda518dc"
86
+ "gitHead": "d555017e5aa603f019e5ed48664c4acf7e73a980"
87
87
  }
@@ -0,0 +1,34 @@
1
+ import * as React from "react";
2
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view";
3
+ // import { withTheme } from "../../theming";
4
+ import TabViewItem from "./TabViewItem";
5
+ const TabViewComponent = ({ Icon, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, style, children, }) => {
6
+ const [index, setIndex] = React.useState(0);
7
+ const [routes, setRoutes] = React.useState([]);
8
+ const [tabScenes, setTabScenes] = React.useState({});
9
+ React.useEffect(() => {
10
+ const newRoutes = [];
11
+ const scenes = {};
12
+ React.Children.toArray(children)
13
+ .filter((child) => child.type === TabViewItem)
14
+ .forEach((child) => {
15
+ var _a, _b, _c;
16
+ if ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.id) {
17
+ newRoutes.push({
18
+ key: (_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.id,
19
+ ...child === null || child === void 0 ? void 0 : child.props,
20
+ });
21
+ scenes[(_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.id] = () => child;
22
+ }
23
+ });
24
+ setRoutes(newRoutes);
25
+ setTabScenes(scenes);
26
+ }, [children]);
27
+ const indexChangeHandler = (i) => setIndex(i);
28
+ const renderTabBar = (props) => {
29
+ console.log(props);
30
+ return (React.createElement(TabBar, { ...props, activeColor: activeColor, inactiveColor: inactiveColor, pressColor: pressColor, scrollEnabled: scrollEnabled, indicatorStyle: { backgroundColor: indicatorColor }, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 36 })) : null, style: style }));
31
+ };
32
+ return (React.createElement(TabView, { navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
33
+ };
34
+ export default TabViewComponent;
@@ -0,0 +1,97 @@
1
+ import * as React from "react";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view";
4
+
5
+ // import { withTheme } from "../../theming";
6
+ import TabViewItem from "./TabViewItem";
7
+ import type { IconSlot } from "../../interfaces/Icon";
8
+
9
+ type TabBarPosition = "top" | "bottom";
10
+ type KeyboardDismissMode = "none" | "auto" | "on-drag";
11
+
12
+ type TabViewProps = {
13
+ tabBarPosition?: TabBarPosition;
14
+ keyboardDismissMode?: KeyboardDismissMode;
15
+ swipeEnabled?: boolean;
16
+ scrollEnabled?: boolean;
17
+ activeColor?: string;
18
+ inactiveColor?: string;
19
+ pressColor?: string;
20
+ indicatorColor?: string;
21
+ style?: StyleProp<TextStyle | ViewStyle>;
22
+ children: React.ReactNode;
23
+ } & IconSlot;
24
+
25
+ const TabViewComponent = ({
26
+ Icon,
27
+ tabBarPosition,
28
+ keyboardDismissMode,
29
+ swipeEnabled,
30
+ scrollEnabled,
31
+ activeColor,
32
+ inactiveColor,
33
+ pressColor,
34
+ indicatorColor,
35
+ style,
36
+ children,
37
+ }: TabViewProps) => {
38
+ const [index, setIndex] = React.useState(0);
39
+ const [routes, setRoutes] = React.useState([]);
40
+ const [tabScenes, setTabScenes] = React.useState({});
41
+
42
+ React.useEffect(() => {
43
+ const newRoutes: any = [];
44
+ const scenes: any = {};
45
+
46
+ React.Children.toArray(children)
47
+ .filter((child: any) => child.type === TabViewItem)
48
+ .forEach((child: any) => {
49
+ if (child?.props?.id) {
50
+ newRoutes.push({
51
+ key: child?.props?.id,
52
+ ...child?.props,
53
+ });
54
+ scenes[child?.props?.id] = () => child;
55
+ }
56
+ });
57
+
58
+ setRoutes(newRoutes);
59
+ setTabScenes(scenes);
60
+ }, [children]);
61
+
62
+ const indexChangeHandler = (i: any) => setIndex(i);
63
+
64
+ const renderTabBar = (props: any) => {
65
+ console.log(props);
66
+ return (
67
+ <TabBar
68
+ {...props}
69
+ activeColor={activeColor}
70
+ inactiveColor={inactiveColor}
71
+ pressColor={pressColor}
72
+ scrollEnabled={scrollEnabled}
73
+ indicatorStyle={{ backgroundColor: indicatorColor }}
74
+ renderIcon={({ route, color }) =>
75
+ route?.icon ? (
76
+ <Icon name={route.icon} color={color} size={36} />
77
+ ) : null
78
+ }
79
+ style={style}
80
+ />
81
+ );
82
+ };
83
+
84
+ return (
85
+ <TabView
86
+ navigationState={{ index, routes }}
87
+ renderScene={SceneMap(tabScenes)}
88
+ renderTabBar={renderTabBar}
89
+ onIndexChange={indexChangeHandler}
90
+ tabBarPosition={tabBarPosition}
91
+ keyboardDismissMode={keyboardDismissMode}
92
+ swipeEnabled={swipeEnabled}
93
+ />
94
+ );
95
+ };
96
+
97
+ export default TabViewComponent;
@@ -0,0 +1,5 @@
1
+ const TabViewItem = ({ title, id, icon, children, accessibilityLabel, }) => {
2
+ console.log({ title, id, icon, accessibilityLabel });
3
+ return children;
4
+ };
5
+ export default TabViewItem;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ interface TabViewItemProps {
3
+ title: string;
4
+ id: string;
5
+ icon: string;
6
+ accessibilityLabel: string;
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ const TabViewItem = ({
11
+ title,
12
+ id,
13
+ icon,
14
+ children,
15
+ accessibilityLabel,
16
+ }: TabViewItemProps) => {
17
+ console.log({ title, id, icon, accessibilityLabel });
18
+ return children;
19
+ };
20
+
21
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
package/src/index.js CHANGED
@@ -29,7 +29,7 @@ export { default as Touchable } from "./components/Touchable";
29
29
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
30
30
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
31
31
  export { Swiper, SwiperItem } from "./components/Swiper";
32
- export { BottomSheet } from "./components/BottomSheet";
32
+ export { TabView, TabViewItem } from "./components/TabView";
33
33
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
34
34
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
35
35
  /* Deprecated: Fix or Delete! */
package/src/index.tsx CHANGED
@@ -34,7 +34,7 @@ export {
34
34
  ActionSheetCancel,
35
35
  } from "./components/ActionSheet";
36
36
  export { Swiper, SwiperItem } from "./components/Swiper";
37
- export { BottomSheet } from "./components/BottomSheet";
37
+ export { TabView, TabViewItem } from "./components/TabView";
38
38
 
39
39
  export {
40
40
  Center,
@@ -0,0 +1,73 @@
1
+ import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp, } from "@draftbit/types";
2
+ export const SEED_DATA = [
3
+ {
4
+ name: "Tab View",
5
+ tag: "TabView",
6
+ category: COMPONENT_TYPES.container,
7
+ layout: {},
8
+ props: {
9
+ tabBarPosition: createTextEnumProp({
10
+ label: "Tab Bar Position",
11
+ description: "Tab Bar Position",
12
+ options: ["top", "bottom"],
13
+ defaultValue: "top",
14
+ }),
15
+ keyboardDismissMode: createTextEnumProp({
16
+ label: "Keyboard Dismiss Mode",
17
+ description: "Keyboard Dismiss Mode",
18
+ options: ["auto", "on-drag", "none"],
19
+ defaultValue: "auto",
20
+ }),
21
+ swipeEnabled: createBoolProp({
22
+ label: "Swipe Enabled",
23
+ description: "Swipe Enabled",
24
+ defaultValue: true,
25
+ }),
26
+ scrollEnabled: createBoolProp({
27
+ label: "Scroll Enabled",
28
+ description: "Scroll Enabled",
29
+ defaultValue: true,
30
+ }),
31
+ activeColor: createColorProp({
32
+ label: "Active Color",
33
+ description: "Active Color",
34
+ defaultValue: "primary",
35
+ }),
36
+ inactiveColor: createColorProp({
37
+ label: "Inactive Color",
38
+ description: "Inactive Color",
39
+ defaultValue: null,
40
+ }),
41
+ pressColor: createColorProp({
42
+ label: "Press Color",
43
+ description: "Press Color",
44
+ defaultValue: null,
45
+ }),
46
+ indicatorColor: createColorProp({
47
+ label: "Indicator Color",
48
+ description: "Indicator Color",
49
+ defaultValue: null,
50
+ }),
51
+ },
52
+ },
53
+ {
54
+ name: "Tab View Item",
55
+ tag: "TabViewItem",
56
+ category: COMPONENT_TYPES.container,
57
+ layout: {},
58
+ props: {
59
+ title: createTextProp({
60
+ label: "Title",
61
+ description: "Tab Title",
62
+ }),
63
+ id: createTextProp({
64
+ label: "Id",
65
+ description: "Tab Id",
66
+ }),
67
+ accessibilityLabel: createTextProp({
68
+ label: "Accessibility Label",
69
+ description: "Accessibility Label",
70
+ }),
71
+ },
72
+ },
73
+ ];
@@ -0,0 +1,80 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createTextProp,
4
+ createTextEnumProp,
5
+ createBoolProp,
6
+ createColorProp,
7
+ } from "@draftbit/types";
8
+
9
+ export const SEED_DATA = [
10
+ {
11
+ name: "Tab View",
12
+ tag: "TabView",
13
+ category: COMPONENT_TYPES.container,
14
+ layout: {},
15
+ props: {
16
+ tabBarPosition: createTextEnumProp({
17
+ label: "Tab Bar Position",
18
+ description: "Tab Bar Position",
19
+ options: ["top", "bottom"],
20
+ defaultValue: "top",
21
+ }),
22
+ keyboardDismissMode: createTextEnumProp({
23
+ label: "Keyboard Dismiss Mode",
24
+ description: "Keyboard Dismiss Mode",
25
+ options: ["auto", "on-drag", "none"],
26
+ defaultValue: "auto",
27
+ }),
28
+ swipeEnabled: createBoolProp({
29
+ label: "Swipe Enabled",
30
+ description: "Swipe Enabled",
31
+ defaultValue: true,
32
+ }),
33
+ scrollEnabled: createBoolProp({
34
+ label: "Scroll Enabled",
35
+ description: "Scroll Enabled",
36
+ defaultValue: true,
37
+ }),
38
+ activeColor: createColorProp({
39
+ label: "Active Color",
40
+ description: "Active Color",
41
+ defaultValue: "primary",
42
+ }),
43
+ inactiveColor: createColorProp({
44
+ label: "Inactive Color",
45
+ description: "Inactive Color",
46
+ defaultValue: null,
47
+ }),
48
+ pressColor: createColorProp({
49
+ label: "Press Color",
50
+ description: "Press Color",
51
+ defaultValue: null,
52
+ }),
53
+ indicatorColor: createColorProp({
54
+ label: "Indicator Color",
55
+ description: "Indicator Color",
56
+ defaultValue: null,
57
+ }),
58
+ },
59
+ },
60
+ {
61
+ name: "Tab View Item",
62
+ tag: "TabViewItem",
63
+ category: COMPONENT_TYPES.container,
64
+ layout: {},
65
+ props: {
66
+ title: createTextProp({
67
+ label: "Title",
68
+ description: "Tab Title",
69
+ }),
70
+ id: createTextProp({
71
+ label: "Id",
72
+ description: "Tab Id",
73
+ }),
74
+ accessibilityLabel: createTextProp({
75
+ label: "Accessibility Label",
76
+ description: "Accessibility Label",
77
+ }),
78
+ },
79
+ },
80
+ ];
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
10
- var _utilities = require("../../utilities");
11
- 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); }
12
- 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; }
13
- const BottomSheetComponent = _ref => {
14
- let {
15
- style,
16
- children,
17
- step
18
- } = _ref;
19
- const bottomSheetRef = (0, _react.useRef)(null);
20
- const {
21
- viewStyles
22
- } = (0, _utilities.extractStyles)(style);
23
-
24
- // variables
25
- const snapPoints = (0, _react.useMemo)(() => ["25%", "50%", "90%"], []);
26
-
27
- // callbacks
28
- const handleSheetChanges = (0, _react.useCallback)(index => {
29
- console.log("handleSheetChanges", index);
30
- }, []);
31
- _react.default.useEffect(() => {
32
- if (step === -1) {
33
- var _bottomSheetRef$curre;
34
- bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
35
- }
36
- }, [step]);
37
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
38
- style: [containerStyle.container, viewStyles, {
39
- backgroundColor: step !== -1 ? "grey" : "transparent"
40
- }]
41
- }, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, {
42
- ref: bottomSheetRef,
43
- index: step,
44
- snapPoints: snapPoints,
45
- onChange: handleSheetChanges
46
- }, /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetView, null, children)));
47
- };
48
- var _default = BottomSheetComponent;
49
- exports.default = _default;
50
- const containerStyle = _reactNative.StyleSheet.create({
51
- container: {
52
- flex: 1
53
- },
54
- contentContainer: {
55
- flex: 1,
56
- alignItems: "center"
57
- }
58
- });
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _reactNativeScrollBottomSheet = _interopRequireDefault(require("react-native-scroll-bottom-sheet"));
10
- var _utilities = require("../../utilities");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- const windowHeight = _reactNative.Dimensions.get("window").height;
13
- const BottomSheetComponent = _ref => {
14
- let {
15
- style,
16
- children,
17
- step
18
- } = _ref;
19
- const {
20
- viewStyles
21
- } = (0, _utilities.extractStyles)(style);
22
- const bottomSheetRef = _react.default.useRef();
23
- const webStep = _react.default.useMemo(() => step + 1, [step]);
24
- const snapPoints = _react.default.useMemo(() => ["25%", "50%", windowHeight - 200], []);
25
- _react.default.useEffect(() => {
26
- var _bottomSheetRef$curre;
27
- bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep);
28
- // bottomSheetRef.current.snapTo(step);
29
- }, [webStep, step, snapPoints]);
30
- if (step === -1) {
31
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
32
- }
33
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
34
- style: styles.container
35
- }, /*#__PURE__*/_react.default.createElement(_reactNativeScrollBottomSheet.default, {
36
- ref: bottomSheetRef,
37
- componentType: "ScrollView",
38
- snapPoints: snapPoints,
39
- initialSnapIndex: 0,
40
- renderHandle: () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
41
- style: styles.header
42
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
43
- style: styles.panelHandle
44
- })),
45
- contentContainerStyle: styles.contentContainerStyle
46
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
47
- style: {
48
- ...styles.container,
49
- ...viewStyles,
50
- backgroundColor: webStep !== -1 ? "grey" : "transparent"
51
- }
52
- }, children)));
53
- };
54
- var _default = BottomSheetComponent;
55
- exports.default = _default;
56
- const styles = _reactNative.StyleSheet.create({
57
- container: {
58
- flex: 1
59
- },
60
- contentContainerStyle: {
61
- padding: 16
62
- },
63
- header: {
64
- alignItems: "center",
65
- backgroundColor: "white",
66
- paddingVertical: 20,
67
- borderTopLeftRadius: 20,
68
- borderTopRightRadius: 20
69
- },
70
- panelHandle: {
71
- width: 40,
72
- height: 2,
73
- backgroundColor: "rgba(0,0,0,0.3)",
74
- borderRadius: 4
75
- },
76
- item: {
77
- padding: 20,
78
- justifyContent: "center",
79
- backgroundColor: "white",
80
- alignItems: "center",
81
- marginVertical: 10
82
- }
83
- });
@@ -1,13 +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
- var _BottomSheet = _interopRequireDefault(require("./BottomSheet"));
13
- 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,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
- var _types = require("@draftbit/types");
8
- const SEED_DATA = {
9
- name: "Bottom Sheet",
10
- tag: "BottomSheet",
11
- category: _types.COMPONENT_TYPES.container,
12
- stylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
13
- props: {
14
- step: (0, _types.createNumberProp)({
15
- label: "Step",
16
- description: "Step can be -1, 0, 1, or 2."
17
- })
18
- }
19
- };
20
- exports.SEED_DATA = SEED_DATA;
@@ -1,49 +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 = _ref => {
6
- let {
7
- style,
8
- children,
9
- step
10
- } = _ref;
11
- const bottomSheetRef = useRef(null);
12
- const {
13
- viewStyles
14
- } = extractStyles(style);
15
-
16
- // variables
17
- const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
18
-
19
- // callbacks
20
- const handleSheetChanges = useCallback(index => {
21
- console.log("handleSheetChanges", index);
22
- }, []);
23
- React.useEffect(() => {
24
- if (step === -1) {
25
- var _bottomSheetRef$curre;
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
- export default BottomSheetComponent;
41
- const containerStyle = StyleSheet.create({
42
- container: {
43
- flex: 1
44
- },
45
- contentContainer: {
46
- flex: 1,
47
- alignItems: "center"
48
- }
49
- });