@draftbit/core 46.2.4-99ac4e.1 → 46.2.4-a3d00e.4
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/Config.js +1 -0
- package/lib/commonjs/components/DeprecatedButton.js +4 -22
- package/lib/commonjs/components/SVG.js +49 -0
- package/lib/commonjs/components/TabView/TabView.js +102 -0
- package/lib/commonjs/components/TabView/TabViewItem.js +26 -0
- package/lib/commonjs/components/TabView/index.js +23 -0
- package/lib/commonjs/index.js +22 -0
- package/lib/commonjs/mappings/Image.js +2 -2
- package/lib/commonjs/mappings/SVG.js +23 -0
- package/lib/commonjs/mappings/TabView.js +79 -0
- package/lib/module/components/Config.js +1 -0
- package/lib/module/components/SVG.js +32 -0
- package/lib/module/components/TabView/TabView.js +87 -0
- package/lib/module/components/TabView/TabViewItem.js +18 -0
- package/lib/module/components/TabView/index.js +2 -0
- package/lib/module/index.js +2 -0
- package/lib/module/mappings/Image.js +2 -2
- package/lib/module/mappings/SVG.js +14 -0
- package/lib/module/mappings/TabView.js +70 -0
- package/lib/typescript/src/components/Config.d.ts +1 -0
- package/lib/typescript/src/components/SVG.d.ts +8 -0
- package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
- package/lib/typescript/src/components/TabView/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/mappings/SVG.d.ts +22 -0
- package/lib/typescript/src/mappings/TabView.d.ts +111 -0
- package/package.json +6 -3
- package/src/components/Config.js +1 -0
- package/src/components/Config.ts +1 -0
- package/src/components/SVG.js +14 -0
- package/src/components/SVG.tsx +35 -0
- package/src/components/TabView/TabView.js +34 -0
- package/src/components/TabView/TabView.tsx +97 -0
- package/src/components/TabView/TabViewItem.js +5 -0
- package/src/components/TabView/TabViewItem.tsx +21 -0
- package/src/components/TabView/index.js +2 -0
- package/src/components/TabView/index.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.tsx +2 -0
- package/src/mappings/Image.js +2 -2
- package/src/mappings/Image.ts +2 -2
- package/src/mappings/SVG.js +14 -0
- package/src/mappings/SVG.ts +15 -0
- package/src/mappings/TabView.js +73 -0
- package/src/mappings/TabView.ts +80 -0
|
@@ -25,6 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
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; }
|
|
27
27
|
|
|
28
|
+
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); }
|
|
29
|
+
|
|
28
30
|
const Button = _ref => {
|
|
29
31
|
let {
|
|
30
32
|
Icon,
|
|
@@ -126,7 +128,7 @@ const Button = _ref => {
|
|
|
126
128
|
alignSelf: "stretch",
|
|
127
129
|
...margins
|
|
128
130
|
}
|
|
129
|
-
}, /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
131
|
+
}, /*#__PURE__*/React.createElement(_Touchable.default, _extends({}, rest, {
|
|
130
132
|
onPress: onPress,
|
|
131
133
|
accessibilityState: {
|
|
132
134
|
disabled
|
|
@@ -134,7 +136,7 @@ const Button = _ref => {
|
|
|
134
136
|
accessibilityRole: "button",
|
|
135
137
|
disabled: disabled || loading,
|
|
136
138
|
style: [styles.button, buttonStyle, innerStyles]
|
|
137
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
139
|
+
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
138
140
|
style: styles.content
|
|
139
141
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
140
142
|
style: iconStyle
|
|
@@ -169,24 +171,4 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
169
171
|
|
|
170
172
|
var _default = (0, _theming.withTheme)(Button);
|
|
171
173
|
|
|
172
|
-
exports.default = _default;));
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const styles = _reactNative.StyleSheet.create({
|
|
176
|
-
button: {
|
|
177
|
-
minWidth: 64,
|
|
178
|
-
borderStyle: "solid"
|
|
179
|
-
},
|
|
180
|
-
content: {
|
|
181
|
-
flexDirection: "row",
|
|
182
|
-
alignItems: "center",
|
|
183
|
-
justifyContent: "center"
|
|
184
|
-
},
|
|
185
|
-
icon: {
|
|
186
|
-
width: _Config.default.buttonIconSize
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
var _default = (0, _theming.withTheme)(Button);
|
|
191
|
-
|
|
192
174
|
exports.default = _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _reactNativeSvg = require("react-native-svg");
|
|
13
|
+
|
|
14
|
+
var _Config = _interopRequireDefault(require("./Config"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
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
|
+
|
|
22
|
+
const SVG = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
source,
|
|
25
|
+
style
|
|
26
|
+
} = _ref;
|
|
27
|
+
let svgSource = source === null || source === undefined ? _Config.default.placeholderSvgURL : source;
|
|
28
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, _reactNative.Platform.OS === "ios" && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
29
|
+
style: style
|
|
30
|
+
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgUri, {
|
|
31
|
+
width: "100%",
|
|
32
|
+
height: "100%",
|
|
33
|
+
uri: svgSource
|
|
34
|
+
})), _reactNative.Platform.OS === "android" && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
35
|
+
style: style
|
|
36
|
+
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgUri, {
|
|
37
|
+
width: "100%",
|
|
38
|
+
height: "100%",
|
|
39
|
+
uri: svgSource
|
|
40
|
+
})), _reactNative.Platform.OS === "web" && /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
41
|
+
style: style,
|
|
42
|
+
source: {
|
|
43
|
+
uri: svgSource
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var _default = SVG;
|
|
49
|
+
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 }; }
|
package/lib/commonjs/index.js
CHANGED
|
@@ -291,6 +291,12 @@ Object.defineProperty(exports, "RowHeadlineImageIcon", {
|
|
|
291
291
|
return _RowHeadlineImageIcon.default;
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
|
+
Object.defineProperty(exports, "SVG", {
|
|
295
|
+
enumerable: true,
|
|
296
|
+
get: function () {
|
|
297
|
+
return _SVG.default;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
294
300
|
Object.defineProperty(exports, "ScreenContainer", {
|
|
295
301
|
enumerable: true,
|
|
296
302
|
get: function () {
|
|
@@ -363,6 +369,18 @@ Object.defineProperty(exports, "SwitchRow", {
|
|
|
363
369
|
return _Switch.SwitchRow;
|
|
364
370
|
}
|
|
365
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
|
+
});
|
|
366
384
|
Object.defineProperty(exports, "TextField", {
|
|
367
385
|
enumerable: true,
|
|
368
386
|
get: function () {
|
|
@@ -442,6 +460,8 @@ var _IconButton = _interopRequireDefault(require("./components/IconButton"));
|
|
|
442
460
|
|
|
443
461
|
var _Image = _interopRequireDefault(require("./components/Image"));
|
|
444
462
|
|
|
463
|
+
var _SVG = _interopRequireDefault(require("./components/SVG"));
|
|
464
|
+
|
|
445
465
|
var _NumberInput = _interopRequireDefault(require("./components/NumberInput"));
|
|
446
466
|
|
|
447
467
|
var _ScreenContainer = _interopRequireDefault(require("./components/ScreenContainer"));
|
|
@@ -464,6 +484,8 @@ var _ActionSheet = require("./components/ActionSheet");
|
|
|
464
484
|
|
|
465
485
|
var _Swiper = require("./components/Swiper");
|
|
466
486
|
|
|
487
|
+
var _TabView = require("./components/TabView");
|
|
488
|
+
|
|
467
489
|
var _Layout = require("./components/Layout");
|
|
468
490
|
|
|
469
491
|
var _index = require("./components/RadioButton/index");
|
|
@@ -14,8 +14,8 @@ const SEED_DATA = {
|
|
|
14
14
|
category: _types.COMPONENT_TYPES.media,
|
|
15
15
|
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
16
16
|
layout: {
|
|
17
|
-
width:
|
|
18
|
-
height:
|
|
17
|
+
width: 100,
|
|
18
|
+
height: 100
|
|
19
19
|
},
|
|
20
20
|
props: {
|
|
21
21
|
source: (0, _types.createImageProp)(),
|
|
@@ -0,0 +1,23 @@
|
|
|
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: "SVG",
|
|
12
|
+
tag: "SVG",
|
|
13
|
+
description: "An SVG component",
|
|
14
|
+
category: _types.COMPONENT_TYPES.media,
|
|
15
|
+
layout: {
|
|
16
|
+
width: 100,
|
|
17
|
+
height: 100
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
source: (0, _types.createSvgProp)()
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.SEED_DATA = SEED_DATA;
|
|
@@ -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: "TabView",
|
|
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: "TabViewItem",
|
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, Platform, Image } from "react-native";
|
|
3
|
+
import { SvgUri } from "react-native-svg";
|
|
4
|
+
import Config from "./Config";
|
|
5
|
+
|
|
6
|
+
const SVG = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
source,
|
|
9
|
+
style
|
|
10
|
+
} = _ref;
|
|
11
|
+
let svgSource = source === null || source === undefined ? Config.placeholderSvgURL : source;
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, Platform.OS === "ios" && /*#__PURE__*/React.createElement(View, {
|
|
13
|
+
style: style
|
|
14
|
+
}, /*#__PURE__*/React.createElement(SvgUri, {
|
|
15
|
+
width: "100%",
|
|
16
|
+
height: "100%",
|
|
17
|
+
uri: svgSource
|
|
18
|
+
})), Platform.OS === "android" && /*#__PURE__*/React.createElement(View, {
|
|
19
|
+
style: style
|
|
20
|
+
}, /*#__PURE__*/React.createElement(SvgUri, {
|
|
21
|
+
width: "100%",
|
|
22
|
+
height: "100%",
|
|
23
|
+
uri: svgSource
|
|
24
|
+
})), Platform.OS === "web" && /*#__PURE__*/React.createElement(Image, {
|
|
25
|
+
style: style,
|
|
26
|
+
source: {
|
|
27
|
+
uri: svgSource
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default SVG;
|
|
@@ -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;
|
package/lib/module/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { default as FAB } from "./components/FAB";
|
|
|
17
17
|
export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
|
|
18
18
|
export { default as IconButton } from "./components/IconButton";
|
|
19
19
|
export { default as Image } from "./components/Image";
|
|
20
|
+
export { default as SVG } from "./components/SVG";
|
|
20
21
|
export { default as NumberInput } from "./components/NumberInput";
|
|
21
22
|
export { default as ScreenContainer } from "./components/ScreenContainer";
|
|
22
23
|
export { default as StarRating } from "./components/StarRating";
|
|
@@ -28,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
28
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
29
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
|
|
30
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
+
export { TabView, TabViewItem } from "./components/TabView";
|
|
31
33
|
export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
|
|
32
34
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
|
|
33
35
|
/* Deprecated: Fix or Delete! */
|
|
@@ -6,8 +6,8 @@ export const SEED_DATA = {
|
|
|
6
6
|
category: COMPONENT_TYPES.media,
|
|
7
7
|
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
8
8
|
layout: {
|
|
9
|
-
width:
|
|
10
|
-
height:
|
|
9
|
+
width: 100,
|
|
10
|
+
height: 100
|
|
11
11
|
},
|
|
12
12
|
props: {
|
|
13
13
|
source: createImageProp(),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createSvgProp } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "SVG",
|
|
4
|
+
tag: "SVG",
|
|
5
|
+
description: "An SVG component",
|
|
6
|
+
category: COMPONENT_TYPES.media,
|
|
7
|
+
layout: {
|
|
8
|
+
width: 100,
|
|
9
|
+
height: 100
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
source: createSvgProp()
|
|
13
|
+
}
|
|
14
|
+
};
|