@lookiero/checkout 0.8.4-beta.1 → 0.8.4-beta.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.
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { Animated,
|
|
3
|
-
|
|
2
|
+
import { Animated, // Dimensions,
|
|
3
|
+
I18nManager, PanResponder, StyleSheet, View, } from "react-native";
|
|
4
|
+
// import { Pagination } from "./Pagination";
|
|
4
5
|
import { style } from "./Slider.style";
|
|
5
6
|
const DEFAULT_WIDTH = 200;
|
|
6
|
-
const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5, minDistanceForAction = 0.2, gesturesEnabled = true,
|
|
7
|
+
const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5, minDistanceForAction = 0.2, gesturesEnabled = true,
|
|
8
|
+
// paginationEnabled = true,
|
|
9
|
+
// paginationStyle,
|
|
10
|
+
// paginationItemStyle,
|
|
11
|
+
// paginationActiveItemStyle,
|
|
12
|
+
onSliderStart, onSliderEnd, onChanged,
|
|
13
|
+
// paginationRenderItem,
|
|
14
|
+
}) => {
|
|
7
15
|
const flatennedChildren = children.flat();
|
|
8
16
|
const count = flatennedChildren.length;
|
|
9
17
|
const [width, setWidth] = useState(0);
|
|
@@ -100,7 +108,7 @@ const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5,
|
|
|
100
108
|
fixAndGo(delta);
|
|
101
109
|
}
|
|
102
110
|
}, [fixAndGo]);
|
|
103
|
-
const getActiveIndex = useCallback(() => activeIndex.current, []);
|
|
111
|
+
// const getActiveIndex = useCallback(() => activeIndex.current, []);
|
|
104
112
|
useEffect(() => {
|
|
105
113
|
pan.x.addListener(({ value }) => (animatedValueX.current = value));
|
|
106
114
|
pan.y.addListener(({ value }) => (animatedValueY.current = value));
|
|
@@ -120,13 +128,40 @@ const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5,
|
|
|
120
128
|
widthRef.current = width;
|
|
121
129
|
fixState();
|
|
122
130
|
}, [fixState]);
|
|
123
|
-
return (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
return (
|
|
132
|
+
// <View style={style.container} testID="slider" onLayout={onLayoutWrapper}>
|
|
133
|
+
// <Animated.View
|
|
134
|
+
// style={StyleSheet.flatten([
|
|
135
|
+
// {
|
|
136
|
+
// transform: [{ translateX: pan.x }, { translateY: pan.y }],
|
|
137
|
+
// },
|
|
138
|
+
// style.sliderAreaStyle,
|
|
139
|
+
// ])}
|
|
140
|
+
// {...panResponder.panHandlers}
|
|
141
|
+
// >
|
|
142
|
+
// {flatennedChildren.map((child, index) => (
|
|
143
|
+
// <View key={index} style={{ width }} testID="slider-child">
|
|
144
|
+
// {child}
|
|
145
|
+
// </View>
|
|
146
|
+
// ))}
|
|
147
|
+
// </Animated.View>
|
|
148
|
+
// {paginationEnabled && (
|
|
149
|
+
// <Pagination
|
|
150
|
+
// activeIndex={getActiveIndex()}
|
|
151
|
+
// count={count}
|
|
152
|
+
// paginationActiveItemStyle={paginationActiveItemStyle}
|
|
153
|
+
// paginationItemStyle={paginationItemStyle}
|
|
154
|
+
// paginationStyle={paginationStyle}
|
|
155
|
+
// renderItem={paginationRenderItem}
|
|
156
|
+
// onChange={(index) => goTo(index)}
|
|
157
|
+
// />
|
|
158
|
+
// )}
|
|
159
|
+
// </View>
|
|
160
|
+
React.createElement(Animated.View, { style: StyleSheet.flatten([
|
|
161
|
+
{
|
|
162
|
+
transform: [{ translateX: pan.x }, { translateY: pan.y }],
|
|
163
|
+
},
|
|
164
|
+
style.sliderAreaStyle,
|
|
165
|
+
]), onLayout: onLayoutWrapper, ...panResponder.panHandlers }, flatennedChildren.map((child, index) => (React.createElement(View, { key: index, style: { width: "100%" }, testID: "slider-child" }, child)))));
|
|
131
166
|
};
|
|
132
167
|
export { Slider };
|