dhre-ui-kit 0.0.236 → 0.0.238

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.mjs CHANGED
@@ -751,17 +751,21 @@ const CustomLoader = ({ loading, loadingText = "Loading..." }) => {
751
751
  useEffect(() => {
752
752
  if (loading) {
753
753
  Animated.loop(
754
- Animated.parallel([
755
- Animated.timing(rotateAnim, {
756
- toValue: 1,
757
- duration: 1500,
758
- easing: Easing.linear,
759
- useNativeDriver: true
760
- })
761
- ])
754
+ Animated.timing(rotateAnim, {
755
+ toValue: 1,
756
+ duration: 1500,
757
+ easing: Easing.linear,
758
+ useNativeDriver: true
759
+ })
762
760
  ).start();
761
+ } else {
762
+ rotateAnim.stopAnimation();
763
+ rotateAnim.setValue(0);
763
764
  }
764
- }, [loading]);
765
+ return () => {
766
+ rotateAnim.stopAnimation();
767
+ };
768
+ }, [loading, rotateAnim]);
765
769
  if (!loading) return null;
766
770
  const spin = rotateAnim.interpolate({
767
771
  inputRange: [0, 1],
@@ -4416,23 +4420,26 @@ const CustomSlideButton = React.forwardRef(
4416
4420
  };
4417
4421
  const panResponder = PanResponder.create({
4418
4422
  onMoveShouldSetPanResponder: (e, gestureState) => {
4419
- return Math.abs(gestureState.dx) > Math.abs(gestureState.dy);
4423
+ return gestureState.dx !== 0;
4420
4424
  },
4421
4425
  onPanResponderMove: (evt, gestureState) => {
4422
- translateX.setValue(gestureState.dx);
4423
- slideTailCardRef?.current?.setNativeProps({
4424
- style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
4425
- });
4426
+ if (gestureState.dx > 0) {
4427
+ translateX.setValue(gestureState.dx);
4428
+ slideTailCardRef?.current?.setNativeProps({
4429
+ style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
4430
+ });
4431
+ }
4426
4432
  },
4427
4433
  onPanResponderRelease: (e, gestureState) => {
4428
- if (gestureState.dx >= value.current * 0.8) {
4429
- onComplete?.();
4434
+ if (gestureState.dx >= value.current * 0.7) {
4430
4435
  Animated.timing(translateX, {
4431
- toValue: value.current - BUTTON_WIDTH,
4436
+ toValue: value.current - BUTTON_WIDTH - 12,
4432
4437
  // Slide to the end
4433
4438
  duration: 300,
4434
4439
  useNativeDriver: false
4435
- }).start();
4440
+ }).start(() => {
4441
+ onComplete?.();
4442
+ });
4436
4443
  slideTailCardRef?.current?.setNativeProps({
4437
4444
  style: { width: value.current + BUTTON_WIDTH }
4438
4445
  // Change the width here