@draftbit/core 46.8.1-e9e820.2 → 46.8.1-fb7984.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 +4 -23
- package/lib/commonjs/components/Shadow.js +44 -0
- package/lib/commonjs/index.js +7 -13
- package/lib/commonjs/mappings/Shadow.js +94 -0
- package/lib/module/components/Accordion/AccordionItem.js +4 -25
- package/lib/module/components/Shadow.js +36 -0
- package/lib/module/constants.js +0 -1
- package/lib/module/index.js +1 -1
- package/lib/module/mappings/Shadow.js +87 -0
- package/lib/typescript/src/components/Shadow.d.ts +24 -0
- package/lib/typescript/src/components/Shadow.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/{TabView.d.ts → Shadow.d.ts} +82 -32
- package/lib/typescript/src/mappings/Shadow.d.ts.map +1 -0
- package/package.json +4 -5
- package/src/components/Shadow.js +16 -0
- package/src/components/Shadow.tsx +60 -0
- package/src/index.js +1 -1
- package/src/index.tsx +2 -2
- package/src/mappings/Shadow.js +87 -0
- package/src/mappings/Shadow.ts +95 -0
- package/lib/commonjs/components/TabView/TabView.js +0 -100
- package/lib/commonjs/components/TabView/TabViewItem.js +0 -25
- package/lib/commonjs/components/TabView/index.js +0 -20
- package/lib/commonjs/mappings/TabView.js +0 -73
- package/lib/commonjs/mappings/TabViewItem.js +0 -35
- package/lib/module/components/TabView/TabView.js +0 -90
- package/lib/module/components/TabView/TabViewItem.js +0 -20
- package/lib/module/components/TabView/index.js +0 -2
- package/lib/module/mappings/TabView.js +0 -66
- package/lib/module/mappings/TabViewItem.js +0 -28
- package/lib/typescript/src/components/TabView/TabView.d.ts +0 -26
- package/lib/typescript/src/components/TabView/TabView.d.ts.map +0 -1
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -11
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +0 -1
- package/lib/typescript/src/components/TabView/index.d.ts +0 -3
- package/lib/typescript/src/components/TabView/index.d.ts.map +0 -1
- package/lib/typescript/src/mappings/TabView.d.ts.map +0 -1
- package/lib/typescript/src/mappings/TabViewItem.d.ts +0 -25
- package/lib/typescript/src/mappings/TabViewItem.d.ts.map +0 -1
- package/src/components/TabView/TabView.js +0 -45
- package/src/components/TabView/TabView.tsx +0 -129
- package/src/components/TabView/TabViewItem.js +0 -11
- package/src/components/TabView/TabViewItem.tsx +0 -25
- package/src/components/TabView/index.js +0 -2
- package/src/components/TabView/index.tsx +0 -2
- package/src/mappings/TabView.js +0 -69
- package/src/mappings/TabView.ts +0 -79
- package/src/mappings/TabViewItem.js +0 -28
- package/src/mappings/TabViewItem.ts +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.8.1-
|
|
3
|
+
"version": "46.8.1-fb7984.2+fb7984b",
|
|
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.8.1-
|
|
44
|
+
"@draftbit/types": "^46.8.1-fb7984.2+fb7984b",
|
|
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",
|
|
@@ -55,9 +55,8 @@
|
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
56
|
"react-native-deck-swiper": "^2.0.12",
|
|
57
57
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
58
|
-
"react-native-
|
|
58
|
+
"react-native-shadow-2": "^7.0.6",
|
|
59
59
|
"react-native-svg": "12.3.0",
|
|
60
|
-
"react-native-tab-view": "^3.4.0",
|
|
61
60
|
"react-native-typography": "^1.4.1",
|
|
62
61
|
"react-native-web-swiper": "^2.2.3"
|
|
63
62
|
},
|
|
@@ -94,5 +93,5 @@
|
|
|
94
93
|
]
|
|
95
94
|
]
|
|
96
95
|
},
|
|
97
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "fb7984b6ca9f465da6dceb837da618478e02d92f"
|
|
98
97
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Shadow as ShadowComponent } from "react-native-shadow-2";
|
|
3
|
+
const Shadow = ({ offsetX = 0, offsetY = 0, showShadowSideStart = true, showShadowSideEnd = true, showShadowSideTop = true, showShadowSideBottom = true, showShadowCornerTopStart = true, showShadowCornerTopEnd = true, showShadowCornerBottomStart = true, showShadowCornerBottomEnd = true, style, ...rest }) => {
|
|
4
|
+
return (React.createElement(ShadowComponent, { offset: [offsetX, offsetY], sides: {
|
|
5
|
+
start: showShadowSideStart,
|
|
6
|
+
end: showShadowSideEnd,
|
|
7
|
+
top: showShadowSideTop,
|
|
8
|
+
bottom: showShadowSideBottom,
|
|
9
|
+
}, corners: {
|
|
10
|
+
topStart: showShadowCornerTopStart,
|
|
11
|
+
topEnd: showShadowCornerTopEnd,
|
|
12
|
+
bottomStart: showShadowCornerBottomStart,
|
|
13
|
+
bottomEnd: showShadowCornerBottomEnd,
|
|
14
|
+
}, containerStyle: style, ...rest }));
|
|
15
|
+
};
|
|
16
|
+
export default Shadow;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { Shadow as ShadowComponent } from "react-native-shadow-2";
|
|
4
|
+
|
|
5
|
+
interface ShadowProps {
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
startColor?: string;
|
|
8
|
+
endColor?: string;
|
|
9
|
+
distance?: number;
|
|
10
|
+
paintInside?: boolean;
|
|
11
|
+
stretch?: boolean;
|
|
12
|
+
offsetX?: number;
|
|
13
|
+
offsetY?: number;
|
|
14
|
+
showShadowSideStart?: boolean;
|
|
15
|
+
showShadowSideEnd?: boolean;
|
|
16
|
+
showShadowSideTop?: boolean;
|
|
17
|
+
showShadowSideBottom?: boolean;
|
|
18
|
+
showShadowCornerTopStart?: boolean;
|
|
19
|
+
showShadowCornerTopEnd?: boolean;
|
|
20
|
+
showShadowCornerBottomStart?: boolean;
|
|
21
|
+
showShadowCornerBottomEnd?: boolean;
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Shadow: React.FC<React.PropsWithChildren<ShadowProps>> = ({
|
|
26
|
+
offsetX = 0,
|
|
27
|
+
offsetY = 0,
|
|
28
|
+
showShadowSideStart = true,
|
|
29
|
+
showShadowSideEnd = true,
|
|
30
|
+
showShadowSideTop = true,
|
|
31
|
+
showShadowSideBottom = true,
|
|
32
|
+
showShadowCornerTopStart = true,
|
|
33
|
+
showShadowCornerTopEnd = true,
|
|
34
|
+
showShadowCornerBottomStart = true,
|
|
35
|
+
showShadowCornerBottomEnd = true,
|
|
36
|
+
style,
|
|
37
|
+
...rest
|
|
38
|
+
}) => {
|
|
39
|
+
return (
|
|
40
|
+
<ShadowComponent
|
|
41
|
+
offset={[offsetX, offsetY]}
|
|
42
|
+
sides={{
|
|
43
|
+
start: showShadowSideStart,
|
|
44
|
+
end: showShadowSideEnd,
|
|
45
|
+
top: showShadowSideTop,
|
|
46
|
+
bottom: showShadowSideBottom,
|
|
47
|
+
}}
|
|
48
|
+
corners={{
|
|
49
|
+
topStart: showShadowCornerTopStart,
|
|
50
|
+
topEnd: showShadowCornerTopEnd,
|
|
51
|
+
bottomStart: showShadowCornerBottomStart,
|
|
52
|
+
bottomEnd: showShadowCornerBottomEnd,
|
|
53
|
+
}}
|
|
54
|
+
containerStyle={style}
|
|
55
|
+
{...rest}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default Shadow;
|
package/src/index.js
CHANGED
|
@@ -31,8 +31,8 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
|
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
|
+
export { default as Shadow } from "./components/Shadow";
|
|
34
35
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
|
-
export { TabView, TabViewItem } from "./components/TabView";
|
|
36
36
|
/* Deprecated: Fix or Delete! */
|
|
37
37
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
38
38
|
export { default as Picker } from "./components/Picker/Picker";
|
package/src/index.tsx
CHANGED
|
@@ -51,9 +51,9 @@ export {
|
|
|
51
51
|
RadioButtonFieldGroup,
|
|
52
52
|
} from "./components/RadioButton/index";
|
|
53
53
|
|
|
54
|
-
export {
|
|
54
|
+
export { default as Shadow } from "./components/Shadow";
|
|
55
55
|
|
|
56
|
-
export {
|
|
56
|
+
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
57
57
|
|
|
58
58
|
/* Deprecated: Fix or Delete! */
|
|
59
59
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, CONTAINER_COMPONENT_STYLES_SECTIONS, createColorProp, createStaticNumberProp, createStaticBoolProp, createDisabledProp, } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Shadow",
|
|
4
|
+
tag: "Shadow",
|
|
5
|
+
description: "A cross-platform, universal shadow.",
|
|
6
|
+
category: COMPONENT_TYPES.view,
|
|
7
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
8
|
+
props: {
|
|
9
|
+
disabled: createDisabledProp({
|
|
10
|
+
description: "Disables the shadow.",
|
|
11
|
+
}),
|
|
12
|
+
startColor: createColorProp({
|
|
13
|
+
label: "Start Color",
|
|
14
|
+
description: "The initial gradient color of the shadow.",
|
|
15
|
+
defaultValue: null,
|
|
16
|
+
}),
|
|
17
|
+
endColor: createColorProp({
|
|
18
|
+
label: "End Color",
|
|
19
|
+
description: "The final gradient color of the shadow.",
|
|
20
|
+
defaultValue: null,
|
|
21
|
+
}),
|
|
22
|
+
distance: createStaticNumberProp({
|
|
23
|
+
label: "Distance",
|
|
24
|
+
description: "The distance of the shadow.",
|
|
25
|
+
}),
|
|
26
|
+
paintInside: createStaticBoolProp({
|
|
27
|
+
label: "Paint Inside",
|
|
28
|
+
description: "Apply the shadow below/inside the content.",
|
|
29
|
+
defaultValue: null,
|
|
30
|
+
}),
|
|
31
|
+
stretch: createStaticBoolProp({
|
|
32
|
+
label: "Stretch",
|
|
33
|
+
description: "Force children to occupy all available horizontal space.",
|
|
34
|
+
defaultValue: null,
|
|
35
|
+
}),
|
|
36
|
+
offsetX: createStaticNumberProp({
|
|
37
|
+
label: "Offset X",
|
|
38
|
+
description: "Moves the shadow in the x direction",
|
|
39
|
+
defeaultValue: 0,
|
|
40
|
+
}),
|
|
41
|
+
offsetY: createStaticNumberProp({
|
|
42
|
+
label: "Offset Y",
|
|
43
|
+
description: "Moves the shadow in the y direction",
|
|
44
|
+
defeaultValue: 0,
|
|
45
|
+
}),
|
|
46
|
+
showShadowSideStart: createStaticBoolProp({
|
|
47
|
+
label: "Show Shadow Start",
|
|
48
|
+
description: "Whether to show shadow on the start side or not",
|
|
49
|
+
defaultValue: true,
|
|
50
|
+
}),
|
|
51
|
+
showShadowSideEnd: createStaticBoolProp({
|
|
52
|
+
label: "Show Shadow End",
|
|
53
|
+
description: "Whether to show shadow on the end side or not",
|
|
54
|
+
defaultValue: true,
|
|
55
|
+
}),
|
|
56
|
+
showShadowSideTop: createStaticBoolProp({
|
|
57
|
+
label: "Show Shadow Top",
|
|
58
|
+
description: "Whether to show shadow on the top side or not",
|
|
59
|
+
defaultValue: true,
|
|
60
|
+
}),
|
|
61
|
+
showShadowSideBottom: createStaticBoolProp({
|
|
62
|
+
label: "Show Shadow Bottom",
|
|
63
|
+
description: "Whether to show shadow on the bottom side or not",
|
|
64
|
+
defaultValue: true,
|
|
65
|
+
}),
|
|
66
|
+
showShadowCornerTopStart: createStaticBoolProp({
|
|
67
|
+
label: "Show Shadow Top Start Corner",
|
|
68
|
+
description: "Whether to show shadow on the top start corner or not",
|
|
69
|
+
defaultValue: true,
|
|
70
|
+
}),
|
|
71
|
+
showShadowCornerTopEnd: createStaticBoolProp({
|
|
72
|
+
label: "Show Shadow Top End Corner",
|
|
73
|
+
description: "Whether to show shadow on the top end corner or not",
|
|
74
|
+
defaultValue: true,
|
|
75
|
+
}),
|
|
76
|
+
showShadowCornerBottomStart: createStaticBoolProp({
|
|
77
|
+
label: "Show Shadow Bottom Start Corner",
|
|
78
|
+
description: "Whether to show shadow on the bottom start corner or not",
|
|
79
|
+
defaultValue: true,
|
|
80
|
+
}),
|
|
81
|
+
showShadowCornerBottomEnd: createStaticBoolProp({
|
|
82
|
+
label: "Show Shadow Bottom End Corner",
|
|
83
|
+
description: "Whether to show shadow on the bottom end corner or not",
|
|
84
|
+
defaultValue: true,
|
|
85
|
+
}),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
4
|
+
createColorProp,
|
|
5
|
+
createStaticNumberProp,
|
|
6
|
+
createStaticBoolProp,
|
|
7
|
+
createDisabledProp,
|
|
8
|
+
} from "@draftbit/types";
|
|
9
|
+
|
|
10
|
+
export const SEED_DATA = {
|
|
11
|
+
name: "Shadow",
|
|
12
|
+
tag: "Shadow",
|
|
13
|
+
description: "A cross-platform, universal shadow.",
|
|
14
|
+
category: COMPONENT_TYPES.view,
|
|
15
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: createDisabledProp({
|
|
18
|
+
description: "Disables the shadow.",
|
|
19
|
+
}),
|
|
20
|
+
startColor: createColorProp({
|
|
21
|
+
label: "Start Color",
|
|
22
|
+
description: "The initial gradient color of the shadow.",
|
|
23
|
+
defaultValue: null,
|
|
24
|
+
}),
|
|
25
|
+
endColor: createColorProp({
|
|
26
|
+
label: "End Color",
|
|
27
|
+
description: "The final gradient color of the shadow.",
|
|
28
|
+
defaultValue: null,
|
|
29
|
+
}),
|
|
30
|
+
distance: createStaticNumberProp({
|
|
31
|
+
label: "Distance",
|
|
32
|
+
description: "The distance of the shadow.",
|
|
33
|
+
}),
|
|
34
|
+
paintInside: createStaticBoolProp({
|
|
35
|
+
label: "Paint Inside",
|
|
36
|
+
description: "Apply the shadow below/inside the content.",
|
|
37
|
+
defaultValue: null,
|
|
38
|
+
}),
|
|
39
|
+
stretch: createStaticBoolProp({
|
|
40
|
+
label: "Stretch",
|
|
41
|
+
description: "Force children to occupy all available horizontal space.",
|
|
42
|
+
defaultValue: null,
|
|
43
|
+
}),
|
|
44
|
+
offsetX: createStaticNumberProp({
|
|
45
|
+
label: "Offset X",
|
|
46
|
+
description: "Moves the shadow in the x direction",
|
|
47
|
+
defeaultValue: 0,
|
|
48
|
+
}),
|
|
49
|
+
offsetY: createStaticNumberProp({
|
|
50
|
+
label: "Offset Y",
|
|
51
|
+
description: "Moves the shadow in the y direction",
|
|
52
|
+
defeaultValue: 0,
|
|
53
|
+
}),
|
|
54
|
+
showShadowSideStart: createStaticBoolProp({
|
|
55
|
+
label: "Show Shadow Start",
|
|
56
|
+
description: "Whether to show shadow on the start side or not",
|
|
57
|
+
defaultValue: true,
|
|
58
|
+
}),
|
|
59
|
+
showShadowSideEnd: createStaticBoolProp({
|
|
60
|
+
label: "Show Shadow End",
|
|
61
|
+
description: "Whether to show shadow on the end side or not",
|
|
62
|
+
defaultValue: true,
|
|
63
|
+
}),
|
|
64
|
+
showShadowSideTop: createStaticBoolProp({
|
|
65
|
+
label: "Show Shadow Top",
|
|
66
|
+
description: "Whether to show shadow on the top side or not",
|
|
67
|
+
defaultValue: true,
|
|
68
|
+
}),
|
|
69
|
+
showShadowSideBottom: createStaticBoolProp({
|
|
70
|
+
label: "Show Shadow Bottom",
|
|
71
|
+
description: "Whether to show shadow on the bottom side or not",
|
|
72
|
+
defaultValue: true,
|
|
73
|
+
}),
|
|
74
|
+
showShadowCornerTopStart: createStaticBoolProp({
|
|
75
|
+
label: "Show Shadow Top Start Corner",
|
|
76
|
+
description: "Whether to show shadow on the top start corner or not",
|
|
77
|
+
defaultValue: true,
|
|
78
|
+
}),
|
|
79
|
+
showShadowCornerTopEnd: createStaticBoolProp({
|
|
80
|
+
label: "Show Shadow Top End Corner",
|
|
81
|
+
description: "Whether to show shadow on the top end corner or not",
|
|
82
|
+
defaultValue: true,
|
|
83
|
+
}),
|
|
84
|
+
showShadowCornerBottomStart: createStaticBoolProp({
|
|
85
|
+
label: "Show Shadow Bottom Start Corner",
|
|
86
|
+
description: "Whether to show shadow on the bottom start corner or not",
|
|
87
|
+
defaultValue: true,
|
|
88
|
+
}),
|
|
89
|
+
showShadowCornerBottomEnd: createStaticBoolProp({
|
|
90
|
+
label: "Show Shadow Bottom End Corner",
|
|
91
|
+
description: "Whether to show shadow on the bottom end corner or not",
|
|
92
|
+
defaultValue: true,
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNativeTabView = require("react-native-tab-view");
|
|
9
|
-
var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
|
|
10
|
-
var _theming = require("../../theming");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
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); }
|
|
15
|
-
const TabViewComponent = _ref => {
|
|
16
|
-
let {
|
|
17
|
-
Icon,
|
|
18
|
-
onIndexChanged,
|
|
19
|
-
onEndReached,
|
|
20
|
-
tabBarPosition,
|
|
21
|
-
keyboardDismissMode,
|
|
22
|
-
swipeEnabled,
|
|
23
|
-
scrollEnabled,
|
|
24
|
-
activeColor,
|
|
25
|
-
inactiveColor,
|
|
26
|
-
pressColor,
|
|
27
|
-
indicatorColor,
|
|
28
|
-
tabsBackgroundColor,
|
|
29
|
-
style,
|
|
30
|
-
theme,
|
|
31
|
-
children
|
|
32
|
-
} = _ref;
|
|
33
|
-
const [index, setIndex] = React.useState(0);
|
|
34
|
-
const [routes, setRoutes] = React.useState([]);
|
|
35
|
-
const [tabScenes, setTabScenes] = React.useState({});
|
|
36
|
-
|
|
37
|
-
//Populate routes and scenes based on children
|
|
38
|
-
React.useEffect(() => {
|
|
39
|
-
const newRoutes = [];
|
|
40
|
-
const scenes = {};
|
|
41
|
-
React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child) && child.type === _TabViewItem.default).forEach((item, idx) => {
|
|
42
|
-
const child = item;
|
|
43
|
-
newRoutes.push({
|
|
44
|
-
key: idx.toString(),
|
|
45
|
-
title: child.props.title,
|
|
46
|
-
icon: child.props.icon,
|
|
47
|
-
accessibilityLabel: child.props.accessibilityLabel
|
|
48
|
-
});
|
|
49
|
-
scenes[idx] = () => child;
|
|
50
|
-
});
|
|
51
|
-
setRoutes(newRoutes);
|
|
52
|
-
setTabScenes(scenes);
|
|
53
|
-
}, [children]);
|
|
54
|
-
const indexChangeHandler = i => {
|
|
55
|
-
setIndex(i);
|
|
56
|
-
onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
|
|
57
|
-
if (i === routes.length) {
|
|
58
|
-
onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const renderTabBar = props => {
|
|
62
|
-
return /*#__PURE__*/React.createElement(_reactNativeTabView.TabBar, _extends({}, props, {
|
|
63
|
-
activeColor: activeColor || theme.colors.primary,
|
|
64
|
-
inactiveColor: inactiveColor || theme.colors.divider,
|
|
65
|
-
pressColor: pressColor || theme.colors.primary,
|
|
66
|
-
scrollEnabled: scrollEnabled,
|
|
67
|
-
indicatorStyle: {
|
|
68
|
-
backgroundColor: indicatorColor || theme.colors.primary
|
|
69
|
-
},
|
|
70
|
-
renderIcon: _ref2 => {
|
|
71
|
-
let {
|
|
72
|
-
route,
|
|
73
|
-
color
|
|
74
|
-
} = _ref2;
|
|
75
|
-
return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
76
|
-
name: route.icon,
|
|
77
|
-
color: color,
|
|
78
|
-
size: 36
|
|
79
|
-
}) : null;
|
|
80
|
-
},
|
|
81
|
-
style: [{
|
|
82
|
-
backgroundColor: tabsBackgroundColor || theme.colors.background
|
|
83
|
-
}, style]
|
|
84
|
-
}));
|
|
85
|
-
};
|
|
86
|
-
return /*#__PURE__*/React.createElement(_reactNativeTabView.TabView, {
|
|
87
|
-
navigationState: {
|
|
88
|
-
index,
|
|
89
|
-
routes
|
|
90
|
-
},
|
|
91
|
-
renderScene: (0, _reactNativeTabView.SceneMap)(tabScenes),
|
|
92
|
-
renderTabBar: renderTabBar,
|
|
93
|
-
onIndexChange: indexChangeHandler,
|
|
94
|
-
tabBarPosition: tabBarPosition,
|
|
95
|
-
keyboardDismissMode: keyboardDismissMode,
|
|
96
|
-
swipeEnabled: swipeEnabled
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
var _default = (0, _theming.withTheme)(TabViewComponent);
|
|
100
|
-
exports.default = _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const TabViewItem = _ref => {
|
|
11
|
-
let {
|
|
12
|
-
style,
|
|
13
|
-
children
|
|
14
|
-
} = _ref;
|
|
15
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
16
|
-
style: [styles.parentContainer, style]
|
|
17
|
-
}, children);
|
|
18
|
-
};
|
|
19
|
-
const styles = _reactNative.StyleSheet.create({
|
|
20
|
-
parentContainer: {
|
|
21
|
-
flex: 1
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _default = TabViewItem;
|
|
25
|
-
exports.default = _default;
|
|
@@ -1,20 +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
|
-
var _TabView = _interopRequireDefault(require("./TabView"));
|
|
19
|
-
var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
var _types = require("@draftbit/types");
|
|
8
|
-
const SEED_DATA = {
|
|
9
|
-
name: "Tab View",
|
|
10
|
-
tag: "TabView",
|
|
11
|
-
description: "Tab view container",
|
|
12
|
-
category: _types.COMPONENT_TYPES.swiper,
|
|
13
|
-
stylesPanelSections: [..._types.BLOCK_STYLES_SECTIONS, _types.StylesPanelSections.Background],
|
|
14
|
-
triggers: [_types.Triggers.OnIndexChanged, _types.Triggers.OnEndReached],
|
|
15
|
-
props: {
|
|
16
|
-
onIndexChanged: (0, _types.createActionProp)({
|
|
17
|
-
label: "On index changed",
|
|
18
|
-
description: "Action to execute when swipe to new index"
|
|
19
|
-
}),
|
|
20
|
-
onEndReached: (0, _types.createActionProp)({
|
|
21
|
-
label: "On end reached",
|
|
22
|
-
description: "Action to execute when end of swiping reached"
|
|
23
|
-
}),
|
|
24
|
-
tabBarPosition: (0, _types.createTextEnumProp)({
|
|
25
|
-
label: "Tab Bar Position",
|
|
26
|
-
description: "Position of tab bar",
|
|
27
|
-
options: ["top", "bottom"],
|
|
28
|
-
defaultValue: "top"
|
|
29
|
-
}),
|
|
30
|
-
keyboardDismissMode: (0, _types.createTextEnumProp)({
|
|
31
|
-
label: "Keyboard Dismiss Mode",
|
|
32
|
-
description: "Keyboard Dismiss Mode",
|
|
33
|
-
options: ["auto", "on-drag", "none"],
|
|
34
|
-
defaultValue: "auto"
|
|
35
|
-
}),
|
|
36
|
-
swipeEnabled: (0, _types.createStaticBoolProp)({
|
|
37
|
-
label: "Swipe Enabled",
|
|
38
|
-
description: "Whether swiping is enabled or not",
|
|
39
|
-
defaultValue: true
|
|
40
|
-
}),
|
|
41
|
-
scrollEnabled: (0, _types.createStaticBoolProp)({
|
|
42
|
-
label: "Scroll Enabled",
|
|
43
|
-
description: "Whether scrolling of tabs is enabled or not",
|
|
44
|
-
defaultValue: true
|
|
45
|
-
}),
|
|
46
|
-
activeColor: (0, _types.createColorProp)({
|
|
47
|
-
label: "Active Color",
|
|
48
|
-
description: "Color of icon and text of active tab",
|
|
49
|
-
defaultValue: "primary"
|
|
50
|
-
}),
|
|
51
|
-
inactiveColor: (0, _types.createColorProp)({
|
|
52
|
-
label: "Inactive Color",
|
|
53
|
-
description: "Color of icon and text of inactive tab(s)",
|
|
54
|
-
defaultValue: null
|
|
55
|
-
}),
|
|
56
|
-
pressColor: (0, _types.createColorProp)({
|
|
57
|
-
label: "Press Color",
|
|
58
|
-
description: "Color of ripple when pressed (android only)",
|
|
59
|
-
defaultValue: "primary"
|
|
60
|
-
}),
|
|
61
|
-
indicatorColor: (0, _types.createColorProp)({
|
|
62
|
-
label: "Indicator Color",
|
|
63
|
-
description: "Color of indicator",
|
|
64
|
-
defaultValue: "primary"
|
|
65
|
-
}),
|
|
66
|
-
tabsBackgroundColor: (0, _types.createColorProp)({
|
|
67
|
-
label: "Tabs Background Color",
|
|
68
|
-
description: "Background color of tabs container",
|
|
69
|
-
defaultValue: "background"
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
var _types = require("@draftbit/types");
|
|
8
|
-
const SEED_DATA = {
|
|
9
|
-
name: "Tab View Item",
|
|
10
|
-
tag: "TabViewItem",
|
|
11
|
-
description: "Single Tab View item to be used in TabView. Each item represents a single tab and its content",
|
|
12
|
-
category: _types.COMPONENT_TYPES.swiper,
|
|
13
|
-
stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
14
|
-
layout: {
|
|
15
|
-
flex: 1
|
|
16
|
-
},
|
|
17
|
-
props: {
|
|
18
|
-
title: (0, _types.createTextProp)({
|
|
19
|
-
label: "Title",
|
|
20
|
-
description: "Title of tab item",
|
|
21
|
-
defaultValue: null,
|
|
22
|
-
required: true
|
|
23
|
-
}),
|
|
24
|
-
icon: (0, _types.createIconProp)({
|
|
25
|
-
defaultValue: null,
|
|
26
|
-
required: false
|
|
27
|
-
}),
|
|
28
|
-
accessibilityLabel: (0, _types.createTextProp)({
|
|
29
|
-
label: "Accessibility Label",
|
|
30
|
-
description: "Accessibility Label",
|
|
31
|
-
defaultValue: null
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,90 +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
|
-
import * as React from "react";
|
|
3
|
-
import { TabView, TabBar, SceneMap } from "react-native-tab-view";
|
|
4
|
-
import TabViewItem from "./TabViewItem";
|
|
5
|
-
import { withTheme } from "../../theming";
|
|
6
|
-
const TabViewComponent = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
Icon,
|
|
9
|
-
onIndexChanged,
|
|
10
|
-
onEndReached,
|
|
11
|
-
tabBarPosition,
|
|
12
|
-
keyboardDismissMode,
|
|
13
|
-
swipeEnabled,
|
|
14
|
-
scrollEnabled,
|
|
15
|
-
activeColor,
|
|
16
|
-
inactiveColor,
|
|
17
|
-
pressColor,
|
|
18
|
-
indicatorColor,
|
|
19
|
-
tabsBackgroundColor,
|
|
20
|
-
style,
|
|
21
|
-
theme,
|
|
22
|
-
children
|
|
23
|
-
} = _ref;
|
|
24
|
-
const [index, setIndex] = React.useState(0);
|
|
25
|
-
const [routes, setRoutes] = React.useState([]);
|
|
26
|
-
const [tabScenes, setTabScenes] = React.useState({});
|
|
27
|
-
|
|
28
|
-
//Populate routes and scenes based on children
|
|
29
|
-
React.useEffect(() => {
|
|
30
|
-
const newRoutes = [];
|
|
31
|
-
const scenes = {};
|
|
32
|
-
React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child) && child.type === TabViewItem).forEach((item, idx) => {
|
|
33
|
-
const child = item;
|
|
34
|
-
newRoutes.push({
|
|
35
|
-
key: idx.toString(),
|
|
36
|
-
title: child.props.title,
|
|
37
|
-
icon: child.props.icon,
|
|
38
|
-
accessibilityLabel: child.props.accessibilityLabel
|
|
39
|
-
});
|
|
40
|
-
scenes[idx] = () => child;
|
|
41
|
-
});
|
|
42
|
-
setRoutes(newRoutes);
|
|
43
|
-
setTabScenes(scenes);
|
|
44
|
-
}, [children]);
|
|
45
|
-
const indexChangeHandler = i => {
|
|
46
|
-
setIndex(i);
|
|
47
|
-
onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
|
|
48
|
-
if (i === routes.length) {
|
|
49
|
-
onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const renderTabBar = props => {
|
|
53
|
-
return /*#__PURE__*/React.createElement(TabBar, _extends({}, props, {
|
|
54
|
-
activeColor: activeColor || theme.colors.primary,
|
|
55
|
-
inactiveColor: inactiveColor || theme.colors.divider,
|
|
56
|
-
pressColor: pressColor || theme.colors.primary,
|
|
57
|
-
scrollEnabled: scrollEnabled,
|
|
58
|
-
indicatorStyle: {
|
|
59
|
-
backgroundColor: indicatorColor || theme.colors.primary
|
|
60
|
-
},
|
|
61
|
-
renderIcon: _ref2 => {
|
|
62
|
-
let {
|
|
63
|
-
route,
|
|
64
|
-
color
|
|
65
|
-
} = _ref2;
|
|
66
|
-
return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
67
|
-
name: route.icon,
|
|
68
|
-
color: color,
|
|
69
|
-
size: 36
|
|
70
|
-
}) : null;
|
|
71
|
-
},
|
|
72
|
-
style: [{
|
|
73
|
-
backgroundColor: tabsBackgroundColor || theme.colors.background
|
|
74
|
-
}, style]
|
|
75
|
-
}));
|
|
76
|
-
};
|
|
77
|
-
return /*#__PURE__*/React.createElement(TabView, {
|
|
78
|
-
navigationState: {
|
|
79
|
-
index,
|
|
80
|
-
routes
|
|
81
|
-
},
|
|
82
|
-
renderScene: SceneMap(tabScenes),
|
|
83
|
-
renderTabBar: renderTabBar,
|
|
84
|
-
onIndexChange: indexChangeHandler,
|
|
85
|
-
tabBarPosition: tabBarPosition,
|
|
86
|
-
keyboardDismissMode: keyboardDismissMode,
|
|
87
|
-
swipeEnabled: swipeEnabled
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
export default withTheme(TabViewComponent);
|