dhre-ui-kit 2.0.17 → 2.0.18

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
@@ -1,4 +1,4 @@
1
- import React, { createContext, useContext, useState, useEffect, useRef, memo, useCallback } from 'react';
1
+ import React, { createContext, useContext, useState, useEffect, useRef, useCallback, memo } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
3
  import { Dimensions, StyleSheet, Text, Pressable, View, Platform, KeyboardAvoidingView, TextInput, ScrollView, Animated, FlatList, TouchableOpacity, Modal as Modal$1, Alert, Linking, PanResponder } from 'react-native';
4
4
  import Modal from 'react-native-modal';
@@ -7,7 +7,7 @@ import LottieView from 'lottie-react-native';
7
7
  import Tooltip from 'react-native-walkthrough-tooltip';
8
8
  import Pdf from 'react-native-pdf';
9
9
  import * as Progress from 'react-native-progress';
10
- import { GestureHandlerRootView, Swipeable } from 'react-native-gesture-handler';
10
+ import { Swipeable } from 'react-native-gesture-handler';
11
11
  import DeviceInfo from 'react-native-device-info';
12
12
  import { Calendar } from 'react-native-calendars';
13
13
  import CountryPicker from 'react-native-country-picker-modal';
@@ -8638,6 +8638,30 @@ const styles$i = StyleSheet.create({
8638
8638
  seperator: { height: 1 }
8639
8639
  });
8640
8640
 
8641
+ const ActionButton = ({
8642
+ icon,
8643
+ title,
8644
+ onPress,
8645
+ style,
8646
+ testID,
8647
+ titleStyle
8648
+ }) => /* @__PURE__ */ React.createElement(
8649
+ Pressable,
8650
+ {
8651
+ testID,
8652
+ onPress,
8653
+ style: [styles$i.actionButton, style]
8654
+ },
8655
+ icon,
8656
+ /* @__PURE__ */ React.createElement(
8657
+ CustomTypography,
8658
+ {
8659
+ variant: "L1_REGULAR",
8660
+ style: [styles$i.titleStyle, titleStyle],
8661
+ text: title
8662
+ }
8663
+ )
8664
+ );
8641
8665
  const SwipableList = (props) => {
8642
8666
  const {
8643
8667
  data,
@@ -8663,38 +8687,17 @@ const SwipableList = (props) => {
8663
8687
  const { theme } = useTheme();
8664
8688
  const [currentOpenId, setCurrentOpenId] = useState(null);
8665
8689
  const swipeableRefs = useRef({});
8666
- const closeSwipeable = (id) => {
8690
+ const closeSwipeable = useCallback((id) => {
8667
8691
  swipeableRefs.current[id]?.close();
8668
- };
8669
- const handleSwipeStart = (id) => {
8670
- if (currentOpenId && currentOpenId !== id) {
8671
- closeSwipeable(currentOpenId);
8672
- }
8673
- setCurrentOpenId(id);
8674
- };
8675
- const ActionButton = ({
8676
- icon,
8677
- title,
8678
- onPress,
8679
- style,
8680
- testID
8681
- }) => /* @__PURE__ */ React.createElement(
8682
- Pressable,
8683
- {
8684
- testID,
8685
- onPress,
8686
- style: [styles$i.actionButton, style]
8687
- },
8688
- icon,
8689
- /* @__PURE__ */ React.createElement(
8690
- CustomTypography,
8691
- {
8692
- variant: "L1_REGULAR",
8693
- style: [styles$i.titleStyle, titleStyle],
8694
- text: title
8692
+ }, []);
8693
+ const handleSwipeStart = useCallback((id) => {
8694
+ setCurrentOpenId((prev) => {
8695
+ if (prev && prev !== id) {
8696
+ swipeableRefs.current[prev]?.close();
8695
8697
  }
8696
- )
8697
- );
8698
+ return id;
8699
+ });
8700
+ }, []);
8698
8701
  const leftActionHandle = (item, leftPrimaryActionIcon, leftPrimaryActionTitle, leftSecondaryActionIcon, leftSecondaryActionTitle) => /* @__PURE__ */ React.createElement(View, { style: styles$i.actionBtn }, leftPrimaryActionIcon && /* @__PURE__ */ React.createElement(
8699
8702
  ActionButton,
8700
8703
  {
@@ -8705,7 +8708,8 @@ const SwipableList = (props) => {
8705
8708
  closeSwipeable(item.id);
8706
8709
  },
8707
8710
  style: leftPrimaryActionStyle,
8708
- testID: `${testId}-LEFT-PRIMARY-${item.id}`
8711
+ testID: `${testId}-LEFT-PRIMARY-${item.id}`,
8712
+ titleStyle
8709
8713
  }
8710
8714
  ), leftSecondaryActionIcon && /* @__PURE__ */ React.createElement(
8711
8715
  ActionButton,
@@ -8717,7 +8721,8 @@ const SwipableList = (props) => {
8717
8721
  closeSwipeable(item.id);
8718
8722
  },
8719
8723
  style: leftSecondaryActionStyle,
8720
- testID: `${testId}-LEFT-SECONDARY-${item.id}`
8724
+ testID: `${testId}-LEFT-SECONDARY-${item.id}`,
8725
+ titleStyle
8721
8726
  }
8722
8727
  ));
8723
8728
  const rightActionHandle = (item) => /* @__PURE__ */ React.createElement(View, { style: [styles$i.actionBtn, rightPrimaryActionStyle] }, rightPrimaryActionIcon && /* @__PURE__ */ React.createElement(
@@ -8730,10 +8735,11 @@ const SwipableList = (props) => {
8730
8735
  closeSwipeable(item.id);
8731
8736
  },
8732
8737
  style: rightPrimaryActionStyle,
8733
- testID: `${testId}-RIGHT-PRIMARY-${item.id}`
8738
+ testID: `${testId}-RIGHT-PRIMARY-${item.id}`,
8739
+ titleStyle
8734
8740
  }
8735
8741
  ));
8736
- const renderItem = ({ item }) => /* @__PURE__ */ React.createElement(GestureHandlerRootView, { testID: `${testId}-LIST`, style: styles$i.container }, /* @__PURE__ */ React.createElement(
8742
+ const renderItem = ({ item }) => /* @__PURE__ */ React.createElement(View, { testID: `${testId}-LIST`, style: styles$i.container }, /* @__PURE__ */ React.createElement(
8737
8743
  Swipeable,
8738
8744
  {
8739
8745
  ref: (ref) => swipeableRefs.current[item.id] = ref,