@meatech/payblend_app_ui_component 1.1.45 → 1.1.46
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/components/SnapImageCarousel/SnapImageCarousel.tsx +5 -0
- package/components/SnapImageCarousel/types.ts +1 -0
- package/dist/components/SnapImageCarousel/SnapImageCarousel.d.ts.map +1 -1
- package/dist/components/SnapImageCarousel/SnapImageCarousel.js +4 -1
- package/dist/components/SnapImageCarousel/SnapImageCarousel.js.map +1 -1
- package/dist/components/SnapImageCarousel/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ export const SnapImageCarousel = forwardRef<TSnapImageCarouselItem, SnapImageCar
|
|
|
13
13
|
hidePagination,
|
|
14
14
|
isLoading,
|
|
15
15
|
onCreate,
|
|
16
|
+
onSnapToItem,
|
|
16
17
|
...props
|
|
17
18
|
}, ref) => {
|
|
18
19
|
const animation = useSharedValue<number>(0);
|
|
@@ -22,6 +23,10 @@ export const SnapImageCarousel = forwardRef<TSnapImageCarouselItem, SnapImageCar
|
|
|
22
23
|
);
|
|
23
24
|
if (index >= 0) {
|
|
24
25
|
animation.value = index;
|
|
26
|
+
|
|
27
|
+
if (typeof onSnapToItem === 'function') {
|
|
28
|
+
onSnapToItem(index);
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
};
|
|
27
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapImageCarousel.d.ts","sourceRoot":"","sources":["../../../components/SnapImageCarousel/SnapImageCarousel.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SnapImageCarousel.d.ts","sourceRoot":"","sources":["../../../components/SnapImageCarousel/SnapImageCarousel.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,KAkF5B,CAAC"}
|
|
@@ -10,12 +10,15 @@ import '../../themes/images.js';
|
|
|
10
10
|
import { deviceWidth, metrics } from '../../themes/metrics.js';
|
|
11
11
|
import '../../themes/stats.js';
|
|
12
12
|
|
|
13
|
-
const SnapImageCarousel = forwardRef(({ cardList, hidePagination, isLoading, onCreate, ...props }, ref) => {
|
|
13
|
+
const SnapImageCarousel = forwardRef(({ cardList, hidePagination, isLoading, onCreate, onSnapToItem, ...props }, ref) => {
|
|
14
14
|
const animation = useSharedValue(0);
|
|
15
15
|
const handleSnapToItem = (event) => {
|
|
16
16
|
const index = Math.round(event.nativeEvent.contentOffset.x / (deviceWidth() * 0.55));
|
|
17
17
|
if (index >= 0) {
|
|
18
18
|
animation.value = index;
|
|
19
|
+
if (typeof onSnapToItem === 'function') {
|
|
20
|
+
onSnapToItem(index);
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
};
|
|
21
24
|
const renderItem = ({ item, index, }) => (React__default.createElement(CardStatusThumbnail, { key: index.toString(), animation: animation, index: index, onCreate: onCreate, isLoading: isLoading, ...item }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapImageCarousel.js","sources":["../../../../components/SnapImageCarousel/SnapImageCarousel.tsx"],"sourcesContent":["import React, {forwardRef} from \"react\";\nimport { StyleSheet, View } from \"react-native\";\nimport Carousel, { CarouselProps } from \"react-native-snap-carousel\";\nimport { useSharedValue } from \"react-native-reanimated\";\nimport { PaginationItem } from \"./PaginationItem\";\nimport { CardStatusThumbnail } from \"./CardStatusThumbnail\";\nimport { THUMBNAIL_HEIGHT } from \"./consts\";\nimport { deviceWidth, metrics } from \"@ui/themes\";\nimport { SnapImageCarouselProps, TSnapImageCarouselItem } from \"./types\";\n\nexport const SnapImageCarousel = forwardRef<TSnapImageCarouselItem, SnapImageCarouselProps<T>>(({\n cardList,\n hidePagination,\n isLoading,\n onCreate,\n ...props\n}, ref) => {\n const animation = useSharedValue<number>(0);\n const handleSnapToItem: CarouselProps<string>[\"onScroll\"] = (event) => {\n const index = Math.round(\n event.nativeEvent.contentOffset.x / (deviceWidth() * 0.55)\n );\n if (index >= 0) {\n animation.value = index;\n }\n };\n\n const renderItem = ({\n item,\n index,\n }: {\n item: TSnapImageCarouselItem<T>;\n index: number;\n }) => (\n <CardStatusThumbnail\n key={index.toString()}\n animation={animation}\n index={index}\n onCreate={onCreate}\n isLoading={isLoading}\n {...item}\n />\n );\n\n const renderPaginationItem = (_: unknown, index: number) => (\n <PaginationItem\n key={index.toString()}\n animation={animation}\n index={index}\n />\n );\n\n // if (cardList?.length === 0) {\n // return (\n // <CardStatusThumbnail<T>\n // style={styles.carousel}\n // type={ECardThumbnailType.NOT_ISSUED}\n // photo={thumbnailDefault}\n // onCreate={onCreate}\n // />\n // );\n // }\n\n return (\n <>\n <View style={styles.carousel}>\n <Carousel\n ref={ref}\n data={cardList}\n renderItem={renderItem}\n sliderWidth={deviceWidth()}\n sliderHeight={THUMBNAIL_HEIGHT}\n itemWidth={deviceWidth() * 0.55}\n itemHeight={THUMBNAIL_HEIGHT}\n inactiveSlideScale={1}\n inactiveSlideOpacity={1}\n onScroll={handleSnapToItem}\n {...props}\n />\n </View>\n {!hidePagination && cardList.length > 0 && (\n <View style={styles.pagination}>\n {cardList.map(renderPaginationItem)}\n </View>\n )}\n </>\n );\n});\n\nconst styles = StyleSheet.create({\n carousel: {\n height: THUMBNAIL_HEIGHT,\n marginTop: metrics.height.spacingBase,\n },\n pagination: {\n flexDirection: \"row\",\n justifyContent: \"center\",\n gap: metrics.width.spacingExtraSmall,\n paddingVertical: metrics.height.spacingTiny,\n marginTop: metrics.height.spacingSlightlySmall,\n },\n});\n"],"names":["React"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SnapImageCarousel.js","sources":["../../../../components/SnapImageCarousel/SnapImageCarousel.tsx"],"sourcesContent":["import React, {forwardRef} from \"react\";\nimport { StyleSheet, View } from \"react-native\";\nimport Carousel, { CarouselProps } from \"react-native-snap-carousel\";\nimport { useSharedValue } from \"react-native-reanimated\";\nimport { PaginationItem } from \"./PaginationItem\";\nimport { CardStatusThumbnail } from \"./CardStatusThumbnail\";\nimport { THUMBNAIL_HEIGHT } from \"./consts\";\nimport { deviceWidth, metrics } from \"@ui/themes\";\nimport { SnapImageCarouselProps, TSnapImageCarouselItem } from \"./types\";\n\nexport const SnapImageCarousel = forwardRef<TSnapImageCarouselItem, SnapImageCarouselProps<T>>(({\n cardList,\n hidePagination,\n isLoading,\n onCreate,\n onSnapToItem,\n ...props\n}, ref) => {\n const animation = useSharedValue<number>(0);\n const handleSnapToItem: CarouselProps<string>[\"onScroll\"] = (event) => {\n const index = Math.round(\n event.nativeEvent.contentOffset.x / (deviceWidth() * 0.55)\n );\n if (index >= 0) {\n animation.value = index;\n\n if (typeof onSnapToItem === 'function') {\n onSnapToItem(index);\n }\n }\n };\n\n const renderItem = ({\n item,\n index,\n }: {\n item: TSnapImageCarouselItem<T>;\n index: number;\n }) => (\n <CardStatusThumbnail\n key={index.toString()}\n animation={animation}\n index={index}\n onCreate={onCreate}\n isLoading={isLoading}\n {...item}\n />\n );\n\n const renderPaginationItem = (_: unknown, index: number) => (\n <PaginationItem\n key={index.toString()}\n animation={animation}\n index={index}\n />\n );\n\n // if (cardList?.length === 0) {\n // return (\n // <CardStatusThumbnail<T>\n // style={styles.carousel}\n // type={ECardThumbnailType.NOT_ISSUED}\n // photo={thumbnailDefault}\n // onCreate={onCreate}\n // />\n // );\n // }\n\n return (\n <>\n <View style={styles.carousel}>\n <Carousel\n ref={ref}\n data={cardList}\n renderItem={renderItem}\n sliderWidth={deviceWidth()}\n sliderHeight={THUMBNAIL_HEIGHT}\n itemWidth={deviceWidth() * 0.55}\n itemHeight={THUMBNAIL_HEIGHT}\n inactiveSlideScale={1}\n inactiveSlideOpacity={1}\n onScroll={handleSnapToItem}\n {...props}\n />\n </View>\n {!hidePagination && cardList.length > 0 && (\n <View style={styles.pagination}>\n {cardList.map(renderPaginationItem)}\n </View>\n )}\n </>\n );\n});\n\nconst styles = StyleSheet.create({\n carousel: {\n height: THUMBNAIL_HEIGHT,\n marginTop: metrics.height.spacingBase,\n },\n pagination: {\n flexDirection: \"row\",\n justifyContent: \"center\",\n gap: metrics.width.spacingExtraSmall,\n paddingVertical: metrics.height.spacingTiny,\n marginTop: metrics.height.spacingSlightlySmall,\n },\n});\n"],"names":["React"],"mappings":";;;;;;;;;;;;AAUa,MAAA,iBAAiB,GAAG,UAAU,CAAoD,CAAC,EAC9F,QAAQ,EACR,cAAc,EACd,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,GAAG,KAAI;AACR,IAAA,MAAM,SAAS,GAAG,cAAc,CAAS,CAAC,CAAC;AAC3C,IAAA,MAAM,gBAAgB,GAAsC,CAAC,KAAK,KAAI;QACpE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CACtB,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,IAAI,WAAW,EAAE,GAAG,IAAI,CAAC,CAC3D;AACD,QAAA,IAAI,KAAK,IAAI,CAAC,EAAE;AACd,YAAA,SAAS,CAAC,KAAK,GAAG,KAAK;AAEvB,YAAA,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;gBACtC,YAAY,CAAC,KAAK,CAAC;;;AAGzB,KAAC;AAED,IAAA,MAAM,UAAU,GAAG,CAAC,EAClB,IAAI,EACJ,KAAK,GAIN,MACCA,cAAC,CAAA,aAAA,CAAA,mBAAmB,IAClB,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,EACrB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,KAChB,IAAI,EAAA,CACR,CACH;AAED,IAAA,MAAM,oBAAoB,GAAG,CAAC,CAAU,EAAE,KAAa,MACrDA,cAAC,CAAA,aAAA,CAAA,cAAc,EACb,EAAA,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,EACrB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EAAA,CACZ,CACH;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
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../components/SnapImageCarousel/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,OAAO,IAAI,IAAI,CACpD,wBAAwB,CAAC,CAAC,CAAC,EAC3B,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CACnD,CAAC;AAEF,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO,CACjD,SAAQ,IAAI,CACV,aAAa,CAAC,MAAM,CAAC,EACnB,cAAc,GACd,WAAW,GACX,oBAAoB,GACpB,MAAM,GACN,mBAAmB,CACtB;IACD,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../components/SnapImageCarousel/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM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