@draftbit/core 46.2.3 → 46.2.4-00bad7.0

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 (39) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +5 -25
  2. package/lib/commonjs/components/Carousel.js +34 -10
  3. package/lib/commonjs/components/DeprecatedButton.js +4 -22
  4. package/lib/commonjs/components/TabView/TabView.js +102 -0
  5. package/lib/commonjs/components/TabView/TabViewItem.js +26 -0
  6. package/lib/commonjs/components/TabView/index.js +23 -0
  7. package/lib/commonjs/index.js +14 -0
  8. package/lib/commonjs/mappings/TabView.js +79 -0
  9. package/lib/module/components/Banner.js +24 -4
  10. package/lib/module/components/CardContainer.js +15 -5
  11. package/lib/module/components/Divider.js +20 -2
  12. package/lib/module/components/FAB.js +23 -5
  13. package/lib/module/components/Portal/PortalHost.js +26 -15
  14. package/lib/module/components/RadioButton/RadioButton.js +15 -2
  15. package/lib/module/components/RadioButton/RadioButtonGroup.js +17 -3
  16. package/lib/module/components/ScreenContainer.js +22 -5
  17. package/lib/module/components/TabView/TabView.js +87 -0
  18. package/lib/module/components/TabView/TabViewItem.js +18 -0
  19. package/lib/module/components/TabView/index.js +2 -0
  20. package/lib/module/components/ToggleButton.js +17 -3
  21. package/lib/module/constants.js +1 -0
  22. package/lib/module/index.js +1 -0
  23. package/lib/module/mappings/TabView.js +70 -0
  24. package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
  25. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
  26. package/lib/typescript/src/components/TabView/index.d.ts +2 -0
  27. package/lib/typescript/src/index.d.ts +1 -0
  28. package/lib/typescript/src/mappings/TabView.d.ts +111 -0
  29. package/package.json +4 -2
  30. package/src/components/TabView/TabView.js +34 -0
  31. package/src/components/TabView/TabView.tsx +97 -0
  32. package/src/components/TabView/TabViewItem.js +5 -0
  33. package/src/components/TabView/TabViewItem.tsx +21 -0
  34. package/src/components/TabView/index.js +2 -0
  35. package/src/components/TabView/index.ts +2 -0
  36. package/src/index.js +1 -0
  37. package/src/index.tsx +1 -0
  38. package/src/mappings/TabView.js +73 -0
  39. package/src/mappings/TabView.ts +80 -0
@@ -1,5 +1,3 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
1
  import * as React from "react";
4
2
  import { View, StyleSheet } from "react-native";
5
3
  import PortalManager from "./PortalManager";
@@ -33,11 +31,11 @@ export default class PortalHost extends React.Component {
33
31
  constructor() {
34
32
  super(...arguments);
35
33
 
36
- _defineProperty(this, "setManager", manager => {
34
+ this.setManager = manager => {
37
35
  this.manager = manager;
38
- });
36
+ };
39
37
 
40
- _defineProperty(this, "mount", children => {
38
+ this.mount = children => {
41
39
  const key = this.nextKey++;
42
40
 
43
41
  if (this.manager) {
@@ -51,9 +49,9 @@ export default class PortalHost extends React.Component {
51
49
  }
52
50
 
53
51
  return key;
54
- });
52
+ };
55
53
 
56
- _defineProperty(this, "update", (key, children) => {
54
+ this.update = (key, children) => {
57
55
  if (this.manager) {
58
56
  this.manager.update(key, children);
59
57
  } else {
@@ -71,9 +69,9 @@ export default class PortalHost extends React.Component {
71
69
  this.queue.push(op);
72
70
  }
73
71
  }
74
- });
72
+ };
75
73
 
76
- _defineProperty(this, "unmount", key => {
74
+ this.unmount = key => {
77
75
  if (this.manager) {
78
76
  this.manager.unmount(key);
79
77
  } else {
@@ -82,13 +80,10 @@ export default class PortalHost extends React.Component {
82
80
  key
83
81
  });
84
82
  }
85
- });
86
-
87
- _defineProperty(this, "nextKey", 0);
88
-
89
- _defineProperty(this, "queue", []);
83
+ };
90
84
 
91
- _defineProperty(this, "manager", void 0);
85
+ this.nextKey = 0;
86
+ this.queue = [];
92
87
  }
93
88
 
94
89
  componentDidMount() {
@@ -132,6 +127,22 @@ export default class PortalHost extends React.Component {
132
127
  }));
