dhre-ui-kit 2.0.17 → 2.0.19

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 CHANGED
@@ -7291,7 +7291,7 @@ const Checkbox = ({
7291
7291
  reactNative.Pressable,
7292
7292
  {
7293
7293
  testID: "Checkbox-Press",
7294
- onPress: handlePress,
7294
+ onPressIn: handlePress,
7295
7295
  disabled: disable,
7296
7296
  style: styles$w.checkboxContainer
7297
7297
  },
@@ -7303,7 +7303,7 @@ const Checkbox = ({
7303
7303
  variant: titleVariant,
7304
7304
  text: labelName,
7305
7305
  style: titleStyle,
7306
- onPress
7306
+ onPressIn: onPress
7307
7307
  }
7308
7308
  )
7309
7309
  ));
@@ -8674,6 +8674,30 @@ const styles$i = reactNative.StyleSheet.create({
8674
8674
  seperator: { height: 1 }
8675
8675
  });
8676
8676
 
8677
+ const ActionButton = ({
8678
+ icon,
8679
+ title,
8680
+ onPress,
8681
+ style,
8682
+ testID,
8683
+ titleStyle
8684
+ }) => /* @__PURE__ */ React__default["default"].createElement(
8685
+ reactNative.Pressable,
8686
+ {
8687
+ testID,
8688
+ onPress,
8689
+ style: [styles$i.actionButton, style]
8690
+ },
8691
+ icon,
8692
+ /* @__PURE__ */ React__default["default"].createElement(
8693
+ CustomTypography,
8694
+ {
8695
+ variant: "L1_REGULAR",
8696
+ style: [styles$i.titleStyle, titleStyle],
8697
+ text: title
8698
+ }
8699
+ )
8700
+ );
8677
8701
  const SwipableList = (props) => {
8678
8702
  const {
8679
8703
  data,
@@ -8699,38 +8723,17 @@ const SwipableList = (props) => {
8699
8723
  const { theme } = useTheme();
8700
8724
  const [currentOpenId, setCurrentOpenId] = React.useState(null);
8701
8725
  const swipeableRefs = React.useRef({});
8702
- const closeSwipeable = (id) => {
8726
+ const closeSwipeable = React.useCallback((id) => {
8703
8727
  swipeableRefs.current[id]?.close();
8704
- };
8705
- const handleSwipeStart = (id) => {
8706
- if (currentOpenId && currentOpenId !== id) {
8707
- closeSwipeable(currentOpenId);
8708
- }
8709
- setCurrentOpenId(id);
8710
- };
8711
- const ActionButton = ({
8712
- icon,
8713
- title,
8714
- onPress,
8715
- style,
8716
- testID
8717
- }) => /* @__PURE__ */ React__default["default"].createElement(
8718
- reactNative.Pressable,
8719
- {
8720
- testID,
8721
- onPress,
8722
- style: [styles$i.actionButton, style]
8723
- },
8724
- icon,
8725
- /* @__PURE__ */ React__default["default"].createElement(
8726
- CustomTypography,
8727
- {
8728
- variant: "L1_REGULAR",
8729
- style: [styles$i.titleStyle, titleStyle],
8730
- text: title
8728
+ }, []);
8729
+ const handleSwipeStart = React.useCallback((id) => {
8730
+ setCurrentOpenId((prev) => {
8731
+ if (prev && prev !== id) {
8732
+ swipeableRefs.current[prev]?.close();
8731
8733
  }
8732
- )
8733
- );
8734
+ return id;
8735
+ });
8736
+ }, []);
8734
8737
  const leftActionHandle = (item, leftPrimaryActionIcon, leftPrimaryActionTitle, leftSecondaryActionIcon, leftSecondaryActionTitle) => /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$i.actionBtn }, leftPrimaryActionIcon && /* @__PURE__ */ React__default["default"].createElement(
8735
8738
  ActionButton,
8736
8739
  {
@@ -8741,7 +8744,8 @@ const SwipableList = (props) => {
8741
8744
  closeSwipeable(item.id);
8742
8745
  },
8743
8746
  style: leftPrimaryActionStyle,
8744
- testID: `${testId}-LEFT-PRIMARY-${item.id}`
8747
+ testID: `${testId}-LEFT-PRIMARY-${item.id}`,
8748
+ titleStyle
8745
8749
  }
8746
8750
  ), leftSecondaryActionIcon && /* @__PURE__ */ React__default["default"].createElement(
8747
8751
  ActionButton,
@@ -8753,7 +8757,8 @@ const SwipableList = (props) => {
8753
8757
  closeSwipeable(item.id);
8754
8758
  },
8755
8759
  style: leftSecondaryActionStyle,
8756
- testID: `${testId}-LEFT-SECONDARY-${item.id}`
8760
+ testID: `${testId}-LEFT-SECONDARY-${item.id}`,
8761
+ titleStyle
8757
8762
  }
8758
8763
  ));
8759
8764
  const rightActionHandle = (item) => /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: [styles$i.actionBtn, rightPrimaryActionStyle] }, rightPrimaryActionIcon && /* @__PURE__ */ React__default["default"].createElement(
@@ -8766,10 +8771,11 @@ const SwipableList = (props) => {
8766
8771
  closeSwipeable(item.id);
8767
8772
  },
8768
8773
  style: rightPrimaryActionStyle,
8769
- testID: `${testId}-RIGHT-PRIMARY-${item.id}`
8774
+ testID: `${testId}-RIGHT-PRIMARY-${item.id}`,
8775
+ titleStyle
8770
8776
  }
8771
8777
  ));
8772
- const renderItem = ({ item }) => /* @__PURE__ */ React__default["default"].createElement(reactNativeGestureHandler.GestureHandlerRootView, { testID: `${testId}-LIST`, style: styles$i.container }, /* @__PURE__ */ React__default["default"].createElement(
8778
+ const renderItem = ({ item }) => /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { testID: `${testId}-LIST`, style: styles$i.container }, /* @__PURE__ */ React__default["default"].createElement(
8773
8779
  reactNativeGestureHandler.Swipeable,
8774
8780
  {
8775
8781
  ref: (ref) => swipeableRefs.current[item.id] = ref,
@@ -10828,9 +10834,11 @@ const CustomSlideButton = React__default["default"].forwardRef(
10828
10834
  }).start();
10829
10835
  };
10830
10836
  const panResponder = reactNative.PanResponder.create({
10837
+ onStartShouldSetPanResponder: () => true,
10831
10838
  onMoveShouldSetPanResponder: (e, gestureState) => {
10832
10839
  return gestureState.dx !== 0;
10833
10840
  },
10841
+ onPanResponderTerminationRequest: () => false,
10834
10842
  onPanResponderMove: (evt, gestureState) => {
10835
10843
  if (gestureState.dx > 0 && gestureState.dx <= value?.current - BUTTON_WIDTH - 8) {
10836
10844
  translateX.setValue(gestureState.dx);
@@ -10866,6 +10874,9 @@ const CustomSlideButton = React__default["default"].forwardRef(
10866
10874
  } else {
10867
10875
  resetAll();
10868
10876
  }
10877
+ },
10878
+ onPanResponderTerminate: () => {
10879
+ resetAll();
10869
10880
  }
10870
10881
  });
10871
10882
  const textColor = color.interpolate({