@draftbit/core 46.8.2-799d91.2 → 46.8.2-877fc5.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/Image.js +2 -17
- package/lib/commonjs/components/Portal/PortalHost.js +15 -44
- package/lib/commonjs/components/ScreenContainer.js +6 -24
- package/lib/commonjs/components/Shadow.js +46 -0
- package/lib/commonjs/components/TabView/TabView.js +116 -0
- package/lib/commonjs/components/TabView/TabViewItem.js +25 -0
- package/lib/commonjs/components/TabView/index.js +20 -0
- package/lib/commonjs/index.js +20 -0
- package/lib/commonjs/mappings/FlashList.js +2 -8
- package/lib/commonjs/mappings/Markdown.js +2 -2
- package/lib/commonjs/mappings/Shadow.js +102 -0
- package/lib/commonjs/mappings/TabView.js +74 -0
- package/lib/commonjs/mappings/TabViewItem.js +37 -0
- package/lib/module/components/Shadow.js +38 -0
- package/lib/module/components/TabView/TabView.js +107 -0
- package/lib/module/components/TabView/TabViewItem.js +20 -0
- package/lib/module/components/TabView/index.js +2 -0
- package/lib/module/index.js +2 -0
- package/lib/module/mappings/FlashList.js +3 -9
- package/lib/module/mappings/Markdown.js +2 -2
- package/lib/module/mappings/Shadow.js +95 -0
- package/lib/module/mappings/TabView.js +67 -0
- package/lib/module/mappings/TabViewItem.js +30 -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 +26 -0
- package/lib/typescript/src/components/TabView/TabView.d.ts.map +1 -0
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +11 -0
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +1 -0
- package/lib/typescript/src/components/TabView/index.d.ts +3 -0
- package/lib/typescript/src/components/TabView/index.d.ts.map +1 -0
- 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/Shadow.d.ts +173 -0
- package/lib/typescript/src/mappings/Shadow.d.ts.map +1 -0
- package/lib/typescript/src/mappings/TabView.d.ts +123 -0
- package/lib/typescript/src/mappings/TabView.d.ts.map +1 -0
- package/lib/typescript/src/mappings/TabViewItem.d.ts +25 -0
- package/lib/typescript/src/mappings/TabViewItem.d.ts.map +1 -0
- package/package.json +6 -3
- package/src/components/Shadow.js +16 -0
- package/src/components/Shadow.tsx +62 -0
- package/src/components/TabView/TabView.js +54 -0
- package/src/components/TabView/TabView.tsx +147 -0
- package/src/components/TabView/TabViewItem.js +11 -0
- package/src/components/TabView/TabViewItem.tsx +25 -0
- package/src/components/TabView/index.js +2 -0
- package/src/components/TabView/index.tsx +2 -0
- 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/Markdown.js +2 -2
- package/src/mappings/Markdown.ts +2 -2
- package/src/mappings/Shadow.js +95 -0
- package/src/mappings/Shadow.ts +104 -0
- package/src/mappings/TabView.js +75 -0
- package/src/mappings/TabView.ts +85 -0
- package/src/mappings/TabViewItem.js +30 -0
- package/src/mappings/TabViewItem.ts +38 -0
|
@@ -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"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
triggers: string[];
|
|
8
|
+
props: {
|
|
9
|
+
onIndexChanged: {
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
editable: boolean;
|
|
13
|
+
required: boolean;
|
|
14
|
+
formType: string;
|
|
15
|
+
propType: string;
|
|
16
|
+
defaultValue: null;
|
|
17
|
+
group: string;
|
|
18
|
+
};
|
|
19
|
+
onEndReached: {
|
|
20
|
+
label: string;
|
|
21
|
+
description: string;
|
|
22
|
+
editable: boolean;
|
|
23
|
+
required: boolean;
|
|
24
|
+
formType: string;
|
|
25
|
+
propType: string;
|
|
26
|
+
defaultValue: null;
|
|
27
|
+
group: string;
|
|
28
|
+
};
|
|
29
|
+
tabBarPosition: {
|
|
30
|
+
group: string;
|
|
31
|
+
label: string;
|
|
32
|
+
description: string;
|
|
33
|
+
editable: boolean;
|
|
34
|
+
required: boolean;
|
|
35
|
+
formType: string;
|
|
36
|
+
propType: string;
|
|
37
|
+
defaultValue: null;
|
|
38
|
+
options: never[];
|
|
39
|
+
};
|
|
40
|
+
keyboardDismissMode: {
|
|
41
|
+
group: string;
|
|
42
|
+
label: string;
|
|
43
|
+
description: string;
|
|
44
|
+
editable: boolean;
|
|
45
|
+
required: boolean;
|
|
46
|
+
formType: string;
|
|
47
|
+
propType: string;
|
|
48
|
+
defaultValue: null;
|
|
49
|
+
options: never[];
|
|
50
|
+
};
|
|
51
|
+
swipeEnabled: {
|
|
52
|
+
label: string;
|
|
53
|
+
description: string;
|
|
54
|
+
formType: string;
|
|
55
|
+
propType: string;
|
|
56
|
+
defaultValue: boolean;
|
|
57
|
+
editable: boolean;
|
|
58
|
+
required: boolean;
|
|
59
|
+
group: string;
|
|
60
|
+
};
|
|
61
|
+
scrollEnabled: {
|
|
62
|
+
label: string;
|
|
63
|
+
description: string;
|
|
64
|
+
formType: string;
|
|
65
|
+
propType: string;
|
|
66
|
+
defaultValue: boolean;
|
|
67
|
+
editable: boolean;
|
|
68
|
+
required: boolean;
|
|
69
|
+
group: string;
|
|
70
|
+
};
|
|
71
|
+
activeColor: {
|
|
72
|
+
group: string;
|
|
73
|
+
label: string;
|
|
74
|
+
description: string;
|
|
75
|
+
editable: boolean;
|
|
76
|
+
required: boolean;
|
|
77
|
+
defaultValue: null;
|
|
78
|
+
formType: string;
|
|
79
|
+
propType: string;
|
|
80
|
+
};
|
|
81
|
+
inactiveColor: {
|
|
82
|
+
group: string;
|
|
83
|
+
label: string;
|
|
84
|
+
description: string;
|
|
85
|
+
editable: boolean;
|
|
86
|
+
required: boolean;
|
|
87
|
+
defaultValue: null;
|
|
88
|
+
formType: string;
|
|
89
|
+
propType: string;
|
|
90
|
+
};
|
|
91
|
+
pressColor: {
|
|
92
|
+
group: string;
|
|
93
|
+
label: string;
|
|
94
|
+
description: string;
|
|
95
|
+
editable: boolean;
|
|
96
|
+
required: boolean;
|
|
97
|
+
defaultValue: null;
|
|
98
|
+
formType: string;
|
|
99
|
+
propType: string;
|
|
100
|
+
};
|
|
101
|
+
indicatorColor: {
|
|
102
|
+
group: string;
|
|
103
|
+
label: string;
|
|
104
|
+
description: string;
|
|
105
|
+
editable: boolean;
|
|
106
|
+
required: boolean;
|
|
107
|
+
defaultValue: null;
|
|
108
|
+
formType: string;
|
|
109
|
+
propType: string;
|
|
110
|
+
};
|
|
111
|
+
tabsBackgroundColor: {
|
|
112
|
+
group: string;
|
|
113
|
+
label: string;
|
|
114
|
+
description: string;
|
|
115
|
+
editable: boolean;
|
|
116
|
+
required: boolean;
|
|
117
|
+
defaultValue: null;
|
|
118
|
+
formType: string;
|
|
119
|
+
propType: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=TabView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabView.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyErB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
layout: {
|
|
8
|
+
flex: number;
|
|
9
|
+
};
|
|
10
|
+
props: {
|
|
11
|
+
title: any;
|
|
12
|
+
icon: {
|
|
13
|
+
label: string;
|
|
14
|
+
description: string;
|
|
15
|
+
formType: string;
|
|
16
|
+
propType: string;
|
|
17
|
+
defaultValue: string;
|
|
18
|
+
required: boolean;
|
|
19
|
+
editable: boolean;
|
|
20
|
+
group: string;
|
|
21
|
+
};
|
|
22
|
+
accessibilityLabel: any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=TabViewItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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.8.2-
|
|
3
|
+
"version": "46.8.2-877fc5.2+877fc57",
|
|
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.2-
|
|
44
|
+
"@draftbit/types": "^46.8.2-877fc5.2+877fc57",
|
|
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",
|
|
@@ -56,7 +56,10 @@
|
|
|
56
56
|
"react-native-deck-swiper": "^2.0.12",
|
|
57
57
|
"react-native-markdown-display": "^7.0.0-alpha.2",
|
|
58
58
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
59
|
+
"react-native-pager-view": "5.4.24",
|
|
60
|
+
"react-native-shadow-2": "^7.0.6",
|
|
59
61
|
"react-native-svg": "12.3.0",
|
|
62
|
+
"react-native-tab-view": "^3.4.0",
|
|
60
63
|
"react-native-typography": "^1.4.1",
|
|
61
64
|
"react-native-web-swiper": "^2.2.3"
|
|
62
65
|
},
|
|
@@ -93,5 +96,5 @@
|
|
|
93
96
|
]
|
|
94
97
|
]
|
|
95
98
|
},
|
|
96
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "877fc579598a9ddfeb2d1096939c0b24d920f823"
|
|
97
100
|
}
|
|
@@ -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;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
import { extractStyles } from "../../utilities";
|
|
5
|
+
const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, tabsBackgroundColor, style, theme, children, }) => {
|
|
6
|
+
const [index, setIndex] = React.useState(0);
|
|
7
|
+
const [routes, setRoutes] = React.useState([]);
|
|
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
|
+
};
|
|
15
|
+
//Populate routes and scenes based on children
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
const newRoutes = [];
|
|
18
|
+
const scenes = {};
|
|
19
|
+
React.Children.toArray(children)
|
|
20
|
+
.filter((child) => React.isValidElement(child) && instanceOfTabViewItemProps(child.props))
|
|
21
|
+
.forEach((item, idx) => {
|
|
22
|
+
const child = item;
|
|
23
|
+
newRoutes.push({
|
|
24
|
+
key: idx.toString(),
|
|
25
|
+
title: child.props.title,
|
|
26
|
+
icon: child.props.icon,
|
|
27
|
+
accessibilityLabel: child.props.accessibilityLabel,
|
|
28
|
+
});
|
|
29
|
+
scenes[idx] = () => child;
|
|
30
|
+
});
|
|
31
|
+
setRoutes(newRoutes);
|
|
32
|
+
setTabScenes(scenes);
|
|
33
|
+
}, [children]);
|
|
34
|
+
const indexChangeHandler = (i) => {
|
|
35
|
+
setIndex(i);
|
|
36
|
+
onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
|
|
37
|
+
if (i === routes.length) {
|
|
38
|
+
onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const renderTabBar = (props) => {
|
|
42
|
+
return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
|
|
43
|
+
backgroundColor: indicatorColor || theme.colors.primary,
|
|
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
|
+
} }));
|
|
47
|
+
};
|
|
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 }));
|
|
53
|
+
};
|
|
54
|
+
export default withTheme(TabViewComponent);
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
TabView,
|
|
5
|
+
TabBar,
|
|
6
|
+
SceneMap,
|
|
7
|
+
SceneRendererProps,
|
|
8
|
+
NavigationState,
|
|
9
|
+
Route,
|
|
10
|
+
} from "react-native-tab-view";
|
|
11
|
+
|
|
12
|
+
import { TabViewItemProps } from "./TabViewItem";
|
|
13
|
+
import type { IconSlot } from "../../interfaces/Icon";
|
|
14
|
+
import { withTheme } from "../../theming";
|
|
15
|
+
import type { Theme } from "../../styles/DefaultTheme";
|
|
16
|
+
import { extractStyles } from "../../utilities";
|
|
17
|
+
|
|
18
|
+
type TabBarProps = SceneRendererProps & {
|
|
19
|
+
navigationState: NavigationState<any>;
|
|
20
|
+
};
|
|
21
|
+
type TabBarPosition = "top" | "bottom";
|
|
22
|
+
type KeyboardDismissMode = "none" | "auto" | "on-drag";
|
|
23
|
+
|
|
24
|
+
type TabViewProps = {
|
|
25
|
+
onIndexChanged?: (index: number) => void;
|
|
26
|
+
onEndReached?: () => void;
|
|
27
|
+
tabBarPosition?: TabBarPosition;
|
|
28
|
+
keyboardDismissMode?: KeyboardDismissMode;
|
|
29
|
+
swipeEnabled?: boolean;
|
|
30
|
+
scrollEnabled?: boolean;
|
|
31
|
+
activeColor?: string;
|
|
32
|
+
inactiveColor?: string;
|
|
33
|
+
pressColor?: string;
|
|
34
|
+
indicatorColor?: string;
|
|
35
|
+
tabsBackgroundColor?: string;
|
|
36
|
+
style?: StyleProp<ViewStyle>;
|
|
37
|
+
theme: Theme;
|
|
38
|
+
} & IconSlot;
|
|
39
|
+
|
|
40
|
+
const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
41
|
+
Icon,
|
|
42
|
+
onIndexChanged,
|
|
43
|
+
onEndReached,
|
|
44
|
+
tabBarPosition,
|
|
45
|
+
keyboardDismissMode,
|
|
46
|
+
swipeEnabled,
|
|
47
|
+
scrollEnabled,
|
|
48
|
+
activeColor,
|
|
49
|
+
inactiveColor,
|
|
50
|
+
pressColor,
|
|
51
|
+
indicatorColor,
|
|
52
|
+
tabsBackgroundColor,
|
|
53
|
+
style,
|
|
54
|
+
theme,
|
|
55
|
+
children,
|
|
56
|
+
}) => {
|
|
57
|
+
const [index, setIndex] = React.useState(0);
|
|
58
|
+
const [routes, setRoutes] = React.useState<Route[]>([]);
|
|
59
|
+
const [tabScenes, setTabScenes] = React.useState({});
|
|
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
|
+
|
|
71
|
+
//Populate routes and scenes based on children
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
const newRoutes: Route[] = [];
|
|
74
|
+
const scenes: any = {};
|
|
75
|
+
|
|
76
|
+
React.Children.toArray(children)
|
|
77
|
+
.filter(
|
|
78
|
+
(child) =>
|
|
79
|
+
React.isValidElement(child) && instanceOfTabViewItemProps(child.props)
|
|
80
|
+
)
|
|
81
|
+
.forEach((item: any, idx) => {
|
|
82
|
+
const child = item as React.ReactElement;
|
|
83
|
+
newRoutes.push({
|
|
84
|
+
key: idx.toString(),
|
|
85
|
+
title: child.props.title,
|
|
86
|
+
icon: child.props.icon,
|
|
87
|
+
accessibilityLabel: child.props.accessibilityLabel,
|
|
88
|
+
});
|
|
89
|
+
scenes[idx] = () => child;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
setRoutes(newRoutes);
|
|
93
|
+
setTabScenes(scenes);
|
|
94
|
+
}, [children]);
|
|
95
|
+
|
|
96
|
+
const indexChangeHandler = (i: number) => {
|
|
97
|
+
setIndex(i);
|
|
98
|
+
onIndexChanged?.(i);
|
|
99
|
+
if (i === routes.length) {
|
|
100
|
+
onEndReached?.();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const renderTabBar: React.FC<TabBarProps> = (props) => {
|
|
105
|
+
return (
|
|
106
|
+
<TabBar
|
|
107
|
+
{...props}
|
|
108
|
+
activeColor={activeColor || theme.colors.primary}
|
|
109
|
+
inactiveColor={inactiveColor || theme.colors.divider}
|
|
110
|
+
pressColor={pressColor || theme.colors.primary}
|
|
111
|
+
scrollEnabled={scrollEnabled}
|
|
112
|
+
indicatorStyle={{
|
|
113
|
+
backgroundColor: indicatorColor || theme.colors.primary,
|
|
114
|
+
}}
|
|
115
|
+
labelStyle={textStyles}
|
|
116
|
+
renderIcon={({ route, color }) =>
|
|
117
|
+
route?.icon ? (
|
|
118
|
+
<Icon name={route.icon} color={color} size={16} />
|
|
119
|
+
) : null
|
|
120
|
+
}
|
|
121
|
+
style={{
|
|
122
|
+
backgroundColor: tabsBackgroundColor || theme.colors.background,
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
//Cannot render TabView without at least one tab
|
|
129
|
+
if (!routes.length) {
|
|
130
|
+
return <></>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<TabView
|
|
135
|
+
style={[viewStyles]}
|
|
136
|
+
navigationState={{ index, routes }}
|
|
137
|
+
renderScene={SceneMap(tabScenes)}
|
|
138
|
+
renderTabBar={renderTabBar}
|
|
139
|
+
onIndexChange={indexChangeHandler}
|
|
140
|
+
tabBarPosition={tabBarPosition}
|
|
141
|
+
keyboardDismissMode={keyboardDismissMode}
|
|
142
|
+
swipeEnabled={swipeEnabled}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export default withTheme(TabViewComponent);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
const TabViewItem = ({ style, children, }) => {
|
|
4
|
+
return React.createElement(View, { style: [styles.parentContainer, style] }, children);
|
|
5
|
+
};
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
parentContainer: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export default TabViewItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
|
|
3
|
+
|
|
4
|
+
//Props used by parent (TabView) to create tabs
|
|
5
|
+
export interface TabViewItemProps {
|
|
6
|
+
title: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
accessibilityLabel?: string;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TabViewItem: React.FC<React.PropsWithChildren<TabViewItemProps>> = ({
|
|
13
|
+
style,
|
|
14
|
+
children,
|
|
15
|
+
}) => {
|
|
16
|
+
return <View style={[styles.parentContainer, style]}>{children}</View>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
parentContainer: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export default TabViewItem;
|