@draftbit/core 46.4.4-131f72.2 → 46.4.4-30f7df.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 (44) hide show
  1. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -24
  2. package/lib/commonjs/components/Container.js +17 -5
  3. package/lib/commonjs/components/Surface.js +1 -2
  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/commonjs/mappings/TextField.js +1 -1
  10. package/lib/commonjs/mappings/TextInput.js +1 -1
  11. package/lib/module/components/Picker/PickerComponent.ios.js +40 -13
  12. package/lib/module/components/Surface.js +1 -1
  13. package/lib/module/components/TabView/TabView.js +87 -0
  14. package/lib/module/components/TabView/TabViewItem.js +18 -0
  15. package/lib/module/components/TabView/index.js +2 -0
  16. package/lib/module/index.js +1 -0
  17. package/lib/module/mappings/FieldSearchBarFull.js +4 -1
  18. package/lib/module/mappings/TabView.js +70 -0
  19. package/lib/module/mappings/TextField.js +1 -1
  20. package/lib/module/mappings/TextInput.js +1 -1
  21. package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
  22. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
  23. package/lib/typescript/src/components/TabView/index.d.ts +2 -0
  24. package/lib/typescript/src/index.d.ts +1 -0
  25. package/lib/typescript/src/mappings/TabView.d.ts +111 -0
  26. package/lib/typescript/src/mappings/TextField.d.ts +2 -2
  27. package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
  28. package/package.json +6 -4
  29. package/src/components/Surface.js +0 -1
  30. package/src/components/Surface.tsx +0 -1
  31. package/src/components/TabView/TabView.js +34 -0
  32. package/src/components/TabView/TabView.tsx +97 -0
  33. package/src/components/TabView/TabViewItem.js +5 -0
  34. package/src/components/TabView/TabViewItem.tsx +21 -0
  35. package/src/components/TabView/index.js +2 -0
  36. package/src/components/TabView/index.tsx +2 -0
  37. package/src/index.js +1 -0
  38. package/src/index.tsx +1 -0
  39. package/src/mappings/TabView.js +73 -0
  40. package/src/mappings/TabView.ts +80 -0
  41. package/src/mappings/TextField.js +1 -1
  42. package/src/mappings/TextField.ts +1 -1
  43. package/src/mappings/TextInput.js +1 -1
  44. package/src/mappings/TextInput.ts +1 -1
@@ -27,7 +27,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
27
27
 
28
28
  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; }
29
29
 
30
- var Direction;
30
+ 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); }
31
+
32
+ let Direction;
31
33
  exports.Direction = Direction;
32
34
 
33
35
  (function (Direction) {
@@ -100,14 +102,13 @@ const CheckboxRow = _ref => {
100
102
  textStyles,
101
103
  viewStyles
102
104
  } = (0, _utilities.extractStyles)(style);
103
- return /*#__PURE__*/React.createElement(_Touchable.default, {
105
+ return /*#__PURE__*/React.createElement(_Touchable.default, _extends({
104
106
  onPress: handlePress,
105
107
  style: [viewStyles, styles.mainParent, {
106
108
  flexDirection: direction
107
109
  }],
108
- disabled: disabled,
109
- ...rest
110
- }, /*#__PURE__*/React.createElement(_reactNative.View, {
110
+ disabled: disabled
111
+ }, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
111
112
  style: [styles.label, {
112
113
  alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
113
114
  }, labelContainerStyle]
@@ -145,24 +146,5 @@ const styles = _reactNative.StyleSheet.create({
145
146
  }
146
147
  });
147
148
 
148
- var _default = CheckboxRow;
149
- exports.default = _default;ms: "center",
150
- justifyContent: "space-around",
151
- paddingStart: 20,
152
- minHeight: 50,
153
- paddingEnd: 20,
154
- display: "flex",
155
- ..._reactNative.Platform.select({
156
- web: {
157
- cursor: "pointer",
158
- userSelect: "none"
159
- }
160
- })
161
- },
162
- label: {
163
- flex: 3
164
- }
165
- });
166
-
167
149
  var _default = CheckboxRow;
168
150
  exports.default = _default;
@@ -19,8 +19,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  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; }
21
21
 
22
- 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); }
23
-
24
22
  const Container = _ref => {
25
23
  let {
26
24
  useThemeGutterPadding,
@@ -82,9 +80,10 @@ const Container = _ref => {
82
80
  };
83
81
  const Wrap = elevation ? _Elevation.default : _reactNative.View;
84
82
  if (elevation) containerStyle.elevation = elevation;
85
- return /*#__PURE__*/React.createElement(Wrap, _extends({
86
- style: [containerStyle, style]
87
- }, rest), backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
83
+ return /*#__PURE__*/React.createElement(Wrap, {
84
+ style: [containerStyle, style],
85
+ ...rest
86
+ }, backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
88
87
  source: typeof backgroundImage === "string" ? {
89
88
  uri: backgroundImage
90
89
  } : backgroundImage,
@@ -101,4 +100,17 @@ const Container = _ref => {
101
100
 
102
101
  var _default = (0, _theming.withTheme)(Container);
103
102
 
103
+ exports.default = _default;izeMode: backgroundImageResizeMode,
104
+ style: {
105
+ flex: 1
106
+ }
107
+ }, /*#__PURE__*/React.createElement(_reactNative.View, {
108
+ style: innerStyle
109
+ }, children)) : /*#__PURE__*/React.createElement(_reactNative.View, {
110
+ style: innerStyle
111
+ }, children));
112
+ };
113
+
114
+ var _default = (0, _theming.withTheme)(Container);
115
+
104
116
  exports.default = _default;
@@ -64,7 +64,6 @@ const Surface = _ref => {
64
64
  }), children);
