@draftbit/core 46.8.1-b0418d.2 → 46.8.1-e9e820.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 +23 -4
- package/lib/commonjs/components/Picker/Picker.js +9 -8
- package/lib/commonjs/components/TabView/TabView.js +100 -0
- package/lib/commonjs/components/TabView/TabViewItem.js +25 -0
- package/lib/commonjs/components/TabView/index.js +20 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/mappings/TabView.js +73 -0
- package/lib/commonjs/mappings/TabViewItem.js +35 -0
- package/lib/module/components/Accordion/AccordionItem.js +25 -4
- package/lib/module/components/Picker/Picker.js +9 -8
- package/lib/module/components/TabView/TabView.js +90 -0
- package/lib/module/components/TabView/TabViewItem.js +20 -0
- package/lib/module/components/TabView/index.js +2 -0
- package/lib/module/constants.js +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/TabView.js +66 -0
- package/lib/module/mappings/TabViewItem.js +28 -0
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- 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 +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- 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 +5 -3
- package/src/components/Picker/Picker.js +8 -7
- package/src/components/Picker/Picker.tsx +9 -7
- package/src/components/TabView/TabView.js +45 -0
- package/src/components/TabView/TabView.tsx +129 -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 +1 -0
- package/src/index.tsx +2 -0
- package/src/mappings/TabView.js +69 -0
- package/src/mappings/TabView.ts +79 -0
- package/src/mappings/TabViewItem.js +28 -0
- package/src/mappings/TabViewItem.ts +35 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createTextProp, createIconProp, CONTAINER_COMPONENT_STYLES_SECTIONS } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Tab View Item",
|
|
4
|
+
tag: "TabViewItem",
|
|
5
|
+
description: "Single Tab View item to be used in TabView. Each item represents a single tab and its content",
|
|
6
|
+
category: COMPONENT_TYPES.swiper,
|
|
7
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
8
|
+
layout: {
|
|
9
|
+
flex: 1
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
title: createTextProp({
|
|
13
|
+
label: "Title",
|
|
14
|
+
description: "Title of tab item",
|
|
15
|
+
defaultValue: null,
|
|
16
|
+
required: true
|
|
17
|
+
}),
|
|
18
|
+
icon: createIconProp({
|
|
19
|
+
defaultValue: null,
|
|
20
|
+
required: false
|
|
21
|
+
}),
|
|
22
|
+
accessibilityLabel: createTextProp({
|
|
23
|
+
label: "Accessibility Label",
|
|
24
|
+
description: "Accessibility Label",
|
|
25
|
+
defaultValue: null
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,S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,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AA2aF,wBAAiC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import type { IconSlot } from "../../interfaces/Icon";
|
|
4
|
+
import type { Theme } from "../../styles/DefaultTheme";
|
|
5
|
+
declare type TabBarPosition = "top" | "bottom";
|
|
6
|
+
declare type KeyboardDismissMode = "none" | "auto" | "on-drag";
|
|
7
|
+
declare type TabViewProps = {
|
|
8
|
+
onIndexChanged?: (index: number) => void;
|
|
9
|
+
onEndReached?: () => void;
|
|
10
|
+
tabBarPosition?: TabBarPosition;
|
|
11
|
+
keyboardDismissMode?: KeyboardDismissMode;
|
|
12
|
+
swipeEnabled?: boolean;
|
|
13
|
+
scrollEnabled?: boolean;
|
|
14
|
+
activeColor?: string;
|
|
15
|
+
inactiveColor?: string;
|
|
16
|
+
pressColor?: string;
|
|
17
|
+
indicatorColor?: string;
|
|
18
|
+
tabsBackgroundColor?: string;
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
theme: Theme;
|
|
21
|
+
} & IconSlot;
|
|
22
|
+
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<TabViewProps>, "theme"> & {
|
|
23
|
+
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
24
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<TabViewProps>> & React.FC<React.PropsWithChildren<TabViewProps>>, {}>;
|
|
25
|
+
export default _default;
|
|
26
|
+
//# sourceMappingURL=TabView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/TabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAWpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAKvD,aAAK,cAAc,GAAG,KAAK,GAAG,QAAQ,CAAC;AACvC,aAAK,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvD,aAAK,YAAY,GAAG;IAClB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,QAAQ,CAAC;;;;AA4Fb,wBAA2C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface TabViewItemProps {
|
|
4
|
+
title: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
accessibilityLabel?: string;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
declare const TabViewItem: React.FC<React.PropsWithChildren<TabViewItemProps>>;
|
|
10
|
+
export default TabViewItem;
|
|
11
|
+
//# sourceMappingURL=TabViewItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/TabViewItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAKpE,CAAC;AAQF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -32,6 +32,7 @@ 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
34
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
|
+
export { TabView, TabViewItem } from "./components/TabView";
|
|
35
36
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
36
37
|
export { default as Picker } from "./components/Picker/Picker";
|
|
37
38
|
export { default as ProgressBar } from "./components/ProgressBar";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceR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,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmErB,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":"AAOA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;CA2BrB,CAAC"}
|
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-e9e820.2+e9e820f",
|
|
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-e9e820.2+e9e820f",
|
|
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,7 +55,9 @@
|
|
|
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-pager-view": "5.4.24",
|
|
58
59
|
"react-native-svg": "12.3.0",
|
|
60
|
+
"react-native-tab-view": "^3.4.0",
|
|
59
61
|
"react-native-typography": "^1.4.1",
|
|
60
62
|
"react-native-web-swiper": "^2.2.3"
|
|
61
63
|
},
|
|
@@ -92,5 +94,5 @@
|
|
|
92
94
|
]
|
|
93
95
|
]
|
|
94
96
|
},
|
|
95
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "e9e820f4246209223aa56148771ae980556d3999"
|
|
96
98
|
}
|
|
@@ -36,8 +36,6 @@ const isWeb = Platform.OS === "web";
|
|
|
36
36
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
37
37
|
const disabledColor = "rgb(240, 240, 240)";
|
|
38
38
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
39
|
-
//Empty string for 'value' is treated as a non-value
|
|
40
|
-
//reason: Draftbit uses empty string as initial value for string state*/
|
|
41
39
|
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
|
|
42
40
|
var _a, _b;
|
|
43
41
|
const androidPickerRef = React.useRef(undefined);
|
|
@@ -47,12 +45,12 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
47
45
|
setPickerVisible(!pickerVisible);
|
|
48
46
|
};
|
|
49
47
|
React.useEffect(() => {
|
|
50
|
-
if (value != null
|
|
48
|
+
if (value != null) {
|
|
51
49
|
setInternalValue(value);
|
|
52
50
|
}
|
|
53
51
|
}, [value]);
|
|
54
52
|
React.useEffect(() => {
|
|
55
|
-
if (defaultValue != null
|
|
53
|
+
if (defaultValue != null) {
|
|
56
54
|
setInternalValue(defaultValue);
|
|
57
55
|
}
|
|
58
56
|
}, [defaultValue]);
|
|
@@ -67,7 +65,10 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
67
65
|
Keyboard.dismiss();
|
|
68
66
|
}
|
|
69
67
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
70
|
-
const
|
|
68
|
+
const normalizedOptions = normalizeOptions(options);
|
|
69
|
+
const pickerOptions = placeholder
|
|
70
|
+
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
71
|
+
: normalizedOptions;
|
|
71
72
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
72
73
|
const additionalBorderStyles = ["backgroundColor"];
|
|
73
74
|
const additionalMarginStyles = [
|
|
@@ -162,10 +163,10 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
162
163
|
...(disabled ? { color: unstyledColor } : {}),
|
|
163
164
|
};
|
|
164
165
|
const handleValueChange = (newValue, itemIndex) => {
|
|
165
|
-
if (
|
|
166
|
+
if (!placeholder || itemIndex > 0) {
|
|
166
167
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
|
|
167
|
-
setInternalValue(newValue);
|
|
168
168
|
}
|
|
169
|
+
setInternalValue(newValue);
|
|
169
170
|
};
|
|
170
171
|
return (
|
|
171
172
|
/* marginsContainer */
|
|
@@ -92,8 +92,6 @@ const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
|
92
92
|
const disabledColor = "rgb(240, 240, 240)";
|
|
93
93
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
94
94
|
|
|
95
|
-
//Empty string for 'value' is treated as a non-value
|
|
96
|
-
//reason: Draftbit uses empty string as initial value for string state*/
|
|
97
95
|
const Picker: React.FC<PickerProps> = ({
|
|
98
96
|
error,
|
|
99
97
|
options = [],
|
|
@@ -128,13 +126,13 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
128
126
|
};
|
|
129
127
|
|
|
130
128
|
React.useEffect(() => {
|
|
131
|
-
if (value != null
|
|
129
|
+
if (value != null) {
|
|
132
130
|
setInternalValue(value);
|
|
133
131
|
}
|
|
134
132
|
}, [value]);
|
|
135
133
|
|
|
136
134
|
React.useEffect(() => {
|
|
137
|
-
if (defaultValue != null
|
|
135
|
+
if (defaultValue != null) {
|
|
138
136
|
setInternalValue(defaultValue);
|
|
139
137
|
}
|
|
140
138
|
}, [defaultValue]);
|
|
@@ -151,7 +149,11 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
151
149
|
}
|
|
152
150
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
153
151
|
|
|
154
|
-
const
|
|
152
|
+
const normalizedOptions = normalizeOptions(options);
|
|
153
|
+
|
|
154
|
+
const pickerOptions = placeholder
|
|
155
|
+
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
156
|
+
: normalizedOptions;
|
|
155
157
|
|
|
156
158
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
157
159
|
|
|
@@ -302,10 +304,10 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
302
304
|
};
|
|
303
305
|
|
|
304
306
|
const handleValueChange = (newValue: string, itemIndex: number) => {
|
|
305
|
-
if (
|
|
307
|
+
if (!placeholder || itemIndex > 0) {
|
|
306
308
|
onValueChange?.(newValue, itemIndex);
|
|
307
|
-
setInternalValue(newValue);
|
|
308
309
|
}
|
|
310
|
+
setInternalValue(newValue);
|
|
309
311
|
};
|
|
310
312
|
|
|
311
313
|
return (
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
|
|
3
|
+
import TabViewItem from "./TabViewItem";
|
|
4
|
+
import { withTheme } from "../../theming";
|
|
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
|
+
//Populate routes and scenes based on children
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const newRoutes = [];
|
|
12
|
+
const scenes = {};
|
|
13
|
+
React.Children.toArray(children)
|
|
14
|
+
.filter((child) => React.isValidElement(child) && child.type === TabViewItem)
|
|
15
|
+
.forEach((item, idx) => {
|
|
16
|
+
const child = item;
|
|
17
|
+
newRoutes.push({
|
|
18
|
+
key: idx.toString(),
|
|
19
|
+
title: child.props.title,
|
|
20
|
+
icon: child.props.icon,
|
|
21
|
+
accessibilityLabel: child.props.accessibilityLabel,
|
|
22
|
+
});
|
|
23
|
+
scenes[idx] = () => child;
|
|
24
|
+
});
|
|
25
|
+
setRoutes(newRoutes);
|
|
26
|
+
setTabScenes(scenes);
|
|
27
|
+
}, [children]);
|
|
28
|
+
const indexChangeHandler = (i) => {
|
|
29
|
+
setIndex(i);
|
|
30
|
+
onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
|
|
31
|
+
if (i === routes.length) {
|
|
32
|
+
onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const renderTabBar = (props) => {
|
|
36
|
+
return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
|
|
37
|
+
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: 36 })) : null, style: [
|
|
39
|
+
{ backgroundColor: tabsBackgroundColor || theme.colors.background },
|
|
40
|
+
style,
|
|
41
|
+
] }));
|
|
42
|
+
};
|
|
43
|
+
return (React.createElement(TabView, { navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
|
|
44
|
+
};
|
|
45
|
+
export default withTheme(TabViewComponent);
|
|
@@ -0,0 +1,129 @@
|
|
|
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 TabViewItem from "./TabViewItem";
|
|
13
|
+
import type { IconSlot } from "../../interfaces/Icon";
|
|
14
|
+
import { withTheme } from "../../theming";
|
|
15
|
+
import type { Theme } from "../../styles/DefaultTheme";
|
|
16
|
+
|
|
17
|
+
type TabBarProps = SceneRendererProps & {
|
|
18
|
+
navigationState: NavigationState<any>;
|
|
19
|
+
};
|
|
20
|
+
type TabBarPosition = "top" | "bottom";
|
|
21
|
+
type KeyboardDismissMode = "none" | "auto" | "on-drag";
|
|
22
|
+
|
|
23
|
+
type TabViewProps = {
|
|
24
|
+
onIndexChanged?: (index: number) => void;
|
|
25
|
+
onEndReached?: () => void;
|
|
26
|
+
tabBarPosition?: TabBarPosition;
|
|
27
|
+
keyboardDismissMode?: KeyboardDismissMode;
|
|
28
|
+
swipeEnabled?: boolean;
|
|
29
|
+
scrollEnabled?: boolean;
|
|
30
|
+
activeColor?: string;
|
|
31
|
+
inactiveColor?: string;
|
|
32
|
+
pressColor?: string;
|
|
33
|
+
indicatorColor?: string;
|
|
34
|
+
tabsBackgroundColor?: string;
|
|
35
|
+
style?: StyleProp<ViewStyle>;
|
|
36
|
+
theme: Theme;
|
|
37
|
+
} & IconSlot;
|
|
38
|
+
|
|
39
|
+
const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
40
|
+
Icon,
|
|
41
|
+
onIndexChanged,
|
|
42
|
+
onEndReached,
|
|
43
|
+
tabBarPosition,
|
|
44
|
+
keyboardDismissMode,
|
|
45
|
+
swipeEnabled,
|
|
46
|
+
scrollEnabled,
|
|
47
|
+
activeColor,
|
|
48
|
+
inactiveColor,
|
|
49
|
+
pressColor,
|
|
50
|
+
indicatorColor,
|
|
51
|
+
tabsBackgroundColor,
|
|
52
|
+
style,
|
|
53
|
+
theme,
|
|
54
|
+
children,
|
|
55
|
+
}) => {
|
|
56
|
+
const [index, setIndex] = React.useState(0);
|
|
57
|
+
const [routes, setRoutes] = React.useState<Route[]>([]);
|
|
58
|
+
const [tabScenes, setTabScenes] = React.useState({});
|
|
59
|
+
|
|
60
|
+
//Populate routes and scenes based on children
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const newRoutes: Route[] = [];
|
|
63
|
+
const scenes: any = {};
|
|
64
|
+
|
|
65
|
+
React.Children.toArray(children)
|
|
66
|
+
.filter(
|
|
67
|
+
(child) => React.isValidElement(child) && child.type === TabViewItem
|
|
68
|
+
)
|
|
69
|
+
.forEach((item: any, idx) => {
|
|
70
|
+
const child = item as React.ReactElement;
|
|
71
|
+
newRoutes.push({
|
|
72
|
+
key: idx.toString(),
|
|
73
|
+
title: child.props.title,
|
|
74
|
+
icon: child.props.icon,
|
|
75
|
+
accessibilityLabel: child.props.accessibilityLabel,
|
|
76
|
+
});
|
|
77
|
+
scenes[idx] = () => child;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
setRoutes(newRoutes);
|
|
81
|
+
setTabScenes(scenes);
|
|
82
|
+
}, [children]);
|
|
83
|
+
|
|
84
|
+
const indexChangeHandler = (i: number) => {
|
|
85
|
+
setIndex(i);
|
|
86
|
+
onIndexChanged?.(i);
|
|
87
|
+
if (i === routes.length) {
|
|
88
|
+
onEndReached?.();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const renderTabBar: React.FC<TabBarProps> = (props) => {
|
|
93
|
+
return (
|
|
94
|
+
<TabBar
|
|
95
|
+
{...props}
|
|
96
|
+
activeColor={activeColor || theme.colors.primary}
|
|
97
|
+
inactiveColor={inactiveColor || theme.colors.divider}
|
|
98
|
+
pressColor={pressColor || theme.colors.primary}
|
|
99
|
+
scrollEnabled={scrollEnabled}
|
|
100
|
+
indicatorStyle={{
|
|
101
|
+
backgroundColor: indicatorColor || theme.colors.primary,
|
|
102
|
+
}}
|
|
103
|
+
renderIcon={({ route, color }) =>
|
|
104
|
+
route?.icon ? (
|
|
105
|
+
<Icon name={route.icon} color={color} size={36} />
|
|
106
|
+
) : null
|
|
107
|
+
}
|
|
108
|
+
style={[
|
|
109
|
+
{ backgroundColor: tabsBackgroundColor || theme.colors.background },
|
|
110
|
+
style,
|
|
111
|
+
]}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<TabView
|
|
118
|
+
navigationState={{ index, routes }}
|
|
119
|
+
renderScene={SceneMap(tabScenes)}
|
|
120
|
+
renderTabBar={renderTabBar}
|
|
121
|
+
onIndexChange={indexChangeHandler}
|
|
122
|
+
tabBarPosition={tabBarPosition}
|
|
123
|
+
keyboardDismissMode={keyboardDismissMode}
|
|
124
|
+
swipeEnabled={swipeEnabled}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
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
|
+
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;
|
package/src/index.js
CHANGED
|
@@ -32,6 +32,7 @@ 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
34
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
|
+
export { TabView, TabViewItem } from "./components/TabView";
|
|
35
36
|
/* Deprecated: Fix or Delete! */
|
|
36
37
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
37
38
|
export { default as Picker } from "./components/Picker/Picker";
|
package/src/index.tsx
CHANGED
|
@@ -53,6 +53,8 @@ export {
|
|
|
53
53
|
|
|
54
54
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
55
55
|
|
|
56
|
+
export { TabView, TabViewItem } from "./components/TabView";
|
|
57
|
+
|
|
56
58
|
/* Deprecated: Fix or Delete! */
|
|
57
59
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
58
60
|
export { default as Picker } from "./components/Picker/Picker";
|