@draftbit/core 46.11.1-a1a70b.2 → 46.11.1-af9f31.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 +5 -18
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js.map +1 -1
- package/lib/commonjs/mappings/DeckSwiper.js +3 -2
- package/lib/commonjs/mappings/DeckSwiper.js.map +1 -1
- package/lib/module/components/DeckSwiper/DeckSwiper.js +5 -18
- package/lib/module/components/DeckSwiper/DeckSwiper.js.map +1 -1
- package/lib/module/mappings/DeckSwiper.js +3 -2
- package/lib/module/mappings/DeckSwiper.js.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +1 -0
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/DeckSwiper/DeckSwiper.js +4 -14
- package/src/components/DeckSwiper/DeckSwiper.tsx +4 -22
- package/src/mappings/DeckSwiper.js +2 -0
- package/src/mappings/DeckSwiper.ts +2 -0
|
@@ -30,7 +30,6 @@ const DeckSwiper = _ref => {
|
|
|
30
30
|
if (data && renderItem && children) {
|
|
31
31
|
console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
|
|
32
32
|
}
|
|
33
|
-
const [isRenderingCardFillerHeight, setIsRenderingCardFillerHeight] = _react.default.useState(false);
|
|
34
33
|
const childrenArray = _react.default.useMemo(() => _react.default.Children.toArray(children), [children]);
|
|
35
34
|
|
|
36
35
|
// an array of indices based on children count
|
|
@@ -64,28 +63,15 @@ const DeckSwiper = _ref => {
|
|
|
64
63
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
65
64
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
66
65
|
*
|
|
66
|
+
*
|
|
67
67
|
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
68
68
|
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
69
69
|
* This effectivley makes the default height of the container be the height of the first card.
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
* isRenderingCardFillerHeight:
|
|
74
|
-
* Only render first card filler when component height is 0.
|
|
75
|
-
* Draftbit draft view already fills height appropriatley and does not need to render first card to compensate
|
|
76
|
-
* This check prevents double height and only fills height when it needs to
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
80
|
-
onLayout: event => {
|
|
81
|
-
const height = event.nativeEvent.layout.height;
|
|
82
|
-
if (height === 0 && !isRenderingCardFillerHeight) {
|
|
83
|
-
setIsRenderingCardFillerHeight(true);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, isRenderingCardFillerHeight ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
87
73
|
style: styles.containerHeightFiller
|
|
88
|
-
}, renderFirstCard())
|
|
74
|
+
}, renderFirstCard()), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
|
|
89
75
|
cards: cardsData,
|
|
90
76
|
renderCard: renderCard,
|
|
91
77
|
keyExtractor: cardKeyExtractor,
|
|
@@ -106,7 +92,8 @@ const DeckSwiper = _ref => {
|
|
|
106
92
|
};
|
|
107
93
|
const styles = _reactNative.StyleSheet.create({
|
|
108
94
|
cardsContainer: {
|
|
109
|
-
flex: 1
|
|
95
|
+
flex: 1,
|
|
96
|
+
position: "absolute"
|
|
110
97
|
},
|
|
111
98
|
card: {
|
|
112
99
|
left: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeckSwiper","onIndexChanged","onEndReached","startCardIndex","infiniteSwiping","verticalEnabled","horizontalEnabled","visibleCardCount","data","keyExtractor","renderItem","style","children","Error","console","warn","
|
|
1
|
+
{"version":3,"names":["DeckSwiper","onIndexChanged","onEndReached","startCardIndex","infiniteSwiping","verticalEnabled","horizontalEnabled","visibleCardCount","data","keyExtractor","renderItem","style","children","Error","console","warn","childrenArray","React","useMemo","Children","toArray","cardsFillerData","Array","from","length","keys","cardsData","renderCard","card","index","item","renderFirstCard","undefined","cardKeyExtractor","toString","styles","containerHeightFiller","StyleSheet","flatten","cardsContainer","create","flex","position","left","right","width","height","opacity"],"sourceRoot":"../../../../src","sources":["components/DeckSwiper/DeckSwiper.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAA2D;AAgB3D,MAAMA,UAAU,GAAG,QAagC;EAAA,IAbb;IACpCC,cAAc;IACdC,YAAY;IACZC,cAAc,GAAG,CAAC;IAClBC,eAAe,GAAG,KAAK;IACvBC,eAAe,GAAG,IAAI;IACtBC,iBAAiB,GAAG,IAAI;IACxBC,gBAAgB,GAAG,CAAC;IACpBC,IAAI;IACJC,YAAY;IACZC,UAAU;IACVC,KAAK;IACLC;EAC2C,CAAC;EAC5C;EACA,IAAKJ,IAAI,IAAI,CAACE,UAAU,IAAMA,UAAU,IAAI,CAACF,IAAK,EAAE;IAClD,MAAM,IAAIK,KAAK,CACb,gHAAgH,CACjH;EACH;EAEA,IAAIL,IAAI,IAAIE,UAAU,IAAIE,QAAQ,EAAE;IAClCE,OAAO,CAACC,IAAI,CACV,0EAA0E,CAC3E;EACH;EAEA,MAAMC,aAAa,GAAGC,cAAK,CAACC,OAAO,CACjC,MAAMD,cAAK,CAACE,QAAQ,CAACC,OAAO,CAACR,QAAQ,CAAC,EACtC,CAACA,QAAQ,CAAC,CACX;;EAED;EACA,MAAMS,eAAe,GAAGJ,cAAK,CAACC,OAAO,CACnC,MAAMI,KAAK,CAACC,IAAI,CAACD,KAAK,CAACN,aAAa,CAACQ,MAAM,CAAC,CAACC,IAAI,EAAE,CAAC,EACpD,CAACT,aAAa,CAAC,CAChB;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IACnC,cAAc,EAAEC,gBAAgB,GAAG,CAAE;IACrC,SAAS,EAAEA,gBAAiB;IAC5B,eAAe,EAAC,aAAa;IAC7B,kBAAkB,EAAE,CAAE;IACtB,oBAAoB,EAAE;EAAE,EACxB,CACG;AAEX,CAAC;AAED,MAAM4B,MAAM,GAAGE,uBAAU,CAACG,MAAM,CAAC;EAC/BD,cAAc,EAAE;IACdE,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDd,IAAI,EAAE;IACJe,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV,CAAC;EACDV,qBAAqB,EAAE;IACrBW,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAAC,eAEY/C,UAAU;AAAA"}
|
|
@@ -10,9 +10,10 @@ const SEED_DATA = {
|
|
|
10
10
|
tag: "DeckSwiper",
|
|
11
11
|
description: "Deck swiper container",
|
|
12
12
|
category: _types.COMPONENT_TYPES.swiper,
|
|
13
|
-
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Effects],
|
|
13
|
+
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Effects],
|
|
14
14
|
layout: {
|
|
15
|
-
flex: 1
|
|
15
|
+
flex: 1,
|
|
16
|
+
position: "absolute"
|
|
16
17
|
},
|
|
17
18
|
triggers: [_types.Triggers.OnIndexChanged, _types.Triggers.OnEndReached],
|
|
18
19
|
props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","swiper","stylesPanelSections","StylesPanelSections","Size","Margins","Effects","layout","flex","triggers","Triggers","OnIndexChanged","OnEndReached","props","onIndexChanged","createActionProp","label","onEndReached","startCardIndex","createStaticNumberProp","defaultValue","infiniteSwiping","createStaticBoolProp","verticalEnabled","horizontalEnabled","visibleCardCount","min","step"],"sourceRoot":"../../../src","sources":["mappings/DeckSwiper.ts"],"mappings":";;;;;;AAAA;AASO,MAAMA,SAAS,GAAG;EACvBC,IAAI,EAAE,aAAa;EACnBC,GAAG,EAAE,YAAY;EACjBC,WAAW,EAAE,uBAAuB;EACpCC,QAAQ,EAAEC,sBAAe,CAACC,MAAM;EAChCC,mBAAmB,EAAE,CACnBC,0BAAmB,CAACC,IAAI,EACxBD,0BAAmB,CAACE,
|
|
1
|
+
{"version":3,"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","swiper","stylesPanelSections","StylesPanelSections","Size","LayoutSelectedItem","Margins","Effects","layout","flex","position","triggers","Triggers","OnIndexChanged","OnEndReached","props","onIndexChanged","createActionProp","label","onEndReached","startCardIndex","createStaticNumberProp","defaultValue","infiniteSwiping","createStaticBoolProp","verticalEnabled","horizontalEnabled","visibleCardCount","min","step"],"sourceRoot":"../../../src","sources":["mappings/DeckSwiper.ts"],"mappings":";;;;;;AAAA;AASO,MAAMA,SAAS,GAAG;EACvBC,IAAI,EAAE,aAAa;EACnBC,GAAG,EAAE,YAAY;EACjBC,WAAW,EAAE,uBAAuB;EACpCC,QAAQ,EAAEC,sBAAe,CAACC,MAAM;EAChCC,mBAAmB,EAAE,CACnBC,0BAAmB,CAACC,IAAI,EACxBD,0BAAmB,CAACE,kBAAkB,EACtCF,0BAAmB,CAACG,OAAO,EAC3BH,0BAAmB,CAACI,OAAO,CAC5B;EACDC,MAAM,EAAE;IACNC,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDC,QAAQ,EAAE,CAACC,eAAQ,CAACC,cAAc,EAAED,eAAQ,CAACE,YAAY,CAAC;EAC1DC,KAAK,EAAE;IACLC,cAAc,EAAE,IAAAC,uBAAgB,EAAC;MAC/BC,KAAK,EAAE,kBAAkB;MACzBpB,WAAW,EAAE;IACf,CAAC,CAAC;IACFqB,YAAY,EAAE,IAAAF,uBAAgB,EAAC;MAC7BC,KAAK,EAAE,gBAAgB;MACvBpB,WAAW,EAAE;IACf,CAAC,CAAC;IACFsB,cAAc,EAAE,IAAAC,6BAAsB,EAAC;MACrCH,KAAK,EAAE,kBAAkB;MACzBpB,WAAW,EAAE,qCAAqC;MAClDwB,YAAY,EAAE;IAChB,CAAC,CAAC;IACFC,eAAe,EAAE,IAAAC,2BAAoB,EAAC;MACpCN,KAAK,EAAE,kBAAkB;MACzBpB,WAAW,EAAE;IACf,CAAC,CAAC;IACF2B,eAAe,EAAE,IAAAD,2BAAoB,EAAC;MACpCN,KAAK,EAAE,wBAAwB;MAC/BpB,WAAW,EAAE,qDAAqD;MAClEwB,YAAY,EAAE;IAChB,CAAC,CAAC;IACFI,iBAAiB,EAAE,IAAAF,2BAAoB,EAAC;MACtCN,KAAK,EAAE,0BAA0B;MACjCpB,WAAW,EAAE,uDAAuD;MACpEwB,YAAY,EAAE;IAChB,CAAC,CAAC;IACFK,gBAAgB,EAAE,IAAAN,6BAAsB,EAAC;MACvCH,KAAK,EAAE,oBAAoB;MAC3BpB,WAAW,EACT,iEAAiE;MACnEwB,YAAY,EAAE,CAAC;MACfM,GAAG,EAAE,CAAC;MACNC,IAAI,EAAE;IACR,CAAC;EACH;AACF,CAAC;AAAC"}
|
|
@@ -23,7 +23,6 @@ const DeckSwiper = _ref => {
|
|
|
23
23
|
if (data && renderItem && children) {
|
|
24
24
|
console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
|
|
25
25
|
}
|
|
26
|
-
const [isRenderingCardFillerHeight, setIsRenderingCardFillerHeight] = React.useState(false);
|
|
27
26
|
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
28
27
|
|
|
29
28
|
// an array of indices based on children count
|
|
@@ -57,28 +56,15 @@ const DeckSwiper = _ref => {
|
|
|
57
56
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
58
57
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
59
58
|
*
|
|
59
|
+
*
|
|
60
60
|
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
61
61
|
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
62
62
|
* This effectivley makes the default height of the container be the height of the first card.
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
* isRenderingCardFillerHeight:
|
|
67
|
-
* Only render first card filler when component height is 0.
|
|
68
|
-
* Draftbit draft view already fills height appropriatley and does not need to render first card to compensate
|
|
69
|
-
* This check prevents double height and only fills height when it needs to
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
73
|
-
onLayout: event => {
|
|
74
|
-
const height = event.nativeEvent.layout.height;
|
|
75
|
-
if (height === 0 && !isRenderingCardFillerHeight) {
|
|
76
|
-
setIsRenderingCardFillerHeight(true);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, isRenderingCardFillerHeight ? /*#__PURE__*/React.createElement(View, {
|
|
65
|
+
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
80
66
|
style: styles.containerHeightFiller
|
|
81
|
-
}, renderFirstCard())
|
|
67
|
+
}, renderFirstCard()), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
|
|
82
68
|
cards: cardsData,
|
|
83
69
|
renderCard: renderCard,
|
|
84
70
|
keyExtractor: cardKeyExtractor,
|
|
@@ -99,7 +85,8 @@ const DeckSwiper = _ref => {
|
|
|
99
85
|
};
|
|
100
86
|
const styles = StyleSheet.create({
|
|
101
87
|
cardsContainer: {
|
|
102
|
-
flex: 1
|
|
88
|
+
flex: 1,
|
|
89
|
+
position: "absolute"
|
|
103
90
|
},
|
|
104
91
|
card: {
|
|
105
92
|
left: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","DeckSwiperComponent","DeckSwiper","onIndexChanged","onEndReached","startCardIndex","infiniteSwiping","verticalEnabled","horizontalEnabled","visibleCardCount","data","keyExtractor","renderItem","style","children","Error","console","warn","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","DeckSwiperComponent","DeckSwiper","onIndexChanged","onEndReached","startCardIndex","infiniteSwiping","verticalEnabled","horizontalEnabled","visibleCardCount","data","keyExtractor","renderItem","style","children","Error","console","warn","childrenArray","useMemo","Children","toArray","cardsFillerData","Array","from","length","keys","cardsData","renderCard","card","index","item","renderFirstCard","undefined","cardKeyExtractor","toString","styles","containerHeightFiller","flatten","cardsContainer","create","flex","position","left","right","width","height","opacity"],"sourceRoot":"../../../../src","sources":["components/DeckSwiper/DeckSwiper.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA+BC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACrE,OAAOC,mBAAmB,MAAM,0BAA0B;AAgB1D,MAAMC,UAAU,GAAG,QAagC;EAAA,IAbb;IACpCC,cAAc;IACdC,YAAY;IACZC,cAAc,GAAG,CAAC;IAClBC,eAAe,GAAG,KAAK;IACvBC,eAAe,GAAG,IAAI;IACtBC,iBAAiB,GAAG,IAAI;IACxBC,gBAAgB,GAAG,CAAC;IACpBC,IAAI;IACJC,YAAY;IACZC,UAAU;IACVC,KAAK;IACLC;EAC2C,CAAC;EAC5C;EACA,IAAKJ,IAAI,IAAI,CAACE,UAAU,IAAMA,UAAU,IAAI,CAACF,IAAK,EAAE;IAClD,MAAM,IAAIK,KAAK,CACb,gHAAgH,CACjH;EACH;EAEA,IAAIL,IAAI,IAAIE,UAAU,IAAIE,QAAQ,EAAE;IAClCE,OAAO,CAACC,IAAI,CACV,0EAA0E,CAC3E;EACH;EAEA,MAAMC,aAAa,GAAGpB,KAAK,CAACqB,OAAO,CACjC,MAAMrB,KAAK,CAACsB,QAAQ,CAACC,OAAO,CAACP,QAAQ,CAAC,EACtC,CAACA,QAAQ,CAAC,CACX;;EAED;EACA,MAAMQ,eAAe,GAAGxB,KAAK,CA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Ae;IACzB,WAAW,EAAEC,YAAa;IAC1B,SAAS,EAAEC,cAAe;IAC1B,QAAQ,EAAEC,eAAgB;IAC1B,aAAa,EAAEC,eAAgB;IAC/B,eAAe,EAAEC,iBAAkB;IACnC,cAAc,EAAEC,gBAAgB,GAAG,CAAE;IACrC,SAAS,EAAEA,gBAAiB;IAC5B,eAAe,EAAC,aAAa;IAC7B,kBAAkB,EAAE,CAAE;IACtB,oBAAoB,EAAE;EAAE,EACxB,CACG;AAEX,CAAC;AAED,MAAM2B,MAAM,GAAGrC,UAAU,CAACyC,MAAM,CAAC;EAC/BD,cAAc,EAAE;IACdE,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDb,IAAI,EAAE;IACJc,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV,CAAC;EACDT,qBAAqB,EAAE;IACrBU,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEF,eAAe7C,UAAU"}
|
|
@@ -4,9 +4,10 @@ export const SEED_DATA = {
|
|
|
4
4
|
tag: "DeckSwiper",
|
|
5
5
|
description: "Deck swiper container",
|
|
6
6
|
category: COMPONENT_TYPES.swiper,
|
|
7
|
-
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Effects],
|
|
7
|
+
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.LayoutSelectedItem, StylesPanelSections.Margins, StylesPanelSections.Effects],
|
|
8
8
|
layout: {
|
|
9
|
-
flex: 1
|
|
9
|
+
flex: 1,
|
|
10
|
+
position: "absolute"
|
|
10
11
|
},
|
|
11
12
|
triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
|
|
12
13
|
props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["COMPONENT_TYPES","Triggers","createActionProp","createStaticNumberProp","createStaticBoolProp","StylesPanelSections","SEED_DATA","name","tag","description","category","swiper","stylesPanelSections","Size","Margins","Effects","layout","flex","triggers","OnIndexChanged","OnEndReached","props","onIndexChanged","label","onEndReached","startCardIndex","defaultValue","infiniteSwiping","verticalEnabled","horizontalEnabled","visibleCardCount","min","step"],"sourceRoot":"../../../src","sources":["mappings/DeckSwiper.ts"],"mappings":"AAAA,SACEA,eAAe,EACfC,QAAQ,EACRC,gBAAgB,EAChBC,sBAAsB,EACtBC,oBAAoB,EACpBC,mBAAmB,QACd,iBAAiB;AAExB,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,aAAa;EACnBC,GAAG,EAAE,YAAY;EACjBC,WAAW,EAAE,uBAAuB;EACpCC,QAAQ,EAAEV,eAAe,CAACW,MAAM;EAChCC,mBAAmB,EAAE,CACnBP,mBAAmB,CAACQ,IAAI,EACxBR,mBAAmB,CAACS,
|
|
1
|
+
{"version":3,"names":["COMPONENT_TYPES","Triggers","createActionProp","createStaticNumberProp","createStaticBoolProp","StylesPanelSections","SEED_DATA","name","tag","description","category","swiper","stylesPanelSections","Size","LayoutSelectedItem","Margins","Effects","layout","flex","position","triggers","OnIndexChanged","OnEndReached","props","onIndexChanged","label","onEndReached","startCardIndex","defaultValue","infiniteSwiping","verticalEnabled","horizontalEnabled","visibleCardCount","min","step"],"sourceRoot":"../../../src","sources":["mappings/DeckSwiper.ts"],"mappings":"AAAA,SACEA,eAAe,EACfC,QAAQ,EACRC,gBAAgB,EAChBC,sBAAsB,EACtBC,oBAAoB,EACpBC,mBAAmB,QACd,iBAAiB;AAExB,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,aAAa;EACnBC,GAAG,EAAE,YAAY;EACjBC,WAAW,EAAE,uBAAuB;EACpCC,QAAQ,EAAEV,eAAe,CAACW,MAAM;EAChCC,mBAAmB,EAAE,CACnBP,mBAAmB,CAACQ,IAAI,EACxBR,mBAAmB,CAACS,kBAAkB,EACtCT,mBAAmB,CAACU,OAAO,EAC3BV,mBAAmB,CAACW,OAAO,CAC5B;EACDC,MAAM,EAAE;IACNC,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDC,QAAQ,EAAE,CAACnB,QAAQ,CAACoB,cAAc,EAAEpB,QAAQ,CAACqB,YAAY,CAAC;EAC1DC,KAAK,EAAE;IACLC,cAAc,EAAEtB,gBAAgB,CAAC;MAC/BuB,KAAK,EAAE,kBAAkB;MACzBhB,WAAW,EAAE;IACf,CAAC,CAAC;IACFiB,YAAY,EAAExB,gBAAgB,CAAC;MAC7BuB,KAAK,EAAE,gBAAgB;MACvBhB,WAAW,EAAE;IACf,CAAC,CAAC;IACFkB,cAAc,EAAExB,sBAAsB,CAAC;MACrCsB,KAAK,EAAE,kBAAkB;MACzBhB,WAAW,EAAE,qCAAqC;MAClDmB,YAAY,EAAE;IAChB,CAAC,CAAC;IACFC,eAAe,EAAEzB,oBAAoB,CAAC;MACpCqB,KAAK,EAAE,kBAAkB;MACzBhB,WAAW,EAAE;IACf,CAAC,CAAC;IACFqB,eAAe,EAAE1B,oBAAoB,CAAC;MACpCqB,KAAK,EAAE,wBAAwB;MAC/BhB,WAAW,EAAE,qDAAqD;MAClEmB,YAAY,EAAE;IAChB,CAAC,CAAC;IACFG,iBAAiB,EAAE3B,oBAAoB,CAAC;MACtCqB,KAAK,EAAE,0BAA0B;MACjChB,WAAW,EAAE,uDAAuD;MACpEmB,YAAY,EAAE;IAChB,CAAC,CAAC;IACFI,gBAAgB,EAAE7B,sBAAsB,CAAC;MACvCsB,KAAK,EAAE,oBAAoB;MAC3BhB,WAAW,EACT,iEAAiE;MACnEmB,YAAY,EAAE,CAAC;MACfK,GAAG,EAAE,CAAC;MACNC,IAAI,EAAE;IACR,CAAC;EACH;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC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C1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,2PAoGf,CAAC;AAkBF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DeckSwiper.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DeckSwiper.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.11.1-
|
|
3
|
+
"version": "46.11.1-af9f31.2+af9f31a",
|
|
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.11.1-
|
|
44
|
+
"@draftbit/types": "^46.11.1-af9f31.2+af9f31a",
|
|
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",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"node_modules/",
|
|
94
94
|
"lib/"
|
|
95
95
|
],
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "af9f31abd1d8897a9f9af2693aabbeaf82b9385a"
|
|
97
97
|
}
|
|
@@ -9,7 +9,6 @@ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infinite
|
|
|
9
9
|
if (data && renderItem && children) {
|
|
10
10
|
console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
|
|
11
11
|
}
|
|
12
|
-
const [isRenderingCardFillerHeight, setIsRenderingCardFillerHeight] = React.useState(false);
|
|
13
12
|
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
14
13
|
// an array of indices based on children count
|
|
15
14
|
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
@@ -40,28 +39,19 @@ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infinite
|
|
|
40
39
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
41
40
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
42
41
|
*
|
|
42
|
+
*
|
|
43
43
|
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
44
44
|
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
45
45
|
* This effectivley makes the default height of the container be the height of the first card.
|
|
46
46
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* Only render first card filler when component height is 0.
|
|
50
|
-
* Draftbit draft view already fills height appropriatley and does not need to render first card to compensate
|
|
51
|
-
* This check prevents double height and only fills height when it needs to
|
|
52
|
-
*/
|
|
53
|
-
return (React.createElement(View, { onLayout: (event) => {
|
|
54
|
-
const height = event.nativeEvent.layout.height;
|
|
55
|
-
if (height === 0 && !isRenderingCardFillerHeight) {
|
|
56
|
-
setIsRenderingCardFillerHeight(true);
|
|
57
|
-
}
|
|
58
|
-
} },
|
|
59
|
-
isRenderingCardFillerHeight ? (React.createElement(View, { style: styles.containerHeightFiller }, renderFirstCard())) : undefined,
|
|
47
|
+
return (React.createElement(View, null,
|
|
48
|
+
React.createElement(View, { style: styles.containerHeightFiller }, renderFirstCard()),
|
|
60
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 })));
|
|
61
50
|
};
|
|
62
51
|
const styles = StyleSheet.create({
|
|
63
52
|
cardsContainer: {
|
|
64
53
|
flex: 1,
|
|
54
|
+
position: "absolute",
|
|
65
55
|
},
|
|
66
56
|
card: {
|
|
67
57
|
left: 0,
|
|
@@ -43,9 +43,6 @@ const DeckSwiper = <T extends object>({
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const [isRenderingCardFillerHeight, setIsRenderingCardFillerHeight] =
|
|
47
|
-
React.useState<boolean>(false);
|
|
48
|
-
|
|
49
46
|
const childrenArray = React.useMemo(
|
|
50
47
|
() => React.Children.toArray(children),
|
|
51
48
|
[children]
|
|
@@ -86,31 +83,15 @@ const DeckSwiper = <T extends object>({
|
|
|
86
83
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
87
84
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
88
85
|
*
|
|
86
|
+
*
|
|
89
87
|
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
90
88
|
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
91
89
|
* This effectivley makes the default height of the container be the height of the first card.
|
|
92
90
|
*/
|
|
93
91
|
|
|
94
|
-
/**
|
|
95
|
-
* isRenderingCardFillerHeight:
|
|
96
|
-
* Only render first card filler when component height is 0.
|
|
97
|
-
* Draftbit draft view already fills height appropriatley and does not need to render first card to compensate
|
|
98
|
-
* This check prevents double height and only fills height when it needs to
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
92
|
return (
|
|
102
|
-
<View
|
|
103
|
-
|
|
104
|
-
const height = event.nativeEvent.layout.height;
|
|
105
|
-
if (height === 0 && !isRenderingCardFillerHeight) {
|
|
106
|
-
setIsRenderingCardFillerHeight(true);
|
|
107
|
-
}
|
|
108
|
-
}}
|
|
109
|
-
>
|
|
110
|
-
{isRenderingCardFillerHeight ? (
|
|
111
|
-
<View style={styles.containerHeightFiller}>{renderFirstCard()}</View>
|
|
112
|
-
) : undefined}
|
|
113
|
-
|
|
93
|
+
<View>
|
|
94
|
+
<View style={styles.containerHeightFiller}>{renderFirstCard()}</View>
|
|
114
95
|
<DeckSwiperComponent
|
|
115
96
|
cards={cardsData as any[]}
|
|
116
97
|
renderCard={renderCard}
|
|
@@ -140,6 +121,7 @@ const DeckSwiper = <T extends object>({
|
|
|
140
121
|
const styles = StyleSheet.create({
|
|
141
122
|
cardsContainer: {
|
|
142
123
|
flex: 1,
|
|
124
|
+
position: "absolute",
|
|
143
125
|
},
|
|
144
126
|
card: {
|
|
145
127
|
left: 0,
|
|
@@ -6,11 +6,13 @@ export const SEED_DATA = {
|
|
|
6
6
|
category: COMPONENT_TYPES.swiper,
|
|
7
7
|
stylesPanelSections: [
|
|
8
8
|
StylesPanelSections.Size,
|
|
9
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
9
10
|
StylesPanelSections.Margins,
|
|
10
11
|
StylesPanelSections.Effects,
|
|
11
12
|
],
|
|
12
13
|
layout: {
|
|
13
14
|
flex: 1,
|
|
15
|
+
position: "absolute",
|
|
14
16
|
},
|
|
15
17
|
triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
|
|
16
18
|
props: {
|
|
@@ -14,11 +14,13 @@ export const SEED_DATA = {
|
|
|
14
14
|
category: COMPONENT_TYPES.swiper,
|
|
15
15
|
stylesPanelSections: [
|
|
16
16
|
StylesPanelSections.Size,
|
|
17
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
17
18
|
StylesPanelSections.Margins,
|
|
18
19
|
StylesPanelSections.Effects,
|
|
19
20
|
],
|
|
20
21
|
layout: {
|
|
21
22
|
flex: 1,
|
|
23
|
+
position: "absolute",
|
|
22
24
|
},
|
|
23
25
|
triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
|
|
24
26
|
props: {
|