65
65
  };
66
66
 
67
- var _default = (0, _theming.withTheme)(Surface); // fix bullshit
68
-
67
+ var _default = (0, _theming.withTheme)(Surface);
69
68
 
70
69
  exports.default = _default;
@@ -0,0 +1,102 @@
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 _reactNativeTabView = require("react-native-tab-view");
11
+
12
+ var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
+ 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); }
21
+
22
+ const TabViewComponent = _ref => {
23
+ let {
24
+ Icon,
25
+ tabBarPosition,
26
+ keyboardDismissMode,
27
+ swipeEnabled,
28
+ scrollEnabled,
29
+ activeColor,
30
+ inactiveColor,
31
+ pressColor,
32
+ indicatorColor,
33
+ style,
34
+ children
35
+ } = _ref;
36
+ const [index, setIndex] = React.useState(0);
37
+ const [routes, setRoutes] = React.useState([]);
38
+ const [tabScenes, setTabScenes] = React.useState({});
39
+ React.useEffect(() => {
40
+ const newRoutes = [];
41
+ const scenes = {};
42
+ React.Children.toArray(children).filter(child => child.type === _TabViewItem.default).forEach(child => {
43
+ var _child$props;
44
+
45
+ if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
46
+ var _child$props2, _child$props3;
47
+
48
+ newRoutes.push({
49
+ key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
50
+ ...(child === null || child === void 0 ? void 0 : child.props)
51
+ });
52
+
53
+ scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
54
+ }
55
+ });
56
+ setRoutes(newRoutes);
57
+ setTabScenes(scenes);
58
+ }, [children]);
59
+
60
+ const indexChangeHandler = i => setIndex(i);
61
+
62
+ const renderTabBar = props => {
63
+ console.log(props);
64
+ return /*#__PURE__*/React.createElement(_reactNativeTabView.TabBar, _extends({}, props, {
65
+ activeColor: activeColor,
66
+ inactiveColor: inactiveColor,
67
+ pressColor: pressColor,
68
+ scrollEnabled: scrollEnabled,
69
+ indicatorStyle: {
70
+ backgroundColor: indicatorColor
71
+ },
72
+ renderIcon: _ref2 => {
73
+ let {
74
+ route,
75
+ color
76
+ } = _ref2;
77
+ return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
78
+ name: route.icon,
79
+ color: color,
80
+ size: 36
81
+ }) : null;
82
+ },
83
+ style: style
84
+ }));
85
+ };
86
+
87
+ return /*#__PURE__*/React.createElement(_reactNativeTabView.TabView, {
88
+ navigationState: {
89
+ index,
90
+ routes
91
+ },
92
+ renderScene: (0, _reactNativeTabView.SceneMap)(tabScenes),
93
+ renderTabBar: renderTabBar,
94
+ onIndexChange: indexChangeHandler,
95
+ tabBarPosition: tabBarPosition,
96
+ keyboardDismissMode: keyboardDismissMode,
97
+ swipeEnabled: swipeEnabled
98
+ });
99
+ };
100
+
101
+ var _default = TabViewComponent;
102
+ exports.default = _default;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ const TabViewItem = _ref => {
9
+ let {
10
+ title,
11
+ id,
12
+ icon,
13
+ children,
14
+ accessibilityLabel
15
+ } = _ref;
16
+ console.log({
17
+ title,
18
+ id,
19
+ icon,
20
+ accessibilityLabel
21
+ });
22
+ return children;
23
+ };
24
+
25
+ var _default = TabViewItem;
26
+ exports.default = _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "TabView", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _TabView.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "TabViewItem", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _TabViewItem.default;
16
+ }
17
+ });
18
+
19
+ var _TabView = _interopRequireDefault(require("./TabView"));
20
+
21
+ var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -369,6 +369,18 @@ Object.defineProperty(exports, "SwitchRow", {
369
369
  return _Switch.SwitchRow;
370
370
  }
371
371
  });
