@lookiero/checkout 3.4.2 → 3.5.0-beta.0
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/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +13 -0
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +4 -0
- package/dist/domain/checkout/model/checkoutPaid.d.ts +13 -0
- package/dist/domain/checkout/model/checkoutPaid.js +4 -0
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +6 -0
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +13 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +5 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +16 -0
- package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +1 -1
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +13 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +14 -0
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +10 -0
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +11 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +12 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +9 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +10 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +9 -0
- package/dist/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +6 -0
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +7 -0
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +6 -0
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +9 -0
- package/dist/infrastructure/ui/Root.js +3 -2
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +13 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +19 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +6 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +7 -0
- package/dist/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +1 -2
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +5 -0
- package/dist/infrastructure/ui/hooks/useToast.d.ts +11 -0
- package/dist/infrastructure/ui/hooks/useToast.js +49 -0
- package/dist/infrastructure/ui/views/App.style.d.ts +4 -0
- package/dist/infrastructure/ui/views/App.style.js +16 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +7 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +25 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +16 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +19 -0
- package/dist/infrastructure/ui/views/header/Header.d.ts +15 -0
- package/dist/infrastructure/ui/views/header/Header.js +90 -0
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +35 -0
- package/dist/infrastructure/ui/views/header/Header.style.js +38 -0
- package/dist/infrastructure/ui/views/header/components/Logo.d.ts +7 -0
- package/dist/infrastructure/ui/views/header/components/Logo.js +11 -0
- package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +7 -0
- package/dist/infrastructure/ui/views/header/components/Logo.style.js +8 -0
- package/dist/infrastructure/ui/views/intro/Intro.d.ts +6 -0
- package/dist/infrastructure/ui/views/intro/Intro.js +52 -0
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +55 -0
- package/dist/infrastructure/ui/views/intro/Intro.style.js +58 -0
- package/dist/infrastructure/ui/views/item/Item.style.d.ts +15 -0
- package/dist/infrastructure/ui/views/item/Item.style.js +18 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +26 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +44 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +45 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +53 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +7 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +25 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +16 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +19 -0
- package/dist/infrastructure/ui/views/navigation/Navigation.d.ts +21 -0
- package/dist/infrastructure/ui/views/navigation/Navigation.js +45 -0
- package/dist/infrastructure/ui/views/navigation/Navigation.style.d.ts +5 -0
- package/dist/infrastructure/ui/views/navigation/Navigation.style.js +30 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.d.ts +46 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.js +120 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +31 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +34 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.d.ts +7 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.js +11 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.d.ts +7 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.js +8 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +12 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +24 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +15 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +18 -0
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +10 -0
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +1 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +25 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +8 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +25 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +8 -0
- package/dist/shared/logging/location.d.ts +3 -0
- package/dist/shared/logging/location.js +5 -0
- package/dist/shared/logging/matchRoutes.d.ts +3 -0
- package/dist/shared/logging/matchRoutes.js +7 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +29 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +134 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +22 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +15 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +27 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.js +115 -0
- package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +17 -0
- package/dist/shared/notifications/domain/notification/command/createNotification.js +7 -0
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +1 -0
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +9 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +21 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +22 -0
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +12 -0
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +24 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +9 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +20 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +36 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +31 -0
- package/dist/shared/tracking/infrastructure/usePageView.d.ts +13 -0
- package/dist/shared/tracking/infrastructure/usePageView.js +27 -0
- package/dist/shared/ui/components/atoms/error/Error.style.d.ts +6 -0
- package/dist/shared/ui/components/atoms/error/Error.style.js +9 -0
- package/package.json +2 -2
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.d.ts +0 -15
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.js +0 -14
- package/dist/shared/ui/components/layouts/carousel/Carousel.d.ts +0 -11
- package/dist/shared/ui/components/layouts/carousel/Carousel.js +0 -31
- package/dist/shared/ui/components/layouts/carousel/Carousel.style.d.ts +0 -17
- package/dist/shared/ui/components/layouts/carousel/Carousel.style.js +0 -7
- package/dist/shared/ui/components/layouts/carousel/Carousel2.d.ts +0 -16
- package/dist/shared/ui/components/layouts/carousel/Carousel2.js +0 -72
- package/dist/shared/ui/components/layouts/carousel/DragComponent.d.ts +0 -3
- package/dist/shared/ui/components/layouts/carousel/DragComponent.js +0 -48
- package/dist/shared/ui/components/layouts/slider/Bullets.d.ts +0 -10
- package/dist/shared/ui/components/layouts/slider/Bullets.js +0 -29
- package/dist/shared/ui/components/layouts/slider/Bullets.style.d.ts +0 -12
- package/dist/shared/ui/components/layouts/slider/Bullets.style.js +0 -15
- package/dist/shared/ui/components/layouts/slider/SliderDots.d.ts +0 -8
- package/dist/shared/ui/components/layouts/slider/SliderDots.js +0 -16
- package/dist/shared/ui/components/layouts/slider/SliderDots.style.d.ts +0 -12
- package/dist/shared/ui/components/layouts/slider/SliderDots.style.js +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-beta.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@lookiero/data-sources": "^0.3",
|
|
50
50
|
"@lookiero/event": "^0.3",
|
|
51
51
|
"@lookiero/locale": "^0.3",
|
|
52
|
-
"@lookiero/payments-front": "^
|
|
52
|
+
"@lookiero/payments-front": "^1.1.1",
|
|
53
53
|
"@lookiero/user-tracking-front": "0.0.37",
|
|
54
54
|
"apollo-boost": "0.4.4",
|
|
55
55
|
"graphql": "16.6.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode, Ref } from "react";
|
|
2
|
-
import { GestureType, ScrollView } from "react-native-gesture-handler";
|
|
3
|
-
interface ContextShape {
|
|
4
|
-
readonly scrollViewRef: Ref<ScrollView>;
|
|
5
|
-
readonly panGestureRef: Ref<GestureType>;
|
|
6
|
-
}
|
|
7
|
-
interface ScrollViewRefContextProviderProps {
|
|
8
|
-
readonly children: ReactNode;
|
|
9
|
-
}
|
|
10
|
-
declare const ScrollViewRefContextProvider: FC<ScrollViewRefContextProviderProps>;
|
|
11
|
-
interface UseScrollViewRefFunction {
|
|
12
|
-
(): ContextShape;
|
|
13
|
-
}
|
|
14
|
-
declare const useScrollViewRef: UseScrollViewRefFunction;
|
|
15
|
-
export { useScrollViewRef, ScrollViewRefContextProvider };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useContext, useRef } from "react";
|
|
2
|
-
import invariant from "tiny-invariant";
|
|
3
|
-
const ScrollViewRefContext = createContext(null);
|
|
4
|
-
const ScrollViewRefContextProvider = ({ children }) => {
|
|
5
|
-
const scrollViewRef = useRef(null);
|
|
6
|
-
const panGestureRef = useRef(null);
|
|
7
|
-
return (React.createElement(ScrollViewRefContext.Provider, { value: { scrollViewRef, panGestureRef } }, children));
|
|
8
|
-
};
|
|
9
|
-
const useScrollViewRef = () => {
|
|
10
|
-
const ref = useContext(ScrollViewRefContext);
|
|
11
|
-
invariant(ref, "Your are trying to use the useScrollViewRef hook without wrapping your app with the <ScrollViewRefContextProvider>.");
|
|
12
|
-
return ref;
|
|
13
|
-
};
|
|
14
|
-
export { useScrollViewRef, ScrollViewRefContextProvider };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TCarouselProps } from "react-native-reanimated-carousel";
|
|
3
|
-
type CarouselRenderItem<T> = TCarouselProps<T>["renderItem"];
|
|
4
|
-
interface CarouselProps<T> {
|
|
5
|
-
readonly data: T[];
|
|
6
|
-
readonly children: CarouselRenderItem<T>;
|
|
7
|
-
readonly onActiveIndexChanged?: (index: number) => void;
|
|
8
|
-
}
|
|
9
|
-
declare const Carousel: <T>({ data, children, onActiveIndexChanged }: CarouselProps<T>) => JSX.Element;
|
|
10
|
-
export type { CarouselRenderItem };
|
|
11
|
-
export { Carousel };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
4
|
-
import RNRCarousel from "react-native-reanimated-carousel";
|
|
5
|
-
import { Bullets } from "../slider/Bullets";
|
|
6
|
-
const Carousel = ({ data, children, onActiveIndexChanged }) => {
|
|
7
|
-
const [carouselDimensions, setCarouselDimensions] = useState();
|
|
8
|
-
const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => setCarouselDimensions({ width, height }), []);
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
11
|
-
const activeIndexRef = useRef(activeIndex);
|
|
12
|
-
activeIndexRef.current = activeIndex;
|
|
13
|
-
const handleOnActiveChanged = useCallback((index) => ref.current?.scrollTo({ index, animated: true }), []);
|
|
14
|
-
const handleOnProgressChanged = useCallback(
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
-
(_offsetProgress, absoluteProgress) => {
|
|
17
|
-
const index = Math.round(absoluteProgress);
|
|
18
|
-
if (activeIndexRef.current === index) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
setActiveIndex(index);
|
|
22
|
-
onActiveIndexChanged?.(index);
|
|
23
|
-
}, [onActiveIndexChanged]);
|
|
24
|
-
return (React.createElement(React.Fragment, null,
|
|
25
|
-
React.createElement(View, { style: { flex: 1 }, onLayout: handleOnLayout }, carouselDimensions && (React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
|
|
26
|
-
React.createElement(RNRCarousel, { ref: ref, data: data, height: carouselDimensions.height, loop: false, renderItem: children, width: carouselDimensions.width, panGestureHandlerProps: {
|
|
27
|
-
activeOffsetX: [-10, 10],
|
|
28
|
-
}, onProgressChange: handleOnProgressChanged })))),
|
|
29
|
-
React.createElement(Bullets, { activeIndex: activeIndex, count: data.length, onChange: handleOnActiveChanged })));
|
|
30
|
-
};
|
|
31
|
-
export { Carousel };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare const style: {
|
|
2
|
-
carousel: {
|
|
3
|
-
flex: number;
|
|
4
|
-
flexDirection: "row";
|
|
5
|
-
height: string;
|
|
6
|
-
position: "absolute";
|
|
7
|
-
};
|
|
8
|
-
carouselItem: {
|
|
9
|
-
flex: number;
|
|
10
|
-
};
|
|
11
|
-
container: {
|
|
12
|
-
flex: number;
|
|
13
|
-
overflow: "hidden";
|
|
14
|
-
position: "relative";
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export { style };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
const style = StyleSheet.create({
|
|
3
|
-
carousel: { flex: 1, flexDirection: "row", height: "100%", position: "absolute" },
|
|
4
|
-
carouselItem: { flex: 1 },
|
|
5
|
-
container: { flex: 1, overflow: "hidden", position: "relative" },
|
|
6
|
-
});
|
|
7
|
-
export { style };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface RenderItemFunctionArgs<T> {
|
|
3
|
-
readonly item: T;
|
|
4
|
-
readonly index: number;
|
|
5
|
-
}
|
|
6
|
-
interface RenderItemFunction<T> {
|
|
7
|
-
(args: RenderItemFunctionArgs<T>): JSX.Element;
|
|
8
|
-
}
|
|
9
|
-
interface CarouselProps<T> {
|
|
10
|
-
readonly data: T[];
|
|
11
|
-
readonly children: RenderItemFunction<T>;
|
|
12
|
-
readonly onActiveIndexChanged?: (index: number) => void;
|
|
13
|
-
}
|
|
14
|
-
declare const Carousel2: <T>({ data, children, onActiveIndexChanged }: CarouselProps<T>) => JSX.Element;
|
|
15
|
-
export type { RenderItemFunction };
|
|
16
|
-
export { Carousel2 };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { clamp } from "@react-spring/shared";
|
|
2
|
-
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { View } from "react-native";
|
|
4
|
-
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
5
|
-
import Animated, { useSharedValue, withSpring, useAnimatedStyle, runOnJS } from "react-native-reanimated";
|
|
6
|
-
import { useScrollViewRef } from "../../../../../infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef";
|
|
7
|
-
import { Bullets } from "../slider/Bullets";
|
|
8
|
-
import { style } from "./Carousel.style";
|
|
9
|
-
const SPRING_CONFIG = {
|
|
10
|
-
damping: 25,
|
|
11
|
-
mass: 1,
|
|
12
|
-
stiffness: 300,
|
|
13
|
-
};
|
|
14
|
-
const Carousel2 = ({ data, children, onActiveIndexChanged }) => {
|
|
15
|
-
const { scrollViewRef, panGestureRef } = useScrollViewRef();
|
|
16
|
-
const [carouselDimensions, setCarouselDimensions] = useState();
|
|
17
|
-
const carouselItemWidth = carouselDimensions?.width || 1;
|
|
18
|
-
const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => setCarouselDimensions({ width, height }), []);
|
|
19
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
20
|
-
const activeIndexRef = useRef(activeIndex);
|
|
21
|
-
activeIndexRef.current = activeIndex;
|
|
22
|
-
const panTranslationX = useSharedValue(0);
|
|
23
|
-
const panInitialTranslationX = useSharedValue(0);
|
|
24
|
-
const updateActiveIndex = useCallback((index) => {
|
|
25
|
-
if (activeIndexRef.current === index) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
setActiveIndex(index);
|
|
29
|
-
onActiveIndexChanged?.(index);
|
|
30
|
-
}, [onActiveIndexChanged]);
|
|
31
|
-
const panGesture = useMemo(() => Gesture.Pan()
|
|
32
|
-
.maxPointers(1)
|
|
33
|
-
.activeOffsetX([-20, 20])
|
|
34
|
-
.onStart(() => {
|
|
35
|
-
panInitialTranslationX.value = panTranslationX.value;
|
|
36
|
-
})
|
|
37
|
-
.onUpdate(({ translationX }) => {
|
|
38
|
-
const tX = panInitialTranslationX.value + translationX;
|
|
39
|
-
const index = clamp(0, data.length - 1, Math.round(-tX / carouselItemWidth));
|
|
40
|
-
panTranslationX.value = tX;
|
|
41
|
-
runOnJS(updateActiveIndex)(index);
|
|
42
|
-
})
|
|
43
|
-
.onEnd(({ translationX }) => {
|
|
44
|
-
const tX = panInitialTranslationX.value + translationX;
|
|
45
|
-
const index = clamp(0, data.length - 1, Math.round(-tX / carouselItemWidth));
|
|
46
|
-
panTranslationX.value = withSpring(-index * carouselItemWidth, SPRING_CONFIG);
|
|
47
|
-
})
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
.simultaneousWithExternalGesture(scrollViewRef)
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
.withRef(panGestureRef), [
|
|
54
|
-
carouselItemWidth,
|
|
55
|
-
data.length,
|
|
56
|
-
panGestureRef,
|
|
57
|
-
panInitialTranslationX,
|
|
58
|
-
panTranslationX,
|
|
59
|
-
scrollViewRef,
|
|
60
|
-
updateActiveIndex,
|
|
61
|
-
]);
|
|
62
|
-
const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateX: panTranslationX.value }] }), [panTranslationX]);
|
|
63
|
-
return (React.createElement(React.Fragment, null,
|
|
64
|
-
React.createElement(View, { style: style.container, onLayout: handleOnLayout }, carouselDimensions && (
|
|
65
|
-
// <GestureHandlerRootView style={{ flex: 1 }}>
|
|
66
|
-
React.createElement(GestureDetector, { gesture: panGesture },
|
|
67
|
-
React.createElement(Animated.View, { style: [style.carousel, { width: carouselDimensions.width * data.length }, animatedStyle] }, data.map((item, index) => (React.createElement(View, { key: index, style: [style.carouselItem, { width: carouselDimensions.width }] }, children({ index, item }))))))
|
|
68
|
-
// </GestureHandlerRootView>
|
|
69
|
-
)),
|
|
70
|
-
React.createElement(Bullets, { activeIndex: activeIndex, count: data.length, onChange: () => void 0 })));
|
|
71
|
-
};
|
|
72
|
-
export { Carousel2 };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { View } from "react-native";
|
|
4
|
-
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
5
|
-
import { useSharedValue } from "react-native-reanimated";
|
|
6
|
-
import { useScrollViewRef } from "../../../../../infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef";
|
|
7
|
-
const TOUCH_SLOP = 5;
|
|
8
|
-
const TIME_TO_ACTIVATE_PAN = 400;
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
const DragComponent = (props) => {
|
|
11
|
-
const { scrollViewRef, panGestureRef } = useScrollViewRef();
|
|
12
|
-
const touchStart = useSharedValue({ x: 0, y: 0, time: 0 });
|
|
13
|
-
const gesture = Gesture.Pan()
|
|
14
|
-
.manualActivation(true)
|
|
15
|
-
.onTouchesDown((e) => {
|
|
16
|
-
touchStart.value = {
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
x: e.changedTouches[0].x,
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
y: e.changedTouches[0].y,
|
|
21
|
-
time: Date.now(),
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
.onTouchesMove((e, state) => {
|
|
25
|
-
if (Date.now() - touchStart.value.time > TIME_TO_ACTIVATE_PAN) {
|
|
26
|
-
state.activate();
|
|
27
|
-
console.log("activate");
|
|
28
|
-
}
|
|
29
|
-
else if (
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
Math.abs(touchStart.value.x - e.changedTouches[0].x) > TOUCH_SLOP ||
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
Math.abs(touchStart.value.y - e.changedTouches[0].y) > TOUCH_SLOP) {
|
|
34
|
-
state.fail();
|
|
35
|
-
console.log("fail");
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
.onUpdate(() => {
|
|
39
|
-
console.log("pan update");
|
|
40
|
-
})
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
.simultaneousWithExternalGesture(scrollViewRef)
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
.withRef(panGestureRef);
|
|
45
|
-
return (React.createElement(GestureDetector, { gesture: gesture },
|
|
46
|
-
React.createElement(View, null, props.children)));
|
|
47
|
-
};
|
|
48
|
-
export { DragComponent };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
interface BulletsProps {
|
|
3
|
-
readonly activeIndex: number;
|
|
4
|
-
readonly onChange: (index: number) => void;
|
|
5
|
-
readonly count: number;
|
|
6
|
-
readonly maxBullets?: number;
|
|
7
|
-
readonly testID?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const Bullets: FC<BulletsProps>;
|
|
10
|
-
export { Bullets };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { animated, useSpring } from "@react-spring/native";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { TouchableHighlight, View } from "react-native";
|
|
4
|
-
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
5
|
-
import { style } from "./Bullets.style";
|
|
6
|
-
const { colorContent, colorGrayscaleM } = theme();
|
|
7
|
-
const colorTransparent = "rgba(0,0,0,0)";
|
|
8
|
-
const MAX = 7;
|
|
9
|
-
const DIAMETER_MAX = 8;
|
|
10
|
-
const DIAMETER_MIN = 2;
|
|
11
|
-
const Bullet = ({ index, activeIndex, maxBullets, onChange }) => {
|
|
12
|
-
const pivot = Math.floor(maxBullets / 2) + 1;
|
|
13
|
-
const delta = Math.abs(index - activeIndex);
|
|
14
|
-
const diameter = delta > 1 ? DIAMETER_MAX - delta * DIAMETER_MIN : DIAMETER_MAX;
|
|
15
|
-
const color = delta === 0 ? colorContent : colorGrayscaleM;
|
|
16
|
-
const springs = useSpring({ diameter, color });
|
|
17
|
-
return delta >= pivot ? null : (React.createElement(TouchableHighlight, { underlayColor: colorTransparent, onPress: () => onChange(index) },
|
|
18
|
-
React.createElement(animated.View, { accessibilityState: { selected: delta === 0 }, testID: "bullet", style: [
|
|
19
|
-
style.bullet,
|
|
20
|
-
{
|
|
21
|
-
width: springs.diameter,
|
|
22
|
-
height: springs.diameter,
|
|
23
|
-
backgroundColor: springs.color,
|
|
24
|
-
borderRadius: springs.diameter,
|
|
25
|
-
},
|
|
26
|
-
] })));
|
|
27
|
-
};
|
|
28
|
-
const Bullets = ({ activeIndex, count, maxBullets = MAX, onChange, testID = "bullets" }) => (React.createElement(View, { style: style.bullets, testID: testID }, [...Array(count).keys()].map((index) => (React.createElement(Bullet, { key: index, activeIndex: activeIndex, index: index, maxBullets: maxBullets, onChange: onChange })))));
|
|
29
|
-
export { Bullets };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
|
-
const { spaceM } = theme();
|
|
4
|
-
const style = StyleSheet.create({
|
|
5
|
-
bullet: {
|
|
6
|
-
marginHorizontal: 3,
|
|
7
|
-
},
|
|
8
|
-
bullets: {
|
|
9
|
-
alignItems: "center",
|
|
10
|
-
flexDirection: "row",
|
|
11
|
-
justifyContent: "center",
|
|
12
|
-
paddingVertical: spaceM,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
export { style };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { TouchableWithoutFeedback, View } from "react-native";
|
|
3
|
-
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
4
|
-
import { style } from "./SliderDots.style";
|
|
5
|
-
const { colorContent } = theme();
|
|
6
|
-
const SliderDot = ({ diameter, color }) => (React.createElement(View, { style: [style.sliderDot, { width: diameter, height: diameter, backgroundColor: color, borderRadius: diameter }] }));
|
|
7
|
-
const SliderDots = () => {
|
|
8
|
-
return (React.createElement(View, { style: style.sliderDots },
|
|
9
|
-
React.createElement(TouchableWithoutFeedback, null,
|
|
10
|
-
React.createElement(SliderDot, { color: colorContent, diameter: 8 })),
|
|
11
|
-
React.createElement(TouchableWithoutFeedback, null,
|
|
12
|
-
React.createElement(SliderDot, { color: colorContent, diameter: 8 })),
|
|
13
|
-
React.createElement(TouchableWithoutFeedback, null,
|
|
14
|
-
React.createElement(SliderDot, { color: colorContent, diameter: 8 }))));
|
|
15
|
-
};
|
|
16
|
-
export { SliderDots };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
|
-
const { spaceM } = theme();
|
|
4
|
-
const style = StyleSheet.create({
|
|
5
|
-
sliderDot: {
|
|
6
|
-
marginHorizontal: 3,
|
|
7
|
-
},
|
|
8
|
-
sliderDots: {
|
|
9
|
-
alignItems: "center",
|
|
10
|
-
flexDirection: "row",
|
|
11
|
-
justifyContent: "center",
|
|
12
|
-
paddingVertical: spaceM,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
export { style };
|