133
128
  }
134
129
 
130
+ }
131
+ PortalHost.displayName = "Portal.Host";
132
+ const styles = StyleSheet.create({
133
+ container: {
134
+ flex: 1
135
+ }
136
+ }); }
137
+ }, /*#__PURE__*/React.createElement(View, {
138
+ style: styles.container,
139
+ collapsable: false,
140
+ pointerEvents: "box-none"
141
+ }, this.props.children), /*#__PURE__*/React.createElement(PortalManager, {
142
+ ref: this.setManager
143
+ }));
144
+ }
145
+
135
146
  }
136
147
 
137
148
  _defineProperty(PortalHost, "displayName", "Portal.Host");
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from "react";
4
2
  import Config from "../Config";
5
3
  import IconButton from "../IconButton";
@@ -34,6 +32,21 @@ const RadioButton = _ref => {
34
32
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
35
33
  };
36
34
 
35
+ return /*#__PURE__*/React.createElement(IconButton, {
36
+ Icon: Icon,
37
+ icon: isSelected ? selectedIcon : unselectedIcon,
38
+ color: isSelected ? color : unselectedColor,
39
+ disabled: disabled,
40
+ onPress: handlePress,
41
+ size: size,
42
+ style: style,
43
+ ...rest
44
+ });
45
+ };
46
+
47
+ export default RadioButton; onValueChange(realValue);
48
+ };
49
+
37
50
  return /*#__PURE__*/React.createElement(IconButton, _extends({
38
51
  Icon: Icon,
39
52
  icon: isSelected ? selectedIcon : unselectedIcon,
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from "react";
4
2
  import { View } from "react-native";
5
3
  import { getValueForRadioButton } from "../../utilities";
@@ -48,7 +46,23 @@ const RadioButtonGroup = _ref => {
48
46
  });
49
47
  }
50
48
 
51
- return /*#__PURE__*/React.createElement(View, _extends({
49
+ return /*#__PURE__*/React.createElement(View, {
50
+ style: [{
51
+ minHeight: 40
52
+ }, style],
53
+ ...rest
54
+ }, /*#__PURE__*/React.createElement(Provider, {
55
+ value: {
56
+ value: internalValue,
57
+ onValueChange: handleValueChange,
58
+ direction
59
+ }
60
+ }, /*#__PURE__*/React.createElement(View, {
61
+ style: _containerStyle
62
+ }, children)));
63
+ };
64
+
65
+ export default RadioButtonGroup;xtends({
52
66
  style: [{
53
67
  minHeight: 40
54
68
  }, style]
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from "react";
4
2
  import { StyleSheet, ScrollView, View } from "react-native";
5
3
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -27,12 +25,13 @@ function ScreenContainer(_ref) {
27
25
  edges.push("bottom");
28
26
  }
29
27
 
30
- return /*#__PURE__*/React.createElement(SafeAreaView, _extends({
28
+ return /*#__PURE__*/React.createElement(SafeAreaView, {
31
29
  edges: edges,
32
30
  style: [styles.container, {
33
31
  backgroundColor
34
- }]
35
- }, rest), scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
32
+ }],
33
+ ...rest
34
+ }, scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
36
35
  contentContainerStyle: [styles.scrollViewContainer, {
37
36
  backgroundColor
38
37
  }, style]
@@ -43,6 +42,24 @@ function ScreenContainer(_ref) {
43
42
  }, children));
44
43
  }
45
44
 
45
+ const styles = StyleSheet.create({
46
+ container: {
47
+ flex: 1
48
+ },
49
+ scrollViewContainer: {
50
+ flexGrow: 1,
51
+ flex: undefined
52
+ }
53
+ });
54
+ export default withTheme(ScreenContainer);olor
55
+ }, style]
56
+ }, children) : /*#__PURE__*/React.createElement(View, {
57
+ style: [styles.container, {
58
+ backgroundColor
59
+ }, style]
60
+ }, children));
61
+ }
62
+
46
63
  const styles = StyleSheet.create({
47
64
  container: {
48
65
  flex: 1
@@ -0,0 +1,87 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import * as React from "react";
4
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view"; // import { withTheme } from "../../theming";
5
+
6
+ import TabViewItem from "./TabViewItem";
7
+
8
+ const TabViewComponent = _ref => {
9
+ let {
10
+ Icon,
11
+ tabBarPosition,
12
+ keyboardDismissMode,
13
+ swipeEnabled,
14
+ scrollEnabled,
15
+ activeColor,
16
+ inactiveColor,
17
+ pressColor,
18
+ indicatorColor,
19
+ style,
20
+ children
21
+ } = _ref;
22
+ const [index, setIndex] = React.useState(0);
23
+ const [routes, setRoutes] = React.useState([]);
24
+ const [tabScenes, setTabScenes] = React.useState({});
25
+ React.useEffect(() => {
26
+ const newRoutes = [];
27
+ const scenes = {};
28
+ React.Children.toArray(children).filter(child => child.type === TabViewItem).forEach(child => {
29
+ var _child$props;
30
+
31
+ if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
32
+ var _child$props2, _child$props3;
33
+
34
+ newRoutes.push({
35
+ key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
36
+ ...(child === null || child === void 0 ? void 0 : child.props)
37
+ });
38
+
39
+ scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
40
+ }
41
+ });
42
+ setRoutes(newRoutes);
43
+ setTabScenes(scenes);
44
+ }, [children]);
45
+
46
+ const indexChangeHandler = i => setIndex(i);
47
+
48
+ const renderTabBar = props => {
49
+ console.log(props);
50
+ return /*#__PURE__*/React.createElement(TabBar, _extends({}, props, {
51
+ activeColor: activeColor,
52
+ inactiveColor: inactiveColor,
53
+ pressColor: pressColor,
54
+ scrollEnabled: scrollEnabled,
55
+ indicatorStyle: {
56
+ backgroundColor: indicatorColor
57
+ },
58
+ renderIcon: _ref2 => {
59
+ let {
60
+ route,
61
+ color
62
+ } = _ref2;
63
+ return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
64
+ name: route.icon,
65
+ color: color,
66
+ size: 36
67
+ }) : null;
68
+ },
69
+ style: style
70
+ }));
71
+ };
72
+
73
+ return /*#__PURE__*/React.createElement(TabView, {
74
+ navigationState: {
75
+ index,
76
+ routes
77
+ },
78
+ renderScene: SceneMap(tabScenes),
79
+ renderTabBar: renderTabBar,
80
+ onIndexChange: indexChangeHandler,
81
+ tabBarPosition: tabBarPosition,
82
+ keyboardDismissMode: keyboardDismissMode,
83
+ swipeEnabled: swipeEnabled
84
+ });
85
+ };
86
+
87
+ export default TabViewComponent;
@@ -0,0 +1,18 @@
1
+ const TabViewItem = _ref => {
2
+ let {
3
+ title,
4
+ id,
5
+ icon,
6
+ children,
7
+ accessibilityLabel
8
+ } = _ref;
9
+ console.log({
10
+ title,
11
+ id,
12
+ icon,
13
+ accessibilityLabel
14
+ });
15
+ return children;
16
+ };
17
+
18
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from "react";
4
2
  import { withTheme } from "../theming";
