@draftbit/core 46.8.2-fee87c.2 → 46.9.1-0f1b60.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Container.js +15 -4
- package/lib/commonjs/components/Markdown.js +30 -0
- package/lib/commonjs/components/Shadow.js +46 -0
- package/lib/commonjs/components/TabView/TabView.js +22 -6
- package/lib/commonjs/hooks.js +1 -2
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/mappings/FlashList.js +2 -8
- package/lib/commonjs/mappings/HtmlElements.js +160 -0
- package/lib/commonjs/mappings/Markdown.js +27 -0
- package/lib/commonjs/mappings/Shadow.js +102 -0
- package/lib/commonjs/mappings/TabView.js +6 -5
- package/lib/commonjs/mappings/TabViewItem.js +5 -3
- package/lib/module/components/Markdown.js +20 -0
- package/lib/module/components/Shadow.js +38 -0
- package/lib/module/components/TabView/TabView.js +22 -5
- package/lib/module/index.js +2 -0
- package/lib/module/mappings/FlashList.js +3 -9
- package/lib/module/mappings/HtmlElements.js +153 -0
- package/lib/module/mappings/Markdown.js +20 -0
- package/lib/module/mappings/Shadow.js +95 -0
- package/lib/module/mappings/TabView.js +7 -6
- package/lib/module/mappings/TabViewItem.js +6 -4
- package/lib/typescript/src/components/Markdown.d.ts +8 -0
- package/lib/typescript/src/components/Markdown.d.ts.map +1 -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/components/TabView/TabView.d.ts.map +1 -1
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +1 -1
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/FlashList.d.ts +0 -6
- package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/HtmlElements.d.ts +109 -0
- package/lib/typescript/src/mappings/HtmlElements.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Markdown.d.ts +20 -0
- package/lib/typescript/src/mappings/Markdown.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Shadow.d.ts +173 -0
- package/lib/typescript/src/mappings/Shadow.d.ts.map +1 -0
- package/lib/typescript/src/mappings/TabView.d.ts.map +1 -1
- package/lib/typescript/src/mappings/TabViewItem.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/components/Markdown.js +10 -0
- package/src/components/Markdown.tsx +22 -0
- package/src/components/Shadow.js +16 -0
- package/src/components/Shadow.tsx +62 -0
- package/src/components/TabView/TabView.js +16 -7
- package/src/components/TabView/TabView.tsx +25 -7
- package/src/components/TabView/TabViewItem.tsx +1 -1
- package/src/index.js +2 -0
- package/src/index.tsx +3 -0
- package/src/mappings/FlashList.js +9 -9
- package/src/mappings/FlashList.ts +9 -9
- package/src/mappings/HtmlElements.js +180 -0
- package/src/mappings/HtmlElements.ts +194 -0
- package/src/mappings/Markdown.js +25 -0
- package/src/mappings/Markdown.ts +32 -0
- package/src/mappings/Shadow.js +95 -0
- package/src/mappings/Shadow.ts +104 -0
- package/src/mappings/TabView.js +11 -5
- package/src/mappings/TabView.ts +11 -5
- package/src/mappings/TabViewItem.js +4 -2
- package/src/mappings/TabViewItem.ts +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlElements.d.ts","sourceRoot":"","sources":["../../../../src/mappings/HtmlElements.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6HrB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
props: {
|
|
8
|
+
children: {
|
|
9
|
+
group: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
editable: boolean;
|
|
13
|
+
required: boolean;
|
|
14
|
+
formType: string;
|
|
15
|
+
propType: string;
|
|
16
|
+
defaultValue: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Markdown.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAuBrB,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
props: {
|
|
8
|
+
disabled: {
|
|
9
|
+
label: string;
|
|
10
|
+
description: string;
|
|
11
|
+
group: string;
|
|
12
|
+
editable: boolean;
|
|
13
|
+
required: boolean;
|
|
14
|
+
formType: string;
|
|
15
|
+
propType: string;
|
|
16
|
+
defaultValue: null;
|
|
17
|
+
};
|
|
18
|
+
startColor: {
|
|
19
|
+
group: string;
|
|
20
|
+
label: string;
|
|
21
|
+
description: string;
|
|
22
|
+
editable: boolean;
|
|
23
|
+
required: boolean;
|
|
24
|
+
defaultValue: null;
|
|
25
|
+
formType: string;
|
|
26
|
+
propType: string;
|
|
27
|
+
};
|
|
28
|
+
endColor: {
|
|
29
|
+
group: string;
|
|
30
|
+
label: string;
|
|
31
|
+
description: string;
|
|
32
|
+
editable: boolean;
|
|
33
|
+
required: boolean;
|
|
34
|
+
defaultValue: null;
|
|
35
|
+
formType: string;
|
|
36
|
+
propType: string;
|
|
37
|
+
};
|
|
38
|
+
distance: {
|
|
39
|
+
label: string;
|
|
40
|
+
description: string;
|
|
41
|
+
formType: string;
|
|
42
|
+
propType: string;
|
|
43
|
+
group: string;
|
|
44
|
+
defaultValue: null;
|
|
45
|
+
editable: boolean;
|
|
46
|
+
required: boolean;
|
|
47
|
+
step: number;
|
|
48
|
+
};
|
|
49
|
+
paintInside: {
|
|
50
|
+
label: string;
|
|
51
|
+
description: string;
|
|
52
|
+
formType: string;
|
|
53
|
+
propType: string;
|
|
54
|
+
defaultValue: boolean;
|
|
55
|
+
editable: boolean;
|
|
56
|
+
required: boolean;
|
|
57
|
+
group: string;
|
|
58
|
+
};
|
|
59
|
+
stretch: {
|
|
60
|
+
label: string;
|
|
61
|
+
description: string;
|
|
62
|
+
formType: string;
|
|
63
|
+
propType: string;
|
|
64
|
+
defaultValue: boolean;
|
|
65
|
+
editable: boolean;
|
|
66
|
+
required: boolean;
|
|
67
|
+
group: string;
|
|
68
|
+
};
|
|
69
|
+
offsetX: {
|
|
70
|
+
label: string;
|
|
71
|
+
description: string;
|
|
72
|
+
formType: string;
|
|
73
|
+
propType: string;
|
|
74
|
+
group: string;
|
|
75
|
+
defaultValue: null;
|
|
76
|
+
editable: boolean;
|
|
77
|
+
required: boolean;
|
|
78
|
+
step: number;
|
|
79
|
+
};
|
|
80
|
+
offsetY: {
|
|
81
|
+
label: string;
|
|
82
|
+
description: string;
|
|
83
|
+
formType: string;
|
|
84
|
+
propType: string;
|
|
85
|
+
group: string;
|
|
86
|
+
defaultValue: null;
|
|
87
|
+
editable: boolean;
|
|
88
|
+
required: boolean;
|
|
89
|
+
step: number;
|
|
90
|
+
};
|
|
91
|
+
showShadowSideStart: {
|
|
92
|
+
label: string;
|
|
93
|
+
description: string;
|
|
94
|
+
formType: string;
|
|
95
|
+
propType: string;
|
|
96
|
+
defaultValue: boolean;
|
|
97
|
+
editable: boolean;
|
|
98
|
+
required: boolean;
|
|
99
|
+
group: string;
|
|
100
|
+
};
|
|
101
|
+
showShadowSideEnd: {
|
|
102
|
+
label: string;
|
|
103
|
+
description: string;
|
|
104
|
+
formType: string;
|
|
105
|
+
propType: string;
|
|
106
|
+
defaultValue: boolean;
|
|
107
|
+
editable: boolean;
|
|
108
|
+
required: boolean;
|
|
109
|
+
group: string;
|
|
110
|
+
};
|
|
111
|
+
showShadowSideTop: {
|
|
112
|
+
label: string;
|
|
113
|
+
description: string;
|
|
114
|
+
formType: string;
|
|
115
|
+
propType: string;
|
|
116
|
+
defaultValue: boolean;
|
|
117
|
+
editable: boolean;
|
|
118
|
+
required: boolean;
|
|
119
|
+
group: string;
|
|
120
|
+
};
|
|
121
|
+
showShadowSideBottom: {
|
|
122
|
+
label: string;
|
|
123
|
+
description: string;
|
|
124
|
+
formType: string;
|
|
125
|
+
propType: string;
|
|
126
|
+
defaultValue: boolean;
|
|
127
|
+
editable: boolean;
|
|
128
|
+
required: boolean;
|
|
129
|
+
group: string;
|
|
130
|
+
};
|
|
131
|
+
showShadowCornerTopStart: {
|
|
132
|
+
label: string;
|
|
133
|
+
description: string;
|
|
134
|
+
formType: string;
|
|
135
|
+
propType: string;
|
|
136
|
+
defaultValue: boolean;
|
|
137
|
+
editable: boolean;
|
|
138
|
+
required: boolean;
|
|
139
|
+
group: string;
|
|
140
|
+
};
|
|
141
|
+
showShadowCornerTopEnd: {
|
|
142
|
+
label: string;
|
|
143
|
+
description: string;
|
|
144
|
+
formType: string;
|
|
145
|
+
propType: string;
|
|
146
|
+
defaultValue: boolean;
|
|
147
|
+
editable: boolean;
|
|
148
|
+
required: boolean;
|
|
149
|
+
group: string;
|
|
150
|
+
};
|
|
151
|
+
showShadowCornerBottomStart: {
|
|
152
|
+
label: string;
|
|
153
|
+
description: string;
|
|
154
|
+
formType: string;
|
|
155
|
+
propType: string;
|
|
156
|
+
defaultValue: boolean;
|
|
157
|
+
editable: boolean;
|
|
158
|
+
required: boolean;
|
|
159
|
+
group: string;
|
|
160
|
+
};
|
|
161
|
+
showShadowCornerBottomEnd: {
|
|
162
|
+
label: string;
|
|
163
|
+
description: string;
|
|
164
|
+
formType: string;
|
|
165
|
+
propType: string;
|
|
166
|
+
defaultValue: boolean;
|
|
167
|
+
editable: boolean;
|
|
168
|
+
required: boolean;
|
|
169
|
+
group: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=Shadow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shadow.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Shadow.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6FrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabView.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabView.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyErB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabViewItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabViewItem.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;CA6BrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.9.1-0f1b60.2+0f1b60e",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,8 @@
|
|
|
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.
|
|
44
|
+
"@draftbit/types": "^46.9.1-0f1b60.2+0f1b60e",
|
|
45
|
+
"@expo/html-elements": "^0.3.1",
|
|
45
46
|
"@material-ui/core": "^4.11.0",
|
|
46
47
|
"@material-ui/pickers": "^3.2.10",
|
|
47
48
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -54,8 +55,10 @@
|
|
|
54
55
|
"lodash.omit": "^4.5.0",
|
|
55
56
|
"lodash.tonumber": "^4.0.3",
|
|
56
57
|
"react-native-deck-swiper": "^2.0.12",
|
|
58
|
+
"react-native-markdown-display": "^7.0.0-alpha.2",
|
|
57
59
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
58
60
|
"react-native-pager-view": "5.4.24",
|
|
61
|
+
"react-native-shadow-2": "^7.0.6",
|
|
59
62
|
"react-native-svg": "12.3.0",
|
|
60
63
|
"react-native-tab-view": "^3.4.0",
|
|
61
64
|
"react-native-typography": "^1.4.1",
|
|
@@ -94,5 +97,5 @@
|
|
|
94
97
|
]
|
|
95
98
|
]
|
|
96
99
|
},
|
|
97
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "0f1b60e3f3f189d26b22e31ee78c8c8bd840113e"
|
|
98
101
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import MarkdownComponent from "react-native-markdown-display";
|
|
4
|
+
const Markdown = ({ children, style, }) => {
|
|
5
|
+
return (
|
|
6
|
+
//'body' style applies to all markdown components
|
|
7
|
+
//@ts-ignore TS does not like the type of this named style for some reason
|
|
8
|
+
React.createElement(MarkdownComponent, { style: { body: StyleSheet.flatten(style) } }, children));
|
|
9
|
+
};
|
|
10
|
+
export default Markdown;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import MarkdownComponent from "react-native-markdown-display";
|
|
4
|
+
|
|
5
|
+
type MarkdownProps = {
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>> = ({
|
|
10
|
+
children,
|
|
11
|
+
style,
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
//'body' style applies to all markdown components
|
|
15
|
+
//@ts-ignore TS does not like the type of this named style for some reason
|
|
16
|
+
<MarkdownComponent style={{ body: StyleSheet.flatten(style) }}>
|
|
17
|
+
{children}
|
|
18
|
+
</MarkdownComponent>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Markdown;
|
|
@@ -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, paintInside = false, 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, paintInside: paintInside, ...rest }));
|
|
15
|
+
};
|
|
16
|
+
export default Shadow;
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
paintInside = false,
|
|
37
|
+
style,
|
|
38
|
+
...rest
|
|
39
|
+
}) => {
|
|
40
|
+
return (
|
|
41
|
+
<ShadowComponent
|
|
42
|
+
offset={[offsetX, offsetY]}
|
|
43
|
+
sides={{
|
|
44
|
+
start: showShadowSideStart,
|
|
45
|
+
end: showShadowSideEnd,
|
|
46
|
+
top: showShadowSideTop,
|
|
47
|
+
bottom: showShadowSideBottom,
|
|
48
|
+
}}
|
|
49
|
+
corners={{
|
|
50
|
+
topStart: showShadowCornerTopStart,
|
|
51
|
+
topEnd: showShadowCornerTopEnd,
|
|
52
|
+
bottomStart: showShadowCornerBottomStart,
|
|
53
|
+
bottomEnd: showShadowCornerBottomEnd,
|
|
54
|
+
}}
|
|
55
|
+
containerStyle={style}
|
|
56
|
+
paintInside={paintInside}
|
|
57
|
+
{...rest}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default Shadow;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
|
|
3
|
-
import TabViewItem from "./TabViewItem";
|
|
4
3
|
import { withTheme } from "../../theming";
|
|
4
|
+
import { extractStyles } from "../../utilities";
|
|
5
5
|
const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, tabsBackgroundColor, style, theme, children, }) => {
|
|
6
6
|
const [index, setIndex] = React.useState(0);
|
|
7
7
|
const [routes, setRoutes] = React.useState([]);
|
|
8
8
|
const [tabScenes, setTabScenes] = React.useState({});
|
|
9
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
10
|
+
//Check type of child using props
|
|
11
|
+
//Regular '.type' cannot work because Draftbit strips the type in Draft view
|
|
12
|
+
const instanceOfTabViewItemProps = (object) => {
|
|
13
|
+
return "title" in object;
|
|
14
|
+
};
|
|
9
15
|
//Populate routes and scenes based on children
|
|
10
16
|
React.useEffect(() => {
|
|
11
17
|
const newRoutes = [];
|
|
12
18
|
const scenes = {};
|
|
13
19
|
React.Children.toArray(children)
|
|
14
|
-
.filter((child) => React.isValidElement(child) && child.
|
|
20
|
+
.filter((child) => React.isValidElement(child) && instanceOfTabViewItemProps(child.props))
|
|
15
21
|
.forEach((item, idx) => {
|
|
16
22
|
const child = item;
|
|
17
23
|
newRoutes.push({
|
|
@@ -35,11 +41,14 @@ const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition,
|
|
|
35
41
|
const renderTabBar = (props) => {
|
|
36
42
|
return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
|
|
37
43
|
backgroundColor: indicatorColor || theme.colors.primary,
|
|
38
|
-
}, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
] }));
|
|
44
|
+
}, labelStyle: textStyles, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 16 })) : null, style: {
|
|
45
|
+
backgroundColor: tabsBackgroundColor || theme.colors.background,
|
|
46
|
+
} }));
|
|
42
47
|
};
|
|
43
|
-
|
|
48
|
+
//Cannot render TabView without at least one tab
|
|
49
|
+
if (!routes.length) {
|
|
50
|
+
return React.createElement(React.Fragment, null);
|
|
51
|
+
}
|
|
52
|
+
return (React.createElement(TabView, { style: [viewStyles], navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
|
|
44
53
|
};
|
|
45
54
|
export default withTheme(TabViewComponent);
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
Route,
|
|
10
10
|
} from "react-native-tab-view";
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import { TabViewItemProps } from "./TabViewItem";
|
|
13
13
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
14
14
|
import { withTheme } from "../../theming";
|
|
15
15
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
16
|
+
import { extractStyles } from "../../utilities";
|
|
16
17
|
|
|
17
18
|
type TabBarProps = SceneRendererProps & {
|
|
18
19
|
navigationState: NavigationState<any>;
|
|
@@ -57,6 +58,16 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
|
57
58
|
const [routes, setRoutes] = React.useState<Route[]>([]);
|
|
58
59
|
const [tabScenes, setTabScenes] = React.useState({});
|
|
59
60
|
|
|
61
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
62
|
+
|
|
63
|
+
//Check type of child using props
|
|
64
|
+
//Regular '.type' cannot work because Draftbit strips the type in Draft view
|
|
65
|
+
const instanceOfTabViewItemProps = (
|
|
66
|
+
object: any
|
|
67
|
+
): object is TabViewItemProps => {
|
|
68
|
+
return "title" in object;
|
|
69
|
+
};
|
|
70
|
+
|
|
60
71
|
//Populate routes and scenes based on children
|
|
61
72
|
React.useEffect(() => {
|
|
62
73
|
const newRoutes: Route[] = [];
|
|
@@ -64,7 +75,8 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
|
64
75
|
|
|
65
76
|
React.Children.toArray(children)
|
|
66
77
|
.filter(
|
|
67
|
-
(child) =>
|
|
78
|
+
(child) =>
|
|
79
|
+
React.isValidElement(child) && instanceOfTabViewItemProps(child.props)
|
|
68
80
|
)
|
|
69
81
|
.forEach((item: any, idx) => {
|
|
70
82
|
const child = item as React.ReactElement;
|
|
@@ -100,21 +112,27 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
|
100
112
|
indicatorStyle={{
|
|
101
113
|
backgroundColor: indicatorColor || theme.colors.primary,
|
|
102
114
|
}}
|
|
115
|
+
labelStyle={textStyles}
|
|
103
116
|
renderIcon={({ route, color }) =>
|
|
104
117
|
route?.icon ? (
|
|
105
|
-
<Icon name={route.icon} color={color} size={
|
|
118
|
+
<Icon name={route.icon} color={color} size={16} />
|
|
106
119
|
) : null
|
|
107
120
|
}
|
|
108
|
-
style={
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
]}
|
|
121
|
+
style={{
|
|
122
|
+
backgroundColor: tabsBackgroundColor || theme.colors.background,
|
|
123
|
+
}}
|
|
112
124
|
/>
|
|
113
125
|
);
|
|
114
126
|
};
|
|
115
127
|
|
|
128
|
+
//Cannot render TabView without at least one tab
|
|
129
|
+
if (!routes.length) {
|
|
130
|
+
return <></>;
|
|
131
|
+
}
|
|
132
|
+
|
|
116
133
|
return (
|
|
117
134
|
<TabView
|
|
135
|
+
style={[viewStyles]}
|
|
118
136
|
navigationState={{ index, routes }}
|
|
119
137
|
renderScene={SceneMap(tabScenes)}
|
|
120
138
|
renderTabBar={renderTabBar}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
//Props used by parent (TabView) to create tabs
|
|
5
|
-
interface TabViewItemProps {
|
|
5
|
+
export interface TabViewItemProps {
|
|
6
6
|
title: string;
|
|
7
7
|
icon?: string;
|
|
8
8
|
accessibilityLabel?: string;
|
package/src/index.js
CHANGED
|
@@ -31,8 +31,10 @@ 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
36
|
export { TabView, TabViewItem } from "./components/TabView";
|
|
37
|
+
export { default as Markdown } from "./components/Markdown";
|
|
36
38
|
/* Deprecated: Fix or Delete! */
|
|
37
39
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
38
40
|
export { default as Picker } from "./components/Picker/Picker";
|
package/src/index.tsx
CHANGED
|
@@ -51,9 +51,12 @@ export {
|
|
|
51
51
|
RadioButtonFieldGroup,
|
|
52
52
|
} from "./components/RadioButton/index";
|
|
53
53
|
|
|
54
|
+
export { default as Shadow } from "./components/Shadow";
|
|
55
|
+
|
|
54
56
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
55
57
|
|
|
56
58
|
export { TabView, TabViewItem } from "./components/TabView";
|
|
59
|
+
export { default as Markdown } from "./components/Markdown";
|
|
57
60
|
|
|
58
61
|
/* Deprecated: Fix or Delete! */
|
|
59
62
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp,
|
|
1
|
+
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, GROUPS, Triggers, createActionProp, createStaticNumberProp, createColorProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = [
|
|
3
3
|
{
|
|
4
4
|
name: "Masonry List",
|
|
@@ -6,10 +6,10 @@ export const SEED_DATA = [
|
|
|
6
6
|
description: "Masonry Flashlist by Shopify",
|
|
7
7
|
packageName: "@shopify/flash-list",
|
|
8
8
|
category: COMPONENT_TYPES.data,
|
|
9
|
-
stylesPanelSections:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
stylesPanelSections: [
|
|
10
|
+
StylesPanelSections.Background,
|
|
11
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
12
|
+
],
|
|
13
13
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
14
14
|
props: {
|
|
15
15
|
onRefresh: createActionProp(),
|
|
@@ -57,10 +57,10 @@ export const SEED_DATA = [
|
|
|
57
57
|
description: "Flashlist by Shopify",
|
|
58
58
|
packageName: "@shopify/flash-list",
|
|
59
59
|
category: COMPONENT_TYPES.data,
|
|
60
|
-
stylesPanelSections:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
stylesPanelSections: [
|
|
61
|
+
StylesPanelSections.Background,
|
|
62
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
63
|
+
],
|
|
64
64
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
65
65
|
props: {
|
|
66
66
|
onRefresh: createActionProp(),
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
createNumColumnsType,
|
|
4
4
|
createStaticBoolProp,
|
|
5
5
|
createNumberProp,
|
|
6
|
-
CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
7
6
|
GROUPS,
|
|
8
7
|
Triggers,
|
|
9
8
|
createActionProp,
|
|
10
9
|
createStaticNumberProp,
|
|
11
10
|
createColorProp,
|
|
11
|
+
StylesPanelSections,
|
|
12
12
|
} from "@draftbit/types";
|
|
13
13
|
|
|
14
14
|
export const SEED_DATA = [
|
|
@@ -18,10 +18,10 @@ export const SEED_DATA = [
|
|
|
18
18
|
description: "Masonry Flashlist by Shopify",
|
|
19
19
|
packageName: "@shopify/flash-list",
|
|
20
20
|
category: COMPONENT_TYPES.data,
|
|
21
|
-
stylesPanelSections:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
stylesPanelSections: [
|
|
22
|
+
StylesPanelSections.Background,
|
|
23
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
24
|
+
],
|
|
25
25
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
26
26
|
props: {
|
|
27
27
|
onRefresh: createActionProp(),
|
|
@@ -72,10 +72,10 @@ export const SEED_DATA = [
|
|
|
72
72
|
description: "Flashlist by Shopify",
|
|
73
73
|
packageName: "@shopify/flash-list",
|
|
74
74
|
category: COMPONENT_TYPES.data,
|
|
75
|
-
stylesPanelSections:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
stylesPanelSections: [
|
|
76
|
+
StylesPanelSections.Background,
|
|
77
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
78
|
+
],
|
|
79
79
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
80
80
|
props: {
|
|
81
81
|
onRefresh: createActionProp(),
|