372
+ Object.defineProperty(exports, "TabView", {
373
+ enumerable: true,
374
+ get: function () {
375
+ return _TabView.TabView;
376
+ }
377
+ });
378
+ Object.defineProperty(exports, "TabViewItem", {
379
+ enumerable: true,
380
+ get: function () {
381
+ return _TabView.TabViewItem;
382
+ }
383
+ });
372
384
  Object.defineProperty(exports, "TextField", {
373
385
  enumerable: true,
374
386
  get: function () {
@@ -472,6 +484,8 @@ var _ActionSheet = require("./components/ActionSheet");
472
484
 
473
485
  var _Swiper = require("./components/Swiper");
474
486
 
487
+ var _TabView = require("./components/TabView");
488
+
475
489
  var _Layout = require("./components/Layout");
476
490
 
477
491
  var _index = require("./components/RadioButton/index");
@@ -0,0 +1,79 @@
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: "Tab View",
12
+ tag: "TabView",
13
+ category: _types.COMPONENT_TYPES.container,
14
+ layout: {},
15
+ props: {
16
+ tabBarPosition: (0, _types.createTextEnumProp)({
17
+ label: "Tab Bar Position",
18
+ description: "Tab Bar Position",
19
+ options: ["top", "bottom"],
20
+ defaultValue: "top"
21
+ }),
22
+ keyboardDismissMode: (0, _types.createTextEnumProp)({
23
+ label: "Keyboard Dismiss Mode",
24
+ description: "Keyboard Dismiss Mode",
25
+ options: ["auto", "on-drag", "none"],
26
+ defaultValue: "auto"
27
+ }),
28
+ swipeEnabled: (0, _types.createBoolProp)({
29
+ label: "Swipe Enabled",
30
+ description: "Swipe Enabled",
31
+ defaultValue: true
32
+ }),
33
+ scrollEnabled: (0, _types.createBoolProp)({
34
+ label: "Scroll Enabled",
35
+ description: "Scroll Enabled",
36
+ defaultValue: true
37
+ }),
38
+ activeColor: (0, _types.createColorProp)({
39
+ label: "Active Color",
40
+ description: "Active Color",
41
+ defaultValue: "primary"
42
+ }),
43
+ inactiveColor: (0, _types.createColorProp)({
44
+ label: "Inactive Color",
45
+ description: "Inactive Color",
46
+ defaultValue: null
47
+ }),
48
+ pressColor: (0, _types.createColorProp)({
49
+ label: "Press Color",
50
+ description: "Press Color",
51
+ defaultValue: null
52
+ }),
53
+ indicatorColor: (0, _types.createColorProp)({
54
+ label: "Indicator Color",
55
+ description: "Indicator Color",
56
+ defaultValue: null
57
+ })
58
+ }
59
+ }, {
60
+ name: "Tab View Item",
61
+ tag: "TabViewItem",
62
+ category: _types.COMPONENT_TYPES.container,
63
+ layout: {},
64
+ props: {
65
+ title: (0, _types.createTextProp)({
66
+ label: "Title",
67
+ description: "Tab Title"
68
+ }),
69
+ id: (0, _types.createTextProp)({
70
+ label: "Id",
71
+ description: "Tab Id"
72
+ }),
73
+ accessibilityLabel: (0, _types.createTextProp)({
74
+ label: "Accessibility Label",
75
+ description: "Accessibility Label"
76
+ })
77
+ }
78
+ }];
79
+ exports.SEED_DATA = SEED_DATA;
@@ -24,7 +24,7 @@ const SEED_DATA_PROPS = {
24
24
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
25
25
  editable: true,
26
26
  required: false,
27
- defaultValue: null,
27
+ defaultValue: "none",
28
28
  options: ["none", "sentences", "words", "characters"],
29
29
  formType: _types.FORM_TYPES.flatArray,
30
30
  propType: _types.PROP_TYPES.STRING
@@ -103,7 +103,7 @@ const SEED_DATA = [{
103
103
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
104
104
  editable: true,
105
105
  required: false,
106
- defaultValue: null,
106
+ defaultValue: "none",
107
107
  options: ["none", "sentences", "words", "characters"],
108
108
  formType: _types.FORM_TYPES.flatArray,
109
109
  propType: _types.PROP_TYPES.STRING
@@ -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, StyleSheet } from "react-native";
5
3
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -13,8 +11,6 @@ import Touchable from "../Touchable";
13
11
  import { extractStyles } from "../../utilities";
14
12
 
15
13
  const Picker = _ref => {
16
- var _options$find$label, _options$find;
17
-
18
14
  let {
19
15
  Icon,
20
16
  style,
@@ -28,6 +24,9 @@ const Picker = _ref => {
28
24
  },
29
25
  ...props
30
26
  } = _ref;
27
+
28
+ var _a, _b;
29
+
31
30
  const {
32
31
  viewStyles: {
33
32
  borderRadius,
@@ -69,24 +68,23 @@ const Picker = _ref => {
69
68
  };
70
69
 
71
70
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
72
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
71
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
73
72
  return /*#__PURE__*/React.createElement(View, {
74
73
  style: [styles.container, viewStyles]
75
74
  }, /*#__PURE__*/React.createElement(Touchable, {
76
75
  disabled: disabled,
77
76
  onPress: toggleVisibility
78
- }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
77
+ }, /*#__PURE__*/React.createElement(TextField, { ...props,
79
78
  value: String(selectedLabel),
80
- placeholder: placeholder // @ts-ignore
81
- ,
82
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
83
- ,
79
+ placeholder: placeholder,
80
+ // @ts-ignore
81
+ ref: textField,
84
82
  disabled: disabled,
85
- pointerEvents: "none" // @ts-expect-error
86
- ,
83
+ pointerEvents: "none",
84
+ // @ts-expect-error
87
85
  style: stylesWithoutMargin,
88
86
  Icon: Icon
89
- }))), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
87
+ })), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
90
88
  style: [styles.picker, {
91
89
  backgroundColor: colors.divider
92
90
  }]
@@ -110,6 +108,35 @@ const Picker = _ref => {
110
108
  })))))));