5
3
  import { StyleSheet } from "react-native";
@@ -42,13 +40,29 @@ const ToggleButton = _ref => {
42
40
  onPress(!internalValue);
43
41
  };
44
42
 
45
- return /*#__PURE__*/React.createElement(IconButton, _extends({
43
+ return /*#__PURE__*/React.createElement(IconButton, {
46
44
  Icon: Icon,
47
45
  icon: icon,
48
46
  size: iconSize,
49
47
  color: internalValue ? colors[color] : colors[colorSecondary],
50
48
  onPress: handlePress,
51
49
  disabled: disabled,
50
+ style: [styles.mainContainer, {
51
+ width,
52
+ height,
53
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
54
+ borderColor: colors[borderColor]
55
+ }, style],
56
+ ...rest
57
+ });
58
+ };
59
+
60
+ const styles = StyleSheet.create({
61
+ mainContainer: {
62
+ borderWidth: 1
63
+ }
64
+ });
65
+ export default withTheme(ToggleButton);: disabled,
52
66
  style: [styles.mainContainer, {
53
67
  width,
54
68
  height,
@@ -5,4 +5,5 @@ const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.C
5
5
  export const APPROX_STATUSBAR_HEIGHT = Platform.select({
6
6
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
7
7
  ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
8
+ });PO : 0
8
9
  });
@@ -28,6 +28,7 @@ export { default as Touchable } from "./components/Touchable";
28
28
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
29
29
  export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
30
30
  export { Swiper, SwiperItem } from "./components/Swiper";
31
+ export { TabView, TabViewItem } from "./components/TabView";
31
32
  export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
32
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
33
34
  /* Deprecated: Fix or Delete! */
@@ -0,0 +1,70 @@
1
+ import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp } from "@draftbit/types";
2
+ export const SEED_DATA = [{
3
+ name: "TabView",
4
+ tag: "TabView",
5
+ category: COMPONENT_TYPES.container,
6
+ layout: {},
7
+ props: {
8
+ tabBarPosition: createTextEnumProp({
9
+ label: "Tab Bar Position",
10
+ description: "Tab Bar Position",
11
+ options: ["top", "bottom"],
12
+ defaultValue: "top"
13
+ }),
14
+ keyboardDismissMode: createTextEnumProp({
15
+ label: "Keyboard Dismiss Mode",
16
+ description: "Keyboard Dismiss Mode",
17
+ options: ["auto", "on-drag", "none"],
18
+ defaultValue: "auto"
19
+ }),
20
+ swipeEnabled: createBoolProp({
21
+ label: "Swipe Enabled",
22
+ description: "Swipe Enabled",
23
+ defaultValue: true
24
+ }),
25
+ scrollEnabled: createBoolProp({
26
+ label: "Scroll Enabled",
27
+ description: "Scroll Enabled",
28
+ defaultValue: true
29
+ }),
30
+ activeColor: createColorProp({
31
+ label: "Active Color",
32
+ description: "Active Color",
33
+ defaultValue: "primary"
34
+ }),
35
+ inactiveColor: createColorProp({
36
+ label: "Inactive Color",
37
+ description: "Inactive Color",
38
+ defaultValue: null
39
+ }),
40
+ pressColor: createColorProp({
41
+ label: "Press Color",
42
+ description: "Press Color",
43
+ defaultValue: null
44
+ }),
45
+ indicatorColor: createColorProp({
46
+ label: "Indicator Color",
47
+ description: "Indicator Color",
48
+ defaultValue: null
49
+ })
50
+ }
51
+ }, {
52
+ name: "TabViewItem",
53
+ tag: "TabViewItem",
54
+ category: COMPONENT_TYPES.container,
55
+ layout: {},
56
+ props: {
57
+ title: createTextProp({
58
+ label: "Title",
59
+ description: "Tab Title"
60
+ }),
61
+ id: createTextProp({
62
+ label: "Id",
63
+ description: "Tab Id"
64
+ }),
65
+ accessibilityLabel: createTextProp({
66
+ label: "Accessibility Label",
67
+ description: "Accessibility Label"
68
+ })
69
+ }
70
+ }];
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ import type { IconSlot } from "../../interfaces/Icon";
4
+ declare type TabBarPosition = "top" | "bottom";
5
+ declare type KeyboardDismissMode = "none" | "auto" | "on-drag";
6
+ declare type TabViewProps = {
7
+ tabBarPosition?: TabBarPosition;
8
+ keyboardDismissMode?: KeyboardDismissMode;
9
+ swipeEnabled?: boolean;
10
+ scrollEnabled?: boolean;
11
+ activeColor?: string;
12
+ inactiveColor?: string;
13
+ pressColor?: string;
14
+ indicatorColor?: string;
15
+ style?: StyleProp<TextStyle | ViewStyle>;
16
+ children: React.ReactNode;
17
+ } & IconSlot;
18
+ declare const TabViewComponent: ({ Icon, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, style, children, }: TabViewProps) => JSX.Element;
19
+ export default TabViewComponent;
@@ -0,0 +1,10 @@
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
+ declare const TabViewItem: ({ title, id, icon, children, accessibilityLabel, }: TabViewItemProps) => React.ReactNode;
10
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -28,6 +28,7 @@ export { default as Touchable } from "./components/Touchable";
28
28
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
29
29
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
30
30
  export { Swiper, SwiperItem } from "./components/Swiper";
31
+ export { TabView, TabViewItem } from "./components/TabView";
31
32
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
32
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
33
34
  export { default as Button } from "./components/DeprecatedButton";
@@ -0,0 +1,111 @@
1
+ export declare const SEED_DATA: ({
2
+ name: string;
3
+ tag: string;
4
+ category: string;
5
+ layout: {};
6
+ props: {
7
+ tabBarPosition: {
8
+ group: string;
9
+ label: string;
10
+ description: string;
11
+ editable: boolean;
12
+ required: boolean;
13
+ formType: string;
14
+ propType: string;
15
+ defaultValue: null;
16
+ options: never[];
17
+ };
18
+ keyboardDismissMode: {
19
+ group: string;
20
+ label: string;
21
+ description: string;
22
+ editable: boolean;
23
+ required: boolean;
24
+ formType: string;
25
+ propType: string;
26
+ defaultValue: null;
27
+ options: never[];
28
+ };
29
+ swipeEnabled: {
30
+ label: string;
31
+ description: string;
32
+ formType: string;
33
+ propType: string;
34
+ defaultValue: boolean;
35
+ editable: boolean;
36
+ required: boolean;
37
+ group: string;
38
+ };
39
+ scrollEnabled: {
40
+ label: string;
41
+ description: string;
42
+ formType: string;
43
+ propType: string;
44
+ defaultValue: boolean;
45
+ editable: boolean;
46
+ required: boolean;
47
+ group: string;
48
+ };
49
+ activeColor: {
50
+ group: string;
51
+ label: string;
52
+ description: string;
53
+ editable: boolean;
54
+ required: boolean;
55
+ defaultValue: null;
56
+ formType: string;
57
+ propType: string;
58
+ };
59
+ inactiveColor: {
60
+ group: string;
61
+ label: string;
62
+ description: string;
63
+ editable: boolean;
64
+ required: boolean;
65
+ defaultValue: null;
66
+ formType: string;
67
+ propType: string;
68
+ };
69
+ pressColor: {
70
+ group: string;
71
+ label: string;
72
+ description: string;
73
+ editable: boolean;
74
+ required: boolean;
75
+ defaultValue: null;
76
+ formType: string;
77
+ propType: string;
78
+ };
79
+ indicatorColor: {
80
+ group: string;
81
+ label: string;
82
+ description: string;
83
+ editable: boolean;
84
+ required: boolean;
85
+ defaultValue: null;
86
+ formType: string;
87
+ propType: string;
88
+ };
89
+ title?: undefined;
90
+ id?: undefined;
91
+ accessibilityLabel?: undefined;
92
+ };
93
+ } | {
94
+ name: string;
95
+ tag: string;
96
+ category: string;
97
+ layout: {};
98
+ props: {
99
+ title: any;
100
+ id: any;
101
+ accessibilityLabel: any;
102
+ tabBarPosition?: undefined;
103
+ keyboardDismissMode?: undefined;
104
+ swipeEnabled?: undefined;
105
+ scrollEnabled?: undefined;
106
+ activeColor?: undefined;
107
+ inactiveColor?: undefined;
108
+ pressColor?: undefined;
109
+ indicatorColor?: undefined;
110
+ };
111
+ })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.2.3",
3
+ "version": "46.2.4-00bad7.0+00bad7e6",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -53,6 +53,8 @@
53
53
  "lodash.omit": "^4.5.0",
54
54
  "lodash.tonumber": "^4.0.3",
55
55
  "react-native-modal-datetime-picker": "^13.0.0",
56
+ "react-native-pager-view": "^6.0.0",
57
+ "react-native-tab-view": "^3.1.1",
56
58
  "react-native-typography": "^1.4.1",
57
59
  "react-native-web-swiper": "^2.2.3"
58
60
  },
@@ -79,5 +81,5 @@
79
81
  ]
80
82
  ]
81
83
  },
82
- "gitHead": "9a0a65dfc2aff945da5cbe7db48d07114c8cea7c"
84
+ "gitHead": "00bad7e6fdce245389c03225aefe001e6b72db05"
83
85
  }
@@ -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;