dhre-ui-kit 0.0.210 → 0.0.211
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/index.js +40 -41
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +40 -41
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -4252,17 +4252,20 @@ const CustomSlideButton = React.forwardRef(
|
|
|
4252
4252
|
}, ref) => {
|
|
4253
4253
|
const value = useRef(0);
|
|
4254
4254
|
const cardRef = useRef(null);
|
|
4255
|
-
const
|
|
4255
|
+
const [translateX] = useState(new Animated.Value(0));
|
|
4256
4256
|
const slideTailCardRef = useRef(null);
|
|
4257
4257
|
slideTailCardRef?.current?.setNativeProps({
|
|
4258
4258
|
style: { width: 0 }
|
|
4259
4259
|
});
|
|
4260
4260
|
React.useImperativeHandle(ref, () => ({
|
|
4261
4261
|
reset() {
|
|
4262
|
-
Animated.spring(
|
|
4262
|
+
Animated.spring(translateX, {
|
|
4263
4263
|
toValue: 0,
|
|
4264
4264
|
useNativeDriver: false
|
|
4265
4265
|
}).start();
|
|
4266
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4267
|
+
style: { width: 0 }
|
|
4268
|
+
});
|
|
4266
4269
|
}
|
|
4267
4270
|
}));
|
|
4268
4271
|
const handleLayout = (event) => {
|
|
@@ -4275,44 +4278,40 @@ const CustomSlideButton = React.forwardRef(
|
|
|
4275
4278
|
value.current = width;
|
|
4276
4279
|
}
|
|
4277
4280
|
};
|
|
4278
|
-
const panResponder =
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4310
|
-
style: { width: 0 }
|
|
4311
|
-
});
|
|
4312
|
-
}
|
|
4281
|
+
const panResponder = PanResponder.create({
|
|
4282
|
+
onMoveShouldSetPanResponder: (e, gestureState) => {
|
|
4283
|
+
return Math.abs(gestureState.dx) > Math.abs(gestureState.dy);
|
|
4284
|
+
},
|
|
4285
|
+
onPanResponderMove: (evt, gestureState) => {
|
|
4286
|
+
translateX.setValue(gestureState.dx);
|
|
4287
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4288
|
+
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4289
|
+
});
|
|
4290
|
+
},
|
|
4291
|
+
onPanResponderRelease: (e, gestureState) => {
|
|
4292
|
+
if (gestureState.dx >= value.current * 0.7) {
|
|
4293
|
+
onComplete?.();
|
|
4294
|
+
Animated.timing(translateX, {
|
|
4295
|
+
toValue: value.current - BUTTON_WIDTH,
|
|
4296
|
+
// Slide to the end
|
|
4297
|
+
duration: 300,
|
|
4298
|
+
useNativeDriver: false
|
|
4299
|
+
}).start();
|
|
4300
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4301
|
+
style: { width: value.current + BUTTON_WIDTH }
|
|
4302
|
+
// Change the width here
|
|
4303
|
+
});
|
|
4304
|
+
} else {
|
|
4305
|
+
Animated.spring(translateX, {
|
|
4306
|
+
toValue: 0,
|
|
4307
|
+
useNativeDriver: false
|
|
4308
|
+
}).start();
|
|
4309
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4310
|
+
style: { width: 0 }
|
|
4311
|
+
});
|
|
4313
4312
|
}
|
|
4314
|
-
}
|
|
4315
|
-
)
|
|
4313
|
+
}
|
|
4314
|
+
});
|
|
4316
4315
|
const { theme } = useTheme();
|
|
4317
4316
|
return /* @__PURE__ */ React.createElement(View, { style: {
|
|
4318
4317
|
...styles$3.sliderContainer,
|
|
@@ -4322,7 +4321,7 @@ const CustomSlideButton = React.forwardRef(
|
|
|
4322
4321
|
Animated.View,
|
|
4323
4322
|
{
|
|
4324
4323
|
ref: slideTailCardRef,
|
|
4325
|
-
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4324
|
+
style: [{ height: "100%", width: 0, backgroundColor: slideButtonTailColor }]
|
|
4326
4325
|
}
|
|
4327
4326
|
), /* @__PURE__ */ React.createElement(View, { style: styles$3.buttonTextContainer }, /* @__PURE__ */ React.createElement(
|
|
4328
4327
|
CustomTypography,
|
|
@@ -4338,7 +4337,7 @@ const CustomSlideButton = React.forwardRef(
|
|
|
4338
4337
|
)), /* @__PURE__ */ React.createElement(
|
|
4339
4338
|
Animated.View,
|
|
4340
4339
|
{
|
|
4341
|
-
style: [styles$3.slider, { transform: [{ translateX
|
|
4340
|
+
style: [styles$3.slider, { transform: [{ translateX }] }],
|
|
4342
4341
|
...panResponder.panHandlers
|
|
4343
4342
|
},
|
|
4344
4343
|
/* @__PURE__ */ React.createElement(
|