111
109
  };
112
110
 
111
+ const styles = StyleSheet.create({
112
+ container: {
113
+ alignSelf: "stretch"
114
+ },
115
+ picker: {
116
+ position: "absolute",
117
+ bottom: 0,
118
+ left: 0,
119
+ right: 0,
120
+ flexDirection: "row",
121
+ justifyContent: "center"
122
+ },
123
+ pickerContainer: {
124
+ backgroundColor: "white",
125
+ flexDirection: "column",
126
+ width: "100%"
127
+ },
128
+ closeButton: {
129
+ alignSelf: "flex-end"
130
+ }
131
+ });
132
+ export default withTheme(Picker);eChange
133
+ }, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
134
+ label: o.label,
135
+ value: o.value,
136
+ key: o.value
137
+ })))))));
138
+ };
139
+
113
140
  const styles = StyleSheet.create({
114
141
  container: {
115
142
  alignSelf: "stretch"
@@ -48,4 +48,4 @@ const Surface = _ref => {
48
48
  }), children);
49
49
  };
50
50
 
51
- export default withTheme(Surface); // fix bullshit
51
+ export default withTheme(Surface);
@@ -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";
@@ -29,6 +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 { TabView, TabViewItem } from "./components/TabView";
32
33
  export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
33
34
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
34
35
  /* Deprecated: Fix or Delete! */
@@ -8,7 +8,6 @@ export const SEED_DATA = [{
8
8
  preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
9
9
  supports_list_render: false,
10
10
  triggers: [Triggers.OnChange],
11
- // TODO Triggers.OnSubmit for multiple triggers
12
11
  props: {
13
12
  icon: {
14
13
  group: GROUPS.basic,
@@ -45,4 +44,8 @@ export const SEED_DATA = [{
45
44
  }
46
45
  },
47
46
  layout: {}
47
+ }];alue: "searchBarValue"
48
+ }
49
+ },
50
+ layout: {}
48
51
  }];