@draftbit/core 46.8.1-fe4ccb.2 → 46.8.2-088bf8.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/DeckSwiper/DeckSwiper.js +38 -4
- package/lib/commonjs/components/Picker/Picker.js +8 -9
- package/lib/commonjs/components/RadioButton/context.js +1 -1
- package/lib/commonjs/components/ScreenContainer.js +2 -1
- package/lib/commonjs/components/ToggleButton.js +15 -2
- package/lib/commonjs/hooks.js +1 -2
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/mappings/Accordion.js +1 -0
- package/lib/commonjs/mappings/AccordionItem.js +1 -0
- package/lib/commonjs/mappings/ActionSheet.js +1 -0
- package/lib/commonjs/mappings/ActionSheetCancel.js +1 -0
- package/lib/commonjs/mappings/ActionSheetItem.js +1 -0
- package/lib/commonjs/mappings/HtmlElements.js +177 -0
- package/lib/commonjs/mappings/LinearGradient.js +1 -0
- package/lib/commonjs/mappings/MapCallout.js +1 -0
- package/lib/commonjs/mappings/MapMarker.js +1 -0
- package/lib/commonjs/mappings/MapView.js +1 -0
- package/lib/commonjs/mappings/Swiper.js +1 -0
- package/lib/commonjs/mappings/SwiperItem.js +2 -1
- package/lib/commonjs/mappings/TextArea.js +1 -0
- package/lib/commonjs/mappings/TextField.js +1 -0
- package/lib/module/components/DeckSwiper/DeckSwiper.js +38 -4
- package/lib/module/components/Picker/Picker.js +8 -9
- package/lib/module/components/Picker/PickerComponent.android.js +8 -11
- package/lib/module/components/ScreenContainer.js +2 -1
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/Accordion.js +2 -1
- package/lib/module/mappings/AccordionItem.js +2 -1
- package/lib/module/mappings/ActionSheet.js +2 -1
- package/lib/module/mappings/ActionSheetCancel.js +2 -1
- package/lib/module/mappings/ActionSheetItem.js +2 -1
- package/lib/module/mappings/HtmlElements.js +170 -0
- package/lib/module/mappings/LinearGradient.js +2 -1
- package/lib/module/mappings/MapCallout.js +2 -1
- package/lib/module/mappings/MapMarker.js +2 -1
- package/lib/module/mappings/MapView.js +2 -1
- package/lib/module/mappings/Swiper.js +2 -1
- package/lib/module/mappings/SwiperItem.js +3 -2
- package/lib/module/mappings/TextArea.js +2 -1
- package/lib/module/mappings/TextField.js +1 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +8 -2
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +2 -3
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/ScreenContainer.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Accordion.d.ts +1 -0
- package/lib/typescript/src/mappings/Accordion.d.ts.map +1 -1
- package/lib/typescript/src/mappings/AccordionItem.d.ts +1 -0
- package/lib/typescript/src/mappings/AccordionItem.d.ts.map +1 -1
- package/lib/typescript/src/mappings/ActionSheet.d.ts +1 -0
- package/lib/typescript/src/mappings/ActionSheet.d.ts.map +1 -1
- package/lib/typescript/src/mappings/ActionSheetCancel.d.ts +1 -0
- package/lib/typescript/src/mappings/ActionSheetCancel.d.ts.map +1 -1
- package/lib/typescript/src/mappings/ActionSheetItem.d.ts +1 -0
- package/lib/typescript/src/mappings/ActionSheetItem.d.ts.map +1 -1
- package/lib/typescript/src/mappings/HtmlElements.d.ts +77 -0
- package/lib/typescript/src/mappings/HtmlElements.d.ts.map +1 -0
- package/lib/typescript/src/mappings/LinearGradient.d.ts +1 -0
- package/lib/typescript/src/mappings/LinearGradient.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapCallout.d.ts +1 -0
- package/lib/typescript/src/mappings/MapCallout.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapMarker.d.ts +1 -0
- package/lib/typescript/src/mappings/MapMarker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapView.d.ts +1 -0
- package/lib/typescript/src/mappings/MapView.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Swiper.d.ts +1 -0
- package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/SwiperItem.d.ts +1 -0
- package/lib/typescript/src/mappings/SwiperItem.d.ts.map +1 -1
- package/lib/typescript/src/mappings/TextArea.d.ts +1 -0
- package/lib/typescript/src/mappings/TextArea.d.ts.map +1 -1
- package/lib/typescript/src/mappings/TextField.d.ts +1 -1
- package/lib/typescript/src/mappings/TextField.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/DeckSwiper/DeckSwiper.js +33 -3
- package/src/components/DeckSwiper/DeckSwiper.tsx +51 -9
- package/src/components/DeckSwiper/DeckSwiperCard.js +1 -1
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +3 -6
- package/src/components/Picker/Picker.js +7 -8
- package/src/components/Picker/Picker.tsx +7 -9
- package/src/components/ScreenContainer.js +2 -1
- package/src/components/ScreenContainer.tsx +2 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/src/mappings/Accordion.js +10 -1
- package/src/mappings/Accordion.ts +10 -0
- package/src/mappings/AccordionItem.js +2 -1
- package/src/mappings/AccordionItem.ts +2 -0
- package/src/mappings/ActionSheet.js +2 -1
- package/src/mappings/ActionSheet.ts +7 -1
- package/src/mappings/ActionSheetCancel.js +2 -1
- package/src/mappings/ActionSheetCancel.ts +2 -0
- package/src/mappings/ActionSheetItem.js +2 -1
- package/src/mappings/ActionSheetItem.ts +2 -0
- package/src/mappings/HtmlElements.js +193 -0
- package/src/mappings/HtmlElements.ts +207 -0
- package/src/mappings/LinearGradient.js +6 -1
- package/src/mappings/LinearGradient.ts +6 -0
- package/src/mappings/MapCallout.js +2 -1
- package/src/mappings/MapCallout.ts +2 -0
- package/src/mappings/MapMarker.js +2 -1
- package/src/mappings/MapMarker.ts +2 -0
- package/src/mappings/MapView.js +2 -1
- package/src/mappings/MapView.ts +2 -0
- package/src/mappings/Swiper.js +10 -1
- package/src/mappings/Swiper.ts +10 -0
- package/src/mappings/SwiperItem.js +2 -1
- package/src/mappings/SwiperItem.ts +5 -1
- package/src/mappings/TextArea.js +10 -1
- package/src/mappings/TextArea.ts +10 -0
- package/src/mappings/TextField.js +9 -0
- package/src/mappings/TextField.ts +9 -0
- package/lib/commonjs/components/Shadow.js +0 -42
- package/lib/commonjs/mappings/Shadow.js +0 -94
- package/lib/module/components/Shadow.js +0 -34
- package/lib/module/mappings/Shadow.js +0 -87
- package/lib/typescript/src/components/Shadow.d.ts +0 -24
- package/lib/typescript/src/components/Shadow.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Shadow.d.ts +0 -173
- package/lib/typescript/src/mappings/Shadow.d.ts.map +0 -1
- package/src/components/Shadow.js +0 -16
- package/src/components/Shadow.tsx +0 -58
- package/src/mappings/Shadow.js +0 -87
- package/src/mappings/Shadow.ts +0 -95
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export declare const SEED_DATA: ({
|
|
2
|
+
props: {
|
|
3
|
+
href: any;
|
|
4
|
+
target: {
|
|
5
|
+
group: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
formType: string;
|
|
9
|
+
defaultValue: string;
|
|
10
|
+
options: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
category: string;
|
|
14
|
+
doc_link: string;
|
|
15
|
+
code_link: string;
|
|
16
|
+
packageName: string;
|
|
17
|
+
stylesPanelSections: string[];
|
|
18
|
+
layout: {
|
|
19
|
+
margin: number;
|
|
20
|
+
};
|
|
21
|
+
triggers: string[];
|
|
22
|
+
name: string;
|
|
23
|
+
tag: string;
|
|
24
|
+
} | {
|
|
25
|
+
props: {
|
|
26
|
+
href?: undefined;
|
|
27
|
+
target?: undefined;
|
|
28
|
+
};
|
|
29
|
+
category: string;
|
|
30
|
+
doc_link: string;
|
|
31
|
+
code_link: string;
|
|
32
|
+
packageName: string;
|
|
33
|
+
stylesPanelSections: string[];
|
|
34
|
+
layout: {
|
|
35
|
+
margin: number;
|
|
36
|
+
};
|
|
37
|
+
triggers: string[];
|
|
38
|
+
name: string;
|
|
39
|
+
tag: string;
|
|
40
|
+
} | {
|
|
41
|
+
category: string;
|
|
42
|
+
props: {
|
|
43
|
+
children: {
|
|
44
|
+
group: string;
|
|
45
|
+
label: string;
|
|
46
|
+
description: string;
|
|
47
|
+
defaultValue: string;
|
|
48
|
+
editable: boolean;
|
|
49
|
+
required: boolean;
|
|
50
|
+
formType: string;
|
|
51
|
+
propType: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
doc_link: string;
|
|
55
|
+
code_link: string;
|
|
56
|
+
packageName: string;
|
|
57
|
+
stylesPanelSections: string[];
|
|
58
|
+
layout: {
|
|
59
|
+
margin: number;
|
|
60
|
+
};
|
|
61
|
+
triggers: string[];
|
|
62
|
+
name: string;
|
|
63
|
+
tag: string;
|
|
64
|
+
} | {
|
|
65
|
+
doc_link: string;
|
|
66
|
+
code_link: string;
|
|
67
|
+
packageName: string;
|
|
68
|
+
stylesPanelSections: string[];
|
|
69
|
+
layout: {
|
|
70
|
+
margin: number;
|
|
71
|
+
};
|
|
72
|
+
triggers: string[];
|
|
73
|
+
category: string;
|
|
74
|
+
name: string;
|
|
75
|
+
tag: string;
|
|
76
|
+
})[];
|
|
77
|
+
//# sourceMappingURL=HtmlElements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlElements.d.ts","sourceRoot":"","sources":["../../../../src/mappings/HtmlElements.ts"],"names":[],"mappings":"AAsFA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwHrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../../../../src/mappings/LinearGradient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../../../../src/mappings/LinearGradient.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapCallout.d.ts","sourceRoot":"","sources":["../../../../src/mappings/MapCallout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapCallout.d.ts","sourceRoot":"","sources":["../../../../src/mappings/MapCallout.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapMarker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/MapMarker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapMarker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/MapMarker.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/MapView.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/MapView.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8IrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Swiper.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Swiper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Swiper.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Swiper.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqErB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwiperItem.d.ts","sourceRoot":"","sources":["../../../../src/mappings/SwiperItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwiperItem.d.ts","sourceRoot":"","sources":["../../../../src/mappings/SwiperItem.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;;CAOrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TextArea.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TextArea.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgSrB,CAAC"}
|
|
@@ -6,6 +6,7 @@ export declare const SEED_DATA: ({
|
|
|
6
6
|
preview_image_url: string;
|
|
7
7
|
supports_list_render: boolean;
|
|
8
8
|
triggers: string[];
|
|
9
|
+
stylesPanelSections: string[];
|
|
9
10
|
props: {
|
|
10
11
|
type: {
|
|
11
12
|
label: string;
|
|
@@ -310,7 +311,6 @@ export declare const SEED_DATA: ({
|
|
|
310
311
|
};
|
|
311
312
|
};
|
|
312
313
|
layout: {};
|
|
313
|
-
stylesPanelSections?: undefined;
|
|
314
314
|
} | {
|
|
315
315
|
name: string;
|
|
316
316
|
tag: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TextField.ts"],"names":[],"mappings":"AA6TA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TextField.ts"],"names":[],"mappings":"AA6TA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyGrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.8.
|
|
3
|
+
"version": "46.8.2-088bf8.2+088bf87",
|
|
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.8.
|
|
44
|
+
"@draftbit/types": "^46.8.2-088bf8.2+088bf87",
|
|
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",
|
|
@@ -55,7 +56,6 @@
|
|
|
55
56
|
"lodash.tonumber": "^4.0.3",
|
|
56
57
|
"react-native-deck-swiper": "^2.0.12",
|
|
57
58
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
58
|
-
"react-native-shadow-2": "^7.0.6",
|
|
59
59
|
"react-native-svg": "12.3.0",
|
|
60
60
|
"react-native-typography": "^1.4.1",
|
|
61
61
|
"react-native-web-swiper": "^2.2.3"
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
]
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "088bf87109989ec13afa5a6b64d29314afdc8caa"
|
|
97
97
|
}
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
|
3
3
|
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
|
-
const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, style, children, }) => {
|
|
4
|
+
const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, data, keyExtractor, renderItem, style, children, }) => {
|
|
5
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
6
|
+
if ((data && !renderItem) || (renderItem && !data)) {
|
|
7
|
+
throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
|
|
8
|
+
}
|
|
9
|
+
if (data && renderItem && children) {
|
|
10
|
+
console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
|
|
11
|
+
}
|
|
5
12
|
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
6
13
|
// an array of indices based on children count
|
|
7
14
|
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
15
|
+
const cardsData = data || cardsFillerData;
|
|
16
|
+
const renderCard = (card, index) => {
|
|
17
|
+
if (renderItem) {
|
|
18
|
+
return renderItem({ item: card, index });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return React.createElement(React.Fragment, null, childrenArray[index]);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const renderFirstCard = () => {
|
|
25
|
+
if (cardsData.length) {
|
|
26
|
+
return renderCard(cardsData[0], 0);
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
};
|
|
30
|
+
const cardKeyExtractor = (card) => {
|
|
31
|
+
if (keyExtractor) {
|
|
32
|
+
return keyExtractor(card);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return card === null || card === void 0 ? void 0 : card.toString();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
8
38
|
/**
|
|
9
39
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
10
40
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
@@ -15,8 +45,8 @@ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infinite
|
|
|
15
45
|
* This effectivley makes the default height of the container be the height of the first card.
|
|
16
46
|
*/
|
|
17
47
|
return (React.createElement(View, null,
|
|
18
|
-
React.createElement(View, { style: styles.containerHeightFiller },
|
|
19
|
-
React.createElement(DeckSwiperComponent, { cards:
|
|
48
|
+
React.createElement(View, { style: styles.containerHeightFiller }, renderFirstCard()),
|
|
49
|
+
React.createElement(DeckSwiperComponent, { cards: cardsData, renderCard: renderCard, keyExtractor: cardKeyExtractor, containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
|
|
20
50
|
};
|
|
21
51
|
const styles = StyleSheet.create({
|
|
22
52
|
cardsContainer: {
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
|
|
3
3
|
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
4
|
|
|
5
|
-
export interface DeckSwiperProps {
|
|
5
|
+
export interface DeckSwiperProps<T> {
|
|
6
6
|
onIndexChanged?: (index: number) => void;
|
|
7
7
|
onEndReached?: () => void;
|
|
8
8
|
startCardIndex?: number;
|
|
@@ -10,10 +10,13 @@ export interface DeckSwiperProps {
|
|
|
10
10
|
verticalEnabled?: boolean;
|
|
11
11
|
horizontalEnabled?: boolean;
|
|
12
12
|
visibleCardCount?: number;
|
|
13
|
+
data?: Array<T>;
|
|
14
|
+
keyExtractor?: (item: T) => string;
|
|
15
|
+
renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
|
|
13
16
|
style?: StyleProp<ViewStyle>;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
const DeckSwiper
|
|
19
|
+
const DeckSwiper = <T extends object>({
|
|
17
20
|
onIndexChanged,
|
|
18
21
|
onEndReached,
|
|
19
22
|
startCardIndex = 0,
|
|
@@ -21,9 +24,25 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
|
21
24
|
verticalEnabled = true,
|
|
22
25
|
horizontalEnabled = true,
|
|
23
26
|
visibleCardCount = 1,
|
|
27
|
+
data,
|
|
28
|
+
keyExtractor,
|
|
29
|
+
renderItem,
|
|
24
30
|
style,
|
|
25
31
|
children,
|
|
26
|
-
}) => {
|
|
32
|
+
}: React.PropsWithChildren<DeckSwiperProps<T>>) => {
|
|
33
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
34
|
+
if ((data && !renderItem) || (renderItem && !data)) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (data && renderItem && children) {
|
|
41
|
+
console.warn(
|
|
42
|
+
"'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
27
46
|
const childrenArray = React.useMemo(
|
|
28
47
|
() => React.Children.toArray(children),
|
|
29
48
|
[children]
|
|
@@ -35,6 +54,31 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
|
35
54
|
[childrenArray]
|
|
36
55
|
);
|
|
37
56
|
|
|
57
|
+
const cardsData = data || cardsFillerData;
|
|
58
|
+
|
|
59
|
+
const renderCard = (card: any, index: number): JSX.Element => {
|
|
60
|
+
if (renderItem) {
|
|
61
|
+
return renderItem({ item: card, index });
|
|
62
|
+
} else {
|
|
63
|
+
return <>{childrenArray[index]}</>;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const renderFirstCard = (): JSX.Element | undefined => {
|
|
68
|
+
if (cardsData.length) {
|
|
69
|
+
return renderCard(cardsData[0], 0);
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const cardKeyExtractor = (card: any) => {
|
|
75
|
+
if (keyExtractor) {
|
|
76
|
+
return keyExtractor(card);
|
|
77
|
+
} else {
|
|
78
|
+
return card?.toString();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
38
82
|
/**
|
|
39
83
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
40
84
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
@@ -47,13 +91,11 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
|
47
91
|
|
|
48
92
|
return (
|
|
49
93
|
<View>
|
|
50
|
-
<View style={styles.containerHeightFiller}>
|
|
51
|
-
{childrenArray.length && childrenArray[0]}
|
|
52
|
-
</View>
|
|
94
|
+
<View style={styles.containerHeightFiller}>{renderFirstCard()}</View>
|
|
53
95
|
<DeckSwiperComponent
|
|
54
|
-
cards={
|
|
55
|
-
renderCard={
|
|
56
|
-
keyExtractor={
|
|
96
|
+
cards={cardsData as any[]}
|
|
97
|
+
renderCard={renderCard}
|
|
98
|
+
keyExtractor={cardKeyExtractor}
|
|
57
99
|
containerStyle={
|
|
58
100
|
StyleSheet.flatten([styles.cardsContainer, style]) as
|
|
59
101
|
| object
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
3
|
import { withTheme } from "../../theming";
|
|
4
|
-
const DeckSwiperCard = ({ style, children, theme
|
|
4
|
+
const DeckSwiperCard = ({ style, children, theme }) => (React.createElement(View, { style: [
|
|
5
5
|
styles.card,
|
|
6
6
|
{
|
|
7
7
|
backgroundColor: theme.colors.background,
|
|
@@ -5,15 +5,12 @@ import { withTheme } from "../../theming";
|
|
|
5
5
|
|
|
6
6
|
export interface DeckSwiperCardProps {
|
|
7
7
|
style?: StyleProp<ViewStyle>;
|
|
8
|
-
children: React.ReactNode;
|
|
9
8
|
theme: Theme;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
const DeckSwiperCard: React.FC<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
theme,
|
|
16
|
-
}) => (
|
|
11
|
+
const DeckSwiperCard: React.FC<
|
|
12
|
+
React.PropsWithChildren<DeckSwiperCardProps>
|
|
13
|
+
> = ({ style, children, theme }) => (
|
|
17
14
|
<View
|
|
18
15
|
style={[
|
|
19
16
|
styles.card,
|
|
@@ -36,6 +36,8 @@ 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*/
|
|
39
41
|
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, }) => {
|
|
40
42
|
var _a, _b;
|
|
41
43
|
const androidPickerRef = React.useRef(undefined);
|
|
@@ -45,12 +47,12 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
45
47
|
setPickerVisible(!pickerVisible);
|
|
46
48
|
};
|
|
47
49
|
React.useEffect(() => {
|
|
48
|
-
if (value != null) {
|
|
50
|
+
if (value != null && value !== "") {
|
|
49
51
|
setInternalValue(value);
|
|
50
52
|
}
|
|
51
53
|
}, [value]);
|
|
52
54
|
React.useEffect(() => {
|
|
53
|
-
if (defaultValue != null) {
|
|
55
|
+
if (defaultValue != null && defaultValue !== "") {
|
|
54
56
|
setInternalValue(defaultValue);
|
|
55
57
|
}
|
|
56
58
|
}, [defaultValue]);
|
|
@@ -65,10 +67,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
65
67
|
Keyboard.dismiss();
|
|
66
68
|
}
|
|
67
69
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
68
|
-
const
|
|
69
|
-
const pickerOptions = placeholder
|
|
70
|
-
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
71
|
-
: normalizedOptions;
|
|
70
|
+
const pickerOptions = normalizeOptions(options);
|
|
72
71
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
73
72
|
const additionalBorderStyles = ["backgroundColor"];
|
|
74
73
|
const additionalMarginStyles = [
|
|
@@ -163,10 +162,10 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
163
162
|
...(disabled ? { color: unstyledColor } : {}),
|
|
164
163
|
};
|
|
165
164
|
const handleValueChange = (newValue, itemIndex) => {
|
|
166
|
-
if (
|
|
165
|
+
if (newValue !== "") {
|
|
167
166
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
|
|
167
|
+
setInternalValue(newValue);
|
|
168
168
|
}
|
|
169
|
-
setInternalValue(newValue);
|
|
170
169
|
};
|
|
171
170
|
return (
|
|
172
171
|
/* marginsContainer */
|
|
@@ -92,6 +92,8 @@ 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*/
|
|
95
97
|
const Picker: React.FC<PickerProps> = ({
|
|
96
98
|
error,
|
|
97
99
|
options = [],
|
|
@@ -126,13 +128,13 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
126
128
|
};
|
|
127
129
|
|
|
128
130
|
React.useEffect(() => {
|
|
129
|
-
if (value != null) {
|
|
131
|
+
if (value != null && value !== "") {
|
|
130
132
|
setInternalValue(value);
|
|
131
133
|
}
|
|
132
134
|
}, [value]);
|
|
133
135
|
|
|
134
136
|
React.useEffect(() => {
|
|
135
|
-
if (defaultValue != null) {
|
|
137
|
+
if (defaultValue != null && defaultValue !== "") {
|
|
136
138
|
setInternalValue(defaultValue);
|
|
137
139
|
}
|
|
138
140
|
}, [defaultValue]);
|
|
@@ -149,11 +151,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
149
151
|
}
|
|
150
152
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
151
153
|
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
const pickerOptions = placeholder
|
|
155
|
-
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
156
|
-
: normalizedOptions;
|
|
154
|
+
const pickerOptions = normalizeOptions(options);
|
|
157
155
|
|
|
158
156
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
159
157
|
|
|
@@ -304,10 +302,10 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
304
302
|
};
|
|
305
303
|
|
|
306
304
|
const handleValueChange = (newValue: string, itemIndex: number) => {
|
|
307
|
-
if (
|
|
305
|
+
if (newValue !== "") {
|
|
308
306
|
onValueChange?.(newValue, itemIndex);
|
|
307
|
+
setInternalValue(newValue);
|
|
309
308
|
}
|
|
310
|
-
setInternalValue(newValue);
|
|
311
309
|
};
|
|
312
310
|
|
|
313
311
|
return (
|
|
@@ -3,7 +3,8 @@ import { StyleSheet, ScrollView, View, } from "react-native";
|
|
|
3
3
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
function ScreenContainer({ scrollable = false, hasSafeArea = false, hasBottomSafeArea = false, hasTopSafeArea = false, theme, style, children, ...rest }) {
|
|
6
|
-
|
|
6
|
+
var _a;
|
|
7
|
+
const backgroundColor = ((_a = StyleSheet.flatten(style)) === null || _a === void 0 ? void 0 : _a.backgroundColor) || theme.colors.background;
|
|
7
8
|
const edges = ["left", "right"];
|
|
8
9
|
if (hasSafeArea || hasTopSafeArea) {
|
|
9
10
|
edges.push("top");
|
|
@@ -31,7 +31,8 @@ function ScreenContainer({
|
|
|
31
31
|
children,
|
|
32
32
|
...rest
|
|
33
33
|
}: ScreenContainerProps) {
|
|
34
|
-
const backgroundColor =
|
|
34
|
+
const backgroundColor =
|
|
35
|
+
StyleSheet.flatten(style)?.backgroundColor || theme.colors.background;
|
|
35
36
|
|
|
36
37
|
const edges: Edge[] = ["left", "right"];
|
|
37
38
|
if (hasSafeArea || hasTopSafeArea) {
|
package/src/index.js
CHANGED
|
@@ -31,7 +31,6 @@ 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";
|
|
35
34
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
36
35
|
/* Deprecated: Fix or Delete! */
|
|
37
36
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
package/src/index.tsx
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createNumberProp, createIconProp, createTextProp, createStaticBoolProp, createColorProp, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createNumberProp, createIconProp, createTextProp, createStaticBoolProp, createColorProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Accordion",
|
|
4
4
|
tag: "AccordionGroup",
|
|
5
5
|
description: "An expandable container containing components",
|
|
6
6
|
category: COMPONENT_TYPES.container,
|
|
7
|
+
stylesPanelSections: [
|
|
8
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
9
|
+
StylesPanelSections.Background,
|
|
10
|
+
StylesPanelSections.Size,
|
|
11
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
12
|
+
StylesPanelSections.Position,
|
|
13
|
+
StylesPanelSections.Borders,
|
|
14
|
+
StylesPanelSections.Effects,
|
|
15
|
+
],
|
|
7
16
|
layout: {
|
|
8
17
|
paddingTop: 8,
|
|
9
18
|
paddingRight: 8,
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
createTextProp,
|
|
6
6
|
createStaticBoolProp,
|
|
7
7
|
createColorProp,
|
|
8
|
+
StylesPanelSections,
|
|
8
9
|
} from "@draftbit/types";
|
|
9
10
|
|
|
10
11
|
export const SEED_DATA = {
|
|
@@ -12,6 +13,15 @@ export const SEED_DATA = {
|
|
|
12
13
|
tag: "AccordionGroup",
|
|
13
14
|
description: "An expandable container containing components",
|
|
14
15
|
category: COMPONENT_TYPES.container,
|
|
16
|
+
stylesPanelSections: [
|
|
17
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
18
|
+
StylesPanelSections.Background,
|
|
19
|
+
StylesPanelSections.Size,
|
|
20
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
21
|
+
StylesPanelSections.Position,
|
|
22
|
+
StylesPanelSections.Borders,
|
|
23
|
+
StylesPanelSections.Effects,
|
|
24
|
+
],
|
|
15
25
|
layout: {
|
|
16
26
|
paddingTop: 8,
|
|
17
27
|
paddingRight: 8,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconProp, createTextProp, createColorProp, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createIconProp, createTextProp, createColorProp, CONTAINER_COMPONENT_STYLES_SECTIONS, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Accordion Item",
|
|
4
4
|
tag: "AccordionItem",
|
|
5
5
|
description: "Item to be used in Accordion",
|
|
6
6
|
category: COMPONENT_TYPES.deprecated,
|
|
7
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
7
8
|
props: {
|
|
8
9
|
icon: createIconProp(),
|
|
9
10
|
label: createTextProp({
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
createIconProp,
|
|
4
4
|
createTextProp,
|
|
5
5
|
createColorProp,
|
|
6
|
+
CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
6
7
|
} from "@draftbit/types";
|
|
7
8
|
|
|
8
9
|
export const SEED_DATA = {
|
|
@@ -10,6 +11,7 @@ export const SEED_DATA = {
|
|
|
10
11
|
tag: "AccordionItem",
|
|
11
12
|
description: "Item to be used in Accordion",
|
|
12
13
|
category: COMPONENT_TYPES.deprecated,
|
|
14
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
13
15
|
props: {
|
|
14
16
|
icon: createIconProp(),
|
|
15
17
|
label: createTextProp({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createStaticBoolProp, GROUPS } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createStaticBoolProp, GROUPS, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Action Sheet",
|
|
4
4
|
tag: "ActionSheet",
|
|
5
5
|
description: "Action Sheet container",
|
|
6
6
|
category: COMPONENT_TYPES.actionsheet,
|
|
7
|
+
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins],
|
|
7
8
|
props: {
|
|
8
9
|
visible: createStaticBoolProp({
|
|
9
10
|
group: GROUPS.data,
|