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.js
CHANGED
|
@@ -4286,17 +4286,20 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4286
4286
|
}, ref) => {
|
|
4287
4287
|
const value = React.useRef(0);
|
|
4288
4288
|
const cardRef = React.useRef(null);
|
|
4289
|
-
const
|
|
4289
|
+
const [translateX] = React.useState(new reactNative.Animated.Value(0));
|
|
4290
4290
|
const slideTailCardRef = React.useRef(null);
|
|
4291
4291
|
slideTailCardRef?.current?.setNativeProps({
|
|
4292
4292
|
style: { width: 0 }
|
|
4293
4293
|
});
|
|
4294
4294
|
React__default["default"].useImperativeHandle(ref, () => ({
|
|
4295
4295
|
reset() {
|
|
4296
|
-
reactNative.Animated.spring(
|
|
4296
|
+
reactNative.Animated.spring(translateX, {
|
|
4297
4297
|
toValue: 0,
|
|
4298
4298
|
useNativeDriver: false
|
|
4299
4299
|
}).start();
|
|
4300
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4301
|
+
style: { width: 0 }
|
|
4302
|
+
});
|
|
4300
4303
|
}
|
|
4301
4304
|
}));
|
|
4302
4305
|
const handleLayout = (event) => {
|
|
@@ -4309,44 +4312,40 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4309
4312
|
value.current = width;
|
|
4310
4313
|
}
|
|
4311
4314
|
};
|
|
4312
|
-
const panResponder =
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4344
|
-
style: { width: 0 }
|
|
4345
|
-
});
|
|
4346
|
-
}
|
|
4315
|
+
const panResponder = reactNative.PanResponder.create({
|
|
4316
|
+
onMoveShouldSetPanResponder: (e, gestureState) => {
|
|
4317
|
+
return Math.abs(gestureState.dx) > Math.abs(gestureState.dy);
|
|
4318
|
+
},
|
|
4319
|
+
onPanResponderMove: (evt, gestureState) => {
|
|
4320
|
+
translateX.setValue(gestureState.dx);
|
|
4321
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4322
|
+
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4323
|
+
});
|
|
4324
|
+
},
|
|
4325
|
+
onPanResponderRelease: (e, gestureState) => {
|
|
4326
|
+
if (gestureState.dx >= value.current * 0.7) {
|
|
4327
|
+
onComplete?.();
|
|
4328
|
+
reactNative.Animated.timing(translateX, {
|
|
4329
|
+
toValue: value.current - BUTTON_WIDTH,
|
|
4330
|
+
// Slide to the end
|
|
4331
|
+
duration: 300,
|
|
4332
|
+
useNativeDriver: false
|
|
4333
|
+
}).start();
|
|
4334
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4335
|
+
style: { width: value.current + BUTTON_WIDTH }
|
|
4336
|
+
// Change the width here
|
|
4337
|
+
});
|
|
4338
|
+
} else {
|
|
4339
|
+
reactNative.Animated.spring(translateX, {
|
|
4340
|
+
toValue: 0,
|
|
4341
|
+
useNativeDriver: false
|
|
4342
|
+
}).start();
|
|
4343
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4344
|
+
style: { width: 0 }
|
|
4345
|
+
});
|
|
4347
4346
|
}
|
|
4348
|
-
}
|
|
4349
|
-
)
|
|
4347
|
+
}
|
|
4348
|
+
});
|
|
4350
4349
|
const { theme } = useTheme();
|
|
4351
4350
|
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: {
|
|
4352
4351
|
...styles$3.sliderContainer,
|
|
@@ -4356,7 +4355,7 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4356
4355
|
reactNative.Animated.View,
|
|
4357
4356
|
{
|
|
4358
4357
|
ref: slideTailCardRef,
|
|
4359
|
-
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4358
|
+
style: [{ height: "100%", width: 0, backgroundColor: slideButtonTailColor }]
|
|
4360
4359
|
}
|
|
4361
4360
|
), /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$3.buttonTextContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4362
4361
|
CustomTypography,
|
|
@@ -4372,7 +4371,7 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4372
4371
|
)), /* @__PURE__ */ React__default["default"].createElement(
|
|
4373
4372
|
reactNative.Animated.View,
|
|
4374
4373
|
{
|
|
4375
|
-
style: [styles$3.slider, { transform: [{ translateX
|
|
4374
|
+
style: [styles$3.slider, { transform: [{ translateX }] }],
|
|
4376
4375
|
...panResponder.panHandlers
|
|
4377
4376
|
},
|
|
4378
4377
|
/* @__PURE__ */ React__default["default"].createElement(
|