@draftbit/core 46.4.4-229578.2 → 46.4.4-41266b.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/Accordion/AccordionItem.js +25 -5
- package/lib/commonjs/components/Container.js +5 -17
- package/lib/commonjs/components/Swiper/Swiper.js +2 -0
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/mappings/Swiper.js +1 -0
- package/lib/module/components/Divider.js +2 -20
- package/lib/module/components/Image.js +3 -18
- package/lib/module/components/Swiper/Swiper.js +2 -0
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/Swiper.js +2 -1
- package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/mappings/Swiper.d.ts +1 -0
- package/package.json +4 -6
- package/src/components/Swiper/Swiper.js +2 -2
- package/src/components/Swiper/Swiper.tsx +3 -0
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/Swiper.js +2 -1
- package/src/mappings/Swiper.ts +2 -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
|
@@ -21,8 +21,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
21
21
|
|
|
22
22
|
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; }
|
|
23
23
|
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
24
|
const AccordionItem = _ref => {
|
|
27
25
|
let {
|
|
28
26
|
Icon,
|
|
@@ -37,9 +35,10 @@ const AccordionItem = _ref => {
|
|
|
37
35
|
textStyles,
|
|
38
36
|
viewStyles
|
|
39
37
|
} = (0, _utilities.extractStyles)(style);
|
|
40
|
-
return /*#__PURE__*/React.createElement(_reactNative.Pressable,
|
|
41
|
-
style: [styles.container, viewStyles]
|
|
42
|
-
|
|
38
|
+
return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
39
|
+
style: [styles.container, viewStyles],
|
|
40
|
+
...rest
|
|
41
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
43
42
|
style: styles.row
|
|
44
43
|
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
45
44
|
name: icon,
|
|
@@ -74,4 +73,25 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
74
73
|
|
|
75
74
|
var _default = (0, _theming.withTheme)(AccordionItem);
|
|
76
75
|
|
|
76
|
+
exports.default = _default;StyleSheet.create({
|
|
77
|
+
container: {
|
|
78
|
+
padding: 8
|
|
79
|
+
},
|
|
80
|
+
row: {
|
|
81
|
+
flexDirection: "row",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
paddingLeft: 8
|
|
84
|
+
},
|
|
85
|
+
item: {
|
|
86
|
+
marginVertical: 6,
|
|
87
|
+
paddingLeft: 8
|
|
88
|
+
},
|
|
89
|
+
content: {
|
|
90
|
+
flex: 1,
|
|
91
|
+
justifyContent: "center"
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
var _default = (0, _theming.withTheme)(AccordionItem);
|
|
96
|
+
|
|
77
97
|
exports.default = _default;
|
|
@@ -19,6 +19,8 @@ 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
|
+
|
|
22
24
|
const Container = _ref => {
|
|
23
25
|
let {
|
|
24
26
|
useThemeGutterPadding,
|
|
@@ -80,10 +82,9 @@ const Container = _ref => {
|
|
|
80
82
|
};
|
|
81
83
|
const Wrap = elevation ? _Elevation.default : _reactNative.View;
|
|
82
84
|
if (elevation) containerStyle.elevation = elevation;
|
|
83
|
-
return /*#__PURE__*/React.createElement(Wrap, {
|
|
84
|
-
style: [containerStyle, style]
|
|
85
|
-
|
|
86
|
-
}, backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
|
|
85
|
+
return /*#__PURE__*/React.createElement(Wrap, _extends({
|
|
86
|
+
style: [containerStyle, style]
|
|
87
|
+
}, rest), backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
|
|
87
88
|
source: typeof backgroundImage === "string" ? {
|
|
88
89
|
uri: backgroundImage
|
|
89
90
|
} : backgroundImage,
|
|
@@ -100,17 +101,4 @@ const Container = _ref => {
|
|
|
100
101
|
|
|
101
102
|
var _default = (0, _theming.withTheme)(Container);
|
|
102
103
|
|
|
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
|
-
|
|
116
104
|
exports.default = _default;
|
|
@@ -30,6 +30,7 @@ const Swiper = _ref => {
|
|
|
30
30
|
keyExtractor,
|
|
31
31
|
renderItem,
|
|
32
32
|
children,
|
|
33
|
+
onIndexChanged,
|
|
33
34
|
style
|
|
34
35
|
} = _ref;
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
@@ -39,6 +40,7 @@ const Swiper = _ref => {
|
|
|
39
40
|
loop: loop,
|
|
40
41
|
timeout: timeout,
|
|
41
42
|
vertical: vertical,
|
|
43
|
+
onIndexChanged: onIndexChanged,
|
|
42
44
|
controlsProps: {
|
|
43
45
|
prevTitle,
|
|
44
46
|
nextTitle,
|
package/lib/commonjs/index.js
CHANGED
|
@@ -369,18 +369,6 @@ 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
|
-
});
|
|
384
372
|
Object.defineProperty(exports, "TextField", {
|
|
385
373
|
enumerable: true,
|
|
386
374
|
get: function () {
|
|
@@ -484,8 +472,6 @@ var _ActionSheet = require("./components/ActionSheet");
|
|
|
484
472
|
|
|
485
473
|
var _Swiper = require("./components/Swiper");
|
|
486
474
|
|
|
487
|
-
var _TabView = require("./components/TabView");
|
|
488
|
-
|
|
489
475
|
var _Layout = require("./components/Layout");
|
|
490
476
|
|
|
491
477
|
var _index = require("./components/RadioButton/index");
|
|
@@ -1,27 +1,9 @@
|
|
|
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
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import { StyleSheet, View } from "react-native";
|
|
3
5
|
import { withTheme } from "../theming";
|
|
4
6
|
|
|
5
|
-
const Divider = _ref => {
|
|
6
|
-
let {
|
|
7
|
-
style,
|
|
8
|
-
color,
|
|
9
|
-
theme: {
|
|
10
|
-
colors
|
|
11
|
-
},
|
|
12
|
-
...rest
|
|
13
|
-
} = _ref;
|
|
14
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
15
|
-
style: [{
|
|
16
|
-
backgroundColor: color || colors.divider,
|
|
17
|
-
height: StyleSheet.hairlineWidth
|
|
18
|
-
}, style],
|
|
19
|
-
...rest
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default withTheme(Divider);ng";
|
|
24
|
-
|
|
25
7
|
const Divider = _ref => {
|
|
26
8
|
let {
|
|
27
9
|
style,
|
|
@@ -1,3 +1,5 @@
|
|
|
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
|
+
|
|
1
3
|
/* README: Internal Image component used for stuff like Card. DO NOT EXPORT! */
|
|
2
4
|
import React from "react";
|
|
3
5
|
import { Image as NativeImage, StyleSheet } from "react-native";
|
|
@@ -62,24 +64,7 @@ const Image = _ref2 => {
|
|
|
62
64
|
height,
|
|
63
65
|
aspectRatio
|
|
64
66
|
}]
|
|
65
|
-
}, /*#__PURE__*/React.createElement(NativeImage, {
|
|
66
|
-
source: imageSource,
|
|
67
|
-
resizeMode: resizeMode,
|
|
68
|
-
style: [style, {
|
|
69
|
-
height: "100%",
|
|
70
|
-
width: "100%"
|
|
71
|
-
}]
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return /*#__PURE__*/React.createElement(NativeImage, { ...props,
|
|
76
|
-
source: source,
|
|
77
|
-
resizeMode: resizeMode,
|
|
78
|
-
style: style
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default Image;ent(NativeImage, _extends({}, props, {
|
|
67
|
+
}, /*#__PURE__*/React.createElement(NativeImage, _extends({}, props, {
|
|
83
68
|
source: imageSource,
|
|
84
69
|
resizeMode: resizeMode,
|
|
85
70
|
style: [style, {
|
|
@@ -19,6 +19,7 @@ const Swiper = _ref => {
|
|
|
19
19
|
keyExtractor,
|
|
20
20
|
renderItem,
|
|
21
21
|
children,
|
|
22
|
+
onIndexChanged,
|
|
22
23
|
style
|
|
23
24
|
} = _ref;
|
|
24
25
|
return /*#__PURE__*/React.createElement(View, {
|
|
@@ -28,6 +29,7 @@ const Swiper = _ref => {
|
|
|
28
29
|
loop: loop,
|
|
29
30
|
timeout: timeout,
|
|
30
31
|
vertical: vertical,
|
|
32
|
+
onIndexChanged: onIndexChanged,
|
|
31
33
|
controlsProps: {
|
|
32
34
|
prevTitle,
|
|
33
35
|
nextTitle,
|
package/lib/module/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! */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, Triggers } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Swiper",
|
|
4
4
|
tag: "Swiper",
|
|
@@ -8,6 +8,7 @@ export const SEED_DATA = {
|
|
|
8
8
|
height: 300,
|
|
9
9
|
width: "100%"
|
|
10
10
|
},
|
|
11
|
+
triggers: [Triggers.OnIndexChanged],
|
|
11
12
|
props: {
|
|
12
13
|
from: createNumberProp({
|
|
13
14
|
group: GROUPS.basic,
|
|
@@ -20,6 +20,7 @@ export interface SwiperProps<T> {
|
|
|
20
20
|
index: number;
|
|
21
21
|
}) => JSX.Element;
|
|
22
22
|
style?: StyleProp<ViewStyle>;
|
|
23
|
+
onIndexChanged?: (index: number) => void;
|
|
23
24
|
}
|
|
24
|
-
declare const Swiper: ({ vertical, loop, timeout, from, prevTitle, nextTitle, prevTitleColor, nextTitleColor, dotsTouchable, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, style, }: SwiperProps<any>) => JSX.Element;
|
|
25
|
+
declare const Swiper: ({ vertical, loop, timeout, from, prevTitle, nextTitle, prevTitleColor, nextTitleColor, dotsTouchable, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, onIndexChanged, style, }: SwiperProps<any>) => JSX.Element;
|
|
25
26
|
export default Swiper;
|
|
@@ -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
|
export { default as CardBlock } from "./components/CardBlock";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.4.4-
|
|
3
|
+
"version": "46.4.4-41266b.2+41266b0",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.4.4-
|
|
44
|
+
"@draftbit/types": "^46.4.4-41266b.2+41266b0",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -54,9 +54,7 @@
|
|
|
54
54
|
"lodash.omit": "^4.5.0",
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
56
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
57
|
-
"react-native-
|
|
58
|
-
"react-native-svg": "^12.3.0",
|
|
59
|
-
"react-native-tab-view": "^3.3.0",
|
|
57
|
+
"react-native-svg": "12.3.0",
|
|
60
58
|
"react-native-typography": "^1.4.1",
|
|
61
59
|
"react-native-web-swiper": "^2.2.3"
|
|
62
60
|
},
|
|
@@ -83,5 +81,5 @@
|
|
|
83
81
|
]
|
|
84
82
|
]
|
|
85
83
|
},
|
|
86
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "41266b08b3e00b6122fff95a93f5e9e9084a36c6"
|
|
87
85
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import SwiperComponent from "react-native-web-swiper";
|
|
4
|
-
const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, style, }) => (React.createElement(View, { style: style },
|
|
5
|
-
React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, controlsProps: {
|
|
4
|
+
const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, onIndexChanged, style, }) => (React.createElement(View, { style: style },
|
|
5
|
+
React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, onIndexChanged: onIndexChanged, controlsProps: {
|
|
6
6
|
prevTitle,
|
|
7
7
|
nextTitle,
|
|
8
8
|
prevTitleStyle: { color: prevTitleColor },
|
|
@@ -19,6 +19,7 @@ export interface SwiperProps<T> {
|
|
|
19
19
|
keyExtractor: (item: T, index: number) => string;
|
|
20
20
|
renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
|
|
21
21
|
style?: StyleProp<ViewStyle>;
|
|
22
|
+
onIndexChanged?: (index: number) => void;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const Swiper = ({
|
|
@@ -37,6 +38,7 @@ const Swiper = ({
|
|
|
37
38
|
keyExtractor,
|
|
38
39
|
renderItem,
|
|
39
40
|
children,
|
|
41
|
+
onIndexChanged,
|
|
40
42
|
style,
|
|
41
43
|
}: SwiperProps<any>) => (
|
|
42
44
|
<View style={style}>
|
|
@@ -46,6 +48,7 @@ const Swiper = ({
|
|
|
46
48
|
loop={loop}
|
|
47
49
|
timeout={timeout}
|
|
48
50
|
vertical={vertical}
|
|
51
|
+
onIndexChanged={onIndexChanged}
|
|
49
52
|
controlsProps={{
|
|
50
53
|
prevTitle,
|
|
51
54
|
nextTitle,
|
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
package/src/mappings/Swiper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, Triggers, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Swiper",
|
|
4
4
|
tag: "Swiper",
|
|
@@ -8,6 +8,7 @@ export const SEED_DATA = {
|
|
|
8
8
|
height: 300,
|
|
9
9
|
width: "100%",
|
|
10
10
|
},
|
|
11
|
+
triggers: [Triggers.OnIndexChanged],
|
|
11
12
|
props: {
|
|
12
13
|
from: createNumberProp({
|
|
13
14
|
group: GROUPS.basic,
|
package/src/mappings/Swiper.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
createTextProp,
|
|
6
6
|
createColorProp,
|
|
7
7
|
GROUPS,
|
|
8
|
+
Triggers,
|
|
8
9
|
} from "@draftbit/types";
|
|
9
10
|
|
|
10
11
|
export const SEED_DATA = {
|
|
@@ -16,6 +17,7 @@ export const SEED_DATA = {
|
|
|
16
17
|
height: 300,
|
|
17
18
|
width: "100%",
|
|
18
19
|
},
|
|
20
|
+
triggers: [Triggers.OnIndexChanged],
|
|
19
21
|
props: {
|
|
20
22
|
from: createNumberProp({
|
|
21
23
|
group: GROUPS.basic,
|
|
@@ -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;
|
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
})[];
|
|
@@ -1,34 +0,0 @@
|
|
|
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;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
-
import { TabView, TabBar, SceneMap } from "react-native-tab-view";
|
|
4
|
-
|
|
5
|
-
// import { withTheme } from "../../theming";
|
|
6
|
-
import TabViewItem from "./TabViewItem";
|
|
7
|
-
import type { IconSlot } from "../../interfaces/Icon";
|
|
8
|
-
|
|
9
|
-
type TabBarPosition = "top" | "bottom";
|
|
10
|
-
type KeyboardDismissMode = "none" | "auto" | "on-drag";
|
|
11
|
-
|
|
12
|
-
type TabViewProps = {
|
|
13
|
-
tabBarPosition?: TabBarPosition;
|
|
14
|
-
keyboardDismissMode?: KeyboardDismissMode;
|
|
15
|
-
swipeEnabled?: boolean;
|
|
16
|
-
scrollEnabled?: boolean;
|
|
17
|
-
activeColor?: string;
|
|
18
|
-
inactiveColor?: string;
|
|
19
|
-
pressColor?: string;
|
|
20
|
-
indicatorColor?: string;
|
|
21
|
-
style?: StyleProp<TextStyle | ViewStyle>;
|
|
22
|
-
children: React.ReactNode;
|
|
23
|
-
} & IconSlot;
|
|
24
|
-
|
|
25
|
-
const TabViewComponent = ({
|
|
26
|
-
Icon,
|
|
27
|
-
tabBarPosition,
|
|
28
|
-
keyboardDismissMode,
|
|
29
|
-
swipeEnabled,
|
|
30
|
-
scrollEnabled,
|
|
31
|
-
activeColor,
|
|
32
|
-
inactiveColor,
|
|
33
|
-
pressColor,
|
|
34
|
-
indicatorColor,
|
|
35
|
-
style,
|
|
36
|
-
children,
|
|
37
|
-
}: TabViewProps) => {
|
|
38
|
-
const [index, setIndex] = React.useState(0);
|
|
39
|
-
const [routes, setRoutes] = React.useState([]);
|
|
40
|
-
const [tabScenes, setTabScenes] = React.useState({});
|
|
41
|
-
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
const newRoutes: any = [];
|
|
44
|
-
const scenes: any = {};
|
|
45
|
-
|
|
46
|
-
React.Children.toArray(children)
|
|
47
|
-
.filter((child: any) => child.type === TabViewItem)
|
|
48
|
-
.forEach((child: any) => {
|
|
49
|
-
if (child?.props?.id) {
|
|
50
|
-
newRoutes.push({
|
|
51
|
-
key: child?.props?.id,
|
|
52
|
-
...child?.props,
|
|
53
|
-
});
|
|
54
|
-
scenes[child?.props?.id] = () => child;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
setRoutes(newRoutes);
|
|
59
|
-
setTabScenes(scenes);
|
|
60
|
-
}, [children]);
|
|
61
|
-
|
|
62
|
-
const indexChangeHandler = (i: any) => setIndex(i);
|
|
63
|
-
|
|
64
|
-
const renderTabBar = (props: any) => {
|
|
65
|
-
console.log(props);
|
|
66
|
-
return (
|
|
67
|
-
<TabBar
|
|
68
|
-
{...props}
|
|
69
|
-
activeColor={activeColor}
|
|
70
|
-
inactiveColor={inactiveColor}
|
|
71
|
-
pressColor={pressColor}
|
|
72
|
-
scrollEnabled={scrollEnabled}
|
|
73
|
-
indicatorStyle={{ backgroundColor: indicatorColor }}
|
|
74
|
-
renderIcon={({ route, color }) =>
|
|
75
|
-
route?.icon ? (
|
|
76
|
-
<Icon name={route.icon} color={color} size={36} />
|
|
77
|
-
) : null
|
|
78
|
-
}
|
|
79
|
-
style={style}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<TabView
|
|
86
|
-
navigationState={{ index, routes }}
|
|
87
|
-
renderScene={SceneMap(tabScenes)}
|
|
88
|
-
renderTabBar={renderTabBar}
|
|
89
|
-
onIndexChange={indexChangeHandler}
|
|
90
|
-
tabBarPosition={tabBarPosition}
|
|
91
|
-
keyboardDismissMode={keyboardDismissMode}
|
|
92
|
-
swipeEnabled={swipeEnabled}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export default TabViewComponent;
|
|
@@ -1,21 +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
|
-
|
|
10
|
-
const TabViewItem = ({
|
|
11
|
-
title,
|
|
12
|
-
id,
|
|
13
|
-
icon,
|
|
14
|
-
children,
|
|
15
|
-
accessibilityLabel,
|
|
16
|
-
}: TabViewItemProps) => {
|
|
17
|
-
console.log({ title, id, icon, accessibilityLabel });
|
|
18
|
-
return children;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default TabViewItem;
|
package/src/mappings/TabView.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp, } from "@draftbit/types";
|
|
2
|
-
export const SEED_DATA = [
|
|
3
|
-
{
|
|
4
|
-
name: "Tab View",
|
|
5
|
-
tag: "TabView",
|
|
6
|
-
category: COMPONENT_TYPES.container,
|
|
7
|
-
layout: {},
|
|
8
|
-
props: {
|
|
9
|
-
tabBarPosition: createTextEnumProp({
|
|
10
|
-
label: "Tab Bar Position",
|
|
11
|
-
description: "Tab Bar Position",
|
|
12
|
-
options: ["top", "bottom"],
|
|
13
|
-
defaultValue: "top",
|
|
14
|
-
}),
|
|
15
|
-
keyboardDismissMode: createTextEnumProp({
|
|
16
|
-
label: "Keyboard Dismiss Mode",
|
|
17
|
-
description: "Keyboard Dismiss Mode",
|
|
18
|
-
options: ["auto", "on-drag", "none"],
|
|
19
|
-
defaultValue: "auto",
|
|
20
|
-
}),
|
|
21
|
-
swipeEnabled: createBoolProp({
|
|
22
|
-
label: "Swipe Enabled",
|
|
23
|
-
description: "Swipe Enabled",
|
|
24
|
-
defaultValue: true,
|
|
25
|
-
}),
|
|
26
|
-
scrollEnabled: createBoolProp({
|
|
27
|
-
label: "Scroll Enabled",
|
|
28
|
-
description: "Scroll Enabled",
|
|
29
|
-
defaultValue: true,
|
|
30
|
-
}),
|
|
31
|
-
activeColor: createColorProp({
|
|
32
|
-
label: "Active Color",
|
|
33
|
-
description: "Active Color",
|
|
34
|
-
defaultValue: "primary",
|
|
35
|
-
}),
|
|
36
|
-
inactiveColor: createColorProp({
|
|
37
|
-
label: "Inactive Color",
|
|
38
|
-
description: "Inactive Color",
|
|
39
|
-
defaultValue: null,
|
|
40
|
-
}),
|
|
41
|
-
pressColor: createColorProp({
|
|
42
|
-
label: "Press Color",
|
|
43
|
-
description: "Press Color",
|
|
44
|
-
defaultValue: null,
|
|
45
|
-
}),
|
|
46
|
-
indicatorColor: createColorProp({
|
|
47
|
-
label: "Indicator Color",
|
|
48
|
-
description: "Indicator Color",
|
|
49
|
-
defaultValue: null,
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "Tab View Item",
|
|
55
|
-
tag: "TabViewItem",
|
|
56
|
-
category: COMPONENT_TYPES.container,
|
|
57
|
-
layout: {},
|
|
58
|
-
props: {
|
|
59
|
-
title: createTextProp({
|
|
60
|
-
label: "Title",
|
|
61
|
-
description: "Tab Title",
|
|
62
|
-
}),
|
|
63
|
-
id: createTextProp({
|
|
64
|
-
label: "Id",
|
|
65
|
-
description: "Tab Id",
|
|
66
|
-
}),
|
|
67
|
-
accessibilityLabel: createTextProp({
|
|
68
|
-
label: "Accessibility Label",
|
|
69
|
-
description: "Accessibility Label",
|
|
70
|
-
}),
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
];
|
package/src/mappings/TabView.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMPONENT_TYPES,
|
|
3
|
-
createTextProp,
|
|
4
|
-
createTextEnumProp,
|
|
5
|
-
createBoolProp,
|
|
6
|
-
createColorProp,
|
|
7
|
-
} from "@draftbit/types";
|
|
8
|
-
|
|
9
|
-
export const SEED_DATA = [
|
|
10
|
-
{
|
|
11
|
-
name: "Tab View",
|
|
12
|
-
tag: "TabView",
|
|
13
|
-
category: COMPONENT_TYPES.container,
|
|
14
|
-
layout: {},
|
|
15
|
-
props: {
|
|
16
|
-
tabBarPosition: createTextEnumProp({
|
|
17
|
-
label: "Tab Bar Position",
|
|
18
|
-
description: "Tab Bar Position",
|
|
19
|
-
options: ["top", "bottom"],
|
|
20
|
-
defaultValue: "top",
|
|
21
|
-
}),
|
|
22
|
-
keyboardDismissMode: createTextEnumProp({
|
|
23
|
-
label: "Keyboard Dismiss Mode",
|
|
24
|
-
description: "Keyboard Dismiss Mode",
|
|
25
|
-
options: ["auto", "on-drag", "none"],
|
|
26
|
-
defaultValue: "auto",
|
|
27
|
-
}),
|
|
28
|
-
swipeEnabled: createBoolProp({
|
|
29
|
-
label: "Swipe Enabled",
|
|
30
|
-
description: "Swipe Enabled",
|
|
31
|
-
defaultValue: true,
|
|
32
|
-
}),
|
|
33
|
-
scrollEnabled: createBoolProp({
|
|
34
|
-
label: "Scroll Enabled",
|
|
35
|
-
description: "Scroll Enabled",
|
|
36
|
-
defaultValue: true,
|
|
37
|
-
}),
|
|
38
|
-
activeColor: createColorProp({
|
|
39
|
-
label: "Active Color",
|
|
40
|
-
description: "Active Color",
|
|
41
|
-
defaultValue: "primary",
|
|
42
|
-
}),
|
|
43
|
-
inactiveColor: createColorProp({
|
|
44
|
-
label: "Inactive Color",
|
|
45
|
-
description: "Inactive Color",
|
|
46
|
-
defaultValue: null,
|
|
47
|
-
}),
|
|
48
|
-
pressColor: createColorProp({
|
|
49
|
-
label: "Press Color",
|
|
50
|
-
description: "Press Color",
|
|
51
|
-
defaultValue: null,
|
|
52
|
-
}),
|
|
53
|
-
indicatorColor: createColorProp({
|
|
54
|
-
label: "Indicator Color",
|
|
55
|
-
description: "Indicator Color",
|
|
56
|
-
defaultValue: null,
|
|
57
|
-
}),
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "Tab View Item",
|
|
62
|
-
tag: "TabViewItem",
|
|
63
|
-
category: COMPONENT_TYPES.container,
|
|
64
|
-
layout: {},
|
|
65
|
-
props: {
|
|
66
|
-
title: createTextProp({
|
|
67
|
-
label: "Title",
|
|
68
|
-
description: "Tab Title",
|
|
69
|
-
}),
|
|
70
|
-
id: createTextProp({
|
|
71
|
-
label: "Id",
|
|
72
|
-
description: "Tab Id",
|
|
73
|
-
}),
|
|
74
|
-
accessibilityLabel: createTextProp({
|
|
75
|
-
label: "Accessibility Label",
|
|
76
|
-
description: "Accessibility Label",
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
];
|