@draftbit/core 46.4.4-d93fe1.2 → 46.4.4-dc9728.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Container.js +5 -17
- package/lib/commonjs/components/DatePicker/DatePicker.js +18 -8
- package/lib/commonjs/components/ProgressBar.js +7 -23
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/mappings/DatePicker.js +13 -0
- package/lib/module/components/DatePicker/DatePicker.js +17 -8
- package/lib/module/components/ToggleButton.js +3 -17
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/DatePicker.js +14 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
- package/package.json +4 -6
- package/src/components/DatePicker/DatePicker.js +14 -8
- package/src/components/DatePicker/DatePicker.tsx +23 -7
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/DatePicker.js +21 -1
- package/src/mappings/DatePicker.ts +23 -0
- package/lib/commonjs/components/TabView/TabView.js +0 -102
- package/lib/commonjs/components/TabView/TabViewItem.js +0 -26
- package/lib/commonjs/components/TabView/index.js +0 -23
- package/lib/commonjs/mappings/TabView.js +0 -79
- package/lib/module/components/TabView/TabView.js +0 -87
- package/lib/module/components/TabView/TabViewItem.js +0 -18
- package/lib/module/components/TabView/index.js +0 -2
- package/lib/module/mappings/TabView.js +0 -70
- package/lib/typescript/src/components/TabView/TabView.d.ts +0 -19
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -10
- package/lib/typescript/src/components/TabView/index.d.ts +0 -2
- package/lib/typescript/src/mappings/TabView.d.ts +0 -111
- package/src/components/TabView/TabView.js +0 -34
- package/src/components/TabView/TabView.tsx +0 -97
- package/src/components/TabView/TabViewItem.js +0 -5
- package/src/components/TabView/TabViewItem.tsx +0 -21
- package/src/components/TabView/index.js +0 -2
- package/src/components/TabView/index.tsx +0 -2
- package/src/mappings/TabView.js +0 -73
- package/src/mappings/TabView.ts +0 -80
|
@@ -23,6 +23,7 @@ import DateTimePicker from "./DatePickerComponent";
|
|
|
23
23
|
|
|
24
24
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
25
25
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
26
|
+
import { extractStyles } from "../../utilities";
|
|
26
27
|
|
|
27
28
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
28
29
|
|
|
@@ -47,10 +48,14 @@ type Props = {
|
|
|
47
48
|
mode?: "date" | "time" | "datetime";
|
|
48
49
|
type?: "solid" | "underline";
|
|
49
50
|
label?: string;
|
|
51
|
+
labelSize?: number;
|
|
52
|
+
labelColor: string;
|
|
50
53
|
placeholder?: string;
|
|
51
54
|
leftIconName?: string;
|
|
52
55
|
leftIconMode?: "outset" | "inset";
|
|
53
56
|
rightIconName?: string;
|
|
57
|
+
borderColor?: string;
|
|
58
|
+
borderColorActive?: string;
|
|
54
59
|
} & IconSlot &
|
|
55
60
|
TextInputProps;
|
|
56
61
|
|
|
@@ -84,7 +89,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
84
89
|
rightIconName,
|
|
85
90
|
leftIconMode = "inset",
|
|
86
91
|
label,
|
|
92
|
+
labelSize,
|
|
93
|
+
labelColor,
|
|
87
94
|
placeholder,
|
|
95
|
+
borderColor: inputBorderColor,
|
|
96
|
+
borderColorActive: inputBorderColorActive,
|
|
88
97
|
...props
|
|
89
98
|
}) => {
|
|
90
99
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -106,6 +115,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
106
115
|
width: number;
|
|
107
116
|
}>({ measured: false, width: 0 });
|
|
108
117
|
|
|
118
|
+
const { textStyles } = extractStyles(style);
|
|
119
|
+
|
|
109
120
|
const getValidDate = (): Date => {
|
|
110
121
|
if (!value) {
|
|
111
122
|
return new Date();
|
|
@@ -211,8 +222,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
211
222
|
|
|
212
223
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
213
224
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
214
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
215
|
-
|
|
225
|
+
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
226
|
+
textStyles?.fontSize || typography.subtitle1.fontSize;
|
|
227
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
228
|
+
? labelSize
|
|
229
|
+
: typography.caption.fontSize;
|
|
216
230
|
|
|
217
231
|
const hasActiveOutline = focused;
|
|
218
232
|
|
|
@@ -233,9 +247,9 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
233
247
|
underlineColor = "transparent";
|
|
234
248
|
backgroundColor = colors.divider;
|
|
235
249
|
} else {
|
|
236
|
-
activeColor = colors.primary;
|
|
237
|
-
placeholderColor = borderColor = colors.light;
|
|
238
|
-
underlineColor = colors.light;
|
|
250
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
251
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
252
|
+
underlineColor = inputBorderColor || colors.light;
|
|
239
253
|
backgroundColor = colors.background;
|
|
240
254
|
}
|
|
241
255
|
|
|
@@ -306,6 +320,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
306
320
|
const labelStyle = {
|
|
307
321
|
...typography.subtitle1,
|
|
308
322
|
top: type === "solid" ? 16 : 0,
|
|
323
|
+
fontFamily: textStyles?.fontFamily,
|
|
309
324
|
left:
|
|
310
325
|
leftIconName && leftIconMode === "inset"
|
|
311
326
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
@@ -351,6 +366,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
351
366
|
styles.input,
|
|
352
367
|
inputStyle,
|
|
353
368
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
369
|
+
textStyles,
|
|
354
370
|
];
|
|
355
371
|
|
|
356
372
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
@@ -406,7 +422,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
406
422
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
407
423
|
labelStyle,
|
|
408
424
|
{
|
|
409
|
-
color: colors.light,
|
|
425
|
+
color: labelColor || colors.light,
|
|
410
426
|
opacity: labeled.interpolate({
|
|
411
427
|
inputRange: [0, 1],
|
|
412
428
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -423,7 +439,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
423
439
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
424
440
|
labelStyle,
|
|
425
441
|
{
|
|
426
|
-
color:
|
|
442
|
+
color: labelColor || placeholder,
|
|
427
443
|
opacity: hasActiveOutline ? labeled : 1,
|
|
428
444
|
},
|
|
429
445
|
]}
|
package/src/index.js
CHANGED
|
@@ -29,7 +29,6 @@ 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";
|
|
33
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
34
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
35
34
|
/* Deprecated: Fix or Delete! */
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -10,6 +10,12 @@ const SEED_DATA_PROPS = {
|
|
|
10
10
|
required: true,
|
|
11
11
|
group: GROUPS.data,
|
|
12
12
|
},
|
|
13
|
+
labelSize: createNumberProp({
|
|
14
|
+
label: "Label Size",
|
|
15
|
+
}),
|
|
16
|
+
labelColor: createColorProp({
|
|
17
|
+
label: "Label Color",
|
|
18
|
+
}),
|
|
13
19
|
mode: {
|
|
14
20
|
label: "Mode",
|
|
15
21
|
description: "Choose between date, time and datetime",
|
|
@@ -21,6 +27,12 @@ const SEED_DATA_PROPS = {
|
|
|
21
27
|
options: ["date", "time", "datetime"],
|
|
22
28
|
group: GROUPS.basic,
|
|
23
29
|
},
|
|
30
|
+
borderColor: createColorProp({
|
|
31
|
+
label: "Border Color",
|
|
32
|
+
}),
|
|
33
|
+
borderColorActive: createColorProp({
|
|
34
|
+
label: "Border Color",
|
|
35
|
+
}),
|
|
24
36
|
format: {
|
|
25
37
|
label: "Format",
|
|
26
38
|
description: "Create an output format for the date.",
|
|
@@ -139,6 +151,14 @@ export const SEED_DATA = [
|
|
|
139
151
|
category: COMPONENT_TYPES.input,
|
|
140
152
|
layout: null,
|
|
141
153
|
triggers: [Triggers.OnDateChange],
|
|
154
|
+
StylesPanelSections: [
|
|
155
|
+
StylesPanelSections.Background,
|
|
156
|
+
StylesPanelSections.Borders,
|
|
157
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
158
|
+
StylesPanelSections.Position,
|
|
159
|
+
StylesPanelSections.Size,
|
|
160
|
+
StylesPanelSections.Typography,
|
|
161
|
+
],
|
|
142
162
|
props: {
|
|
143
163
|
...SEED_DATA_PROPS,
|
|
144
164
|
type: {
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
FIELD_NAME,
|
|
6
6
|
GROUPS,
|
|
7
7
|
Triggers,
|
|
8
|
+
StylesPanelSections,
|
|
9
|
+
createNumberProp,
|
|
10
|
+
createColorProp,
|
|
8
11
|
} from "@draftbit/types";
|
|
9
12
|
|
|
10
13
|
const SEED_DATA_PROPS = {
|
|
@@ -18,6 +21,12 @@ const SEED_DATA_PROPS = {
|
|
|
18
21
|
required: true,
|
|
19
22
|
group: GROUPS.data,
|
|
20
23
|
},
|
|
24
|
+
labelSize: createNumberProp({
|
|
25
|
+
label: "Label Size",
|
|
26
|
+
}),
|
|
27
|
+
labelColor: createColorProp({
|
|
28
|
+
label: "Label Color",
|
|
29
|
+
}),
|
|
21
30
|
mode: {
|
|
22
31
|
label: "Mode",
|
|
23
32
|
description: "Choose between date, time and datetime",
|
|
@@ -29,6 +38,12 @@ const SEED_DATA_PROPS = {
|
|
|
29
38
|
options: ["date", "time", "datetime"],
|
|
30
39
|
group: GROUPS.basic,
|
|
31
40
|
},
|
|
41
|
+
borderColor: createColorProp({
|
|
42
|
+
label: "Border Color",
|
|
43
|
+
}),
|
|
44
|
+
borderColorActive: createColorProp({
|
|
45
|
+
label: "Border Color",
|
|
46
|
+
}),
|
|
32
47
|
format: {
|
|
33
48
|
label: "Format",
|
|
34
49
|
description: "Create an output format for the date.",
|
|
@@ -150,6 +165,14 @@ export const SEED_DATA = [
|
|
|
150
165
|
category: COMPONENT_TYPES.input,
|
|
151
166
|
layout: null,
|
|
152
167
|
triggers: [Triggers.OnDateChange],
|
|
168
|
+
StylesPanelSections: [
|
|
169
|
+
StylesPanelSections.Background,
|
|
170
|
+
StylesPanelSections.Borders,
|
|
171
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
172
|
+
StylesPanelSections.Position,
|
|
173
|
+
StylesPanelSections.Size,
|
|
174
|
+
StylesPanelSections.Typography,
|
|
175
|
+
],
|
|
153
176
|
props: {
|
|
154
177
|
...SEED_DATA_PROPS,
|
|
155
178
|
type: {
|
|
@@ -1,102 +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 _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;
|
|
@@ -1,26 +0,0 @@
|
|
|
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;
|
|
@@ -1,23 +0,0 @@
|
|
|
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 }; }
|
|
@@ -1,79 +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: "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;
|
|
@@ -1,87 +0,0 @@
|
|
|
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;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp } from "@draftbit/types";
|
|
2
|
-
export const SEED_DATA = [{
|
|
3
|
-
name: "Tab View",
|
|
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: "Tab View Item",
|
|
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
|
-
}];
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,10 +0,0 @@
|
|
|
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;
|