dhre-ui-kit 0.0.274 → 0.0.276

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,12 +1,13 @@
1
- import React, { createContext, useContext, useState, useEffect, useRef, memo, useCallback } from 'react';
1
+ import React, { createContext, useContext, useRef, useCallback, useState, useEffect, memo } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
- import { Dimensions, StyleSheet, Text, Pressable, View, Modal, KeyboardAvoidingView, Platform, TextInput, ScrollView, Animated, FlatList, TouchableOpacity, Alert, Linking, PanResponder } from 'react-native';
4
- import { PanGestureHandler, GestureHandlerRootView, Swipeable } from 'react-native-gesture-handler';
3
+ import { Dimensions, StyleSheet, Text, Pressable, View, TextInput, ScrollView, Animated, Platform, FlatList, TouchableOpacity, Modal, Alert, Linking, PanResponder } from 'react-native';
4
+ import BottomSheet from '@gorhom/bottom-sheet';
5
5
  import { BlurView } from '@react-native-community/blur';
6
6
  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
11
  import DeviceInfo from 'react-native-device-info';
11
12
  import { Calendar } from 'react-native-calendars';
12
13
  import CountryPicker from 'react-native-country-picker-modal';
@@ -659,55 +660,50 @@ const BottomDrawer = ({
659
660
  blurType = "light",
660
661
  showSeparator = true
661
662
  }) => {
662
- const [isSwiping, setIsSwiping] = useState(false);
663
- const onSwipDown = (event) => {
664
- const { translationY } = event.nativeEvent;
665
- if (translationY > 50 && !isSwiping) {
666
- setIsSwiping(true);
667
- toggleModal();
668
- setIsSwiping(false);
669
- }
670
- };
663
+ const bottomSheetRef = useRef(null);
664
+ const handleSheetChanges = useCallback(
665
+ (index) => {
666
+ if (index === -1) {
667
+ toggleModal();
668
+ }
669
+ },
670
+ [toggleModal]
671
+ );
671
672
  return /* @__PURE__ */ React.createElement(
672
- Modal,
673
+ BottomSheet,
673
674
  {
674
- animationType: "slide",
675
- transparent: true,
676
- visible: isModalVisible,
677
- onRequestClose: toggleModal
675
+ ref: bottomSheetRef,
676
+ index: isModalVisible ? 0 : -1,
677
+ snapPoints: ["50%", "100%"],
678
+ onChange: handleSheetChanges,
679
+ enablePanDownToClose: true,
680
+ style: [styles$z.mainContainer, style]
678
681
  },
679
- /* @__PURE__ */ React.createElement(PanGestureHandler, { onGestureEvent: onSwipDown }, /* @__PURE__ */ React.createElement(
680
- KeyboardAvoidingView,
682
+ /* @__PURE__ */ React.createElement(View, { style: [styles$z.mainContainer, style], testID }, showBlurView ? /* @__PURE__ */ React.createElement(
683
+ BlurView,
681
684
  {
682
- behavior: Platform.OS === "ios" ? "padding" : "height",
683
- style: { flex: 1 }
684
- },
685
- /* @__PURE__ */ React.createElement(View, { style: [styles$z.mainContainer, style], testID }, showBlurView ? /* @__PURE__ */ React.createElement(
686
- BlurView,
687
- {
688
- style: [styles$z.blurView, blurViewStyle],
689
- blurType,
690
- blurAmount
691
- }
692
- ) : null, /* @__PURE__ */ React.createElement(View, { style: [styles$z.modalContainer, modalContainerStyle] }, showHeader && /* @__PURE__ */ React.createElement(React.Fragment, null, showSeparator && /* @__PURE__ */ React.createElement(View, { style: styles$z.separator }), /* @__PURE__ */ React.createElement(View, { style: styles$z.headerContainer }, showLeftIcon && leftIcon ? React.cloneElement(leftIcon, {
693
- width: moderateScale(24),
694
- height: moderateScale(24),
695
- style: styles$z.leftIconStyle,
696
- onPress: onLeftIconPress
697
- }) : null, /* @__PURE__ */ React.createElement(
698
- CustomTypography,
699
- {
700
- variant: titleVariant,
701
- text: title,
702
- style: { ...styles$z.title, ...titleStyle }
703
- }
704
- ), showRightIcon && rightIcon ? React.cloneElement(rightIcon, {
705
- width: moderateScale(24),
706
- height: moderateScale(24),
707
- style: styles$z.rightIconStyle,
708
- onPress: toggleModal
709
- }) : null)), children))
710
- ))
685
+ style: [styles$z.blurView, blurViewStyle],
686
+ blurType,
687
+ blurAmount
688
+ }
689
+ ) : null, /* @__PURE__ */ React.createElement(View, { style: [styles$z.modalContainer, modalContainerStyle] }, showHeader && /* @__PURE__ */ React.createElement(React.Fragment, null, showSeparator && /* @__PURE__ */ React.createElement(View, { style: styles$z.separator }), /* @__PURE__ */ React.createElement(View, { style: styles$z.headerContainer }, showLeftIcon && leftIcon ? React.cloneElement(leftIcon, {
690
+ width: moderateScale(24),
691
+ height: moderateScale(24),
692
+ style: styles$z.leftIconStyle,
693
+ onPress: onLeftIconPress
694
+ }) : null, /* @__PURE__ */ React.createElement(
695
+ CustomTypography,
696
+ {
697
+ variant: titleVariant,
698
+ text: title,
699
+ style: { ...styles$z.title, ...titleStyle }
700
+ }
701
+ ), showRightIcon && rightIcon ? React.cloneElement(rightIcon, {
702
+ width: moderateScale(24),
703
+ height: moderateScale(24),
704
+ style: styles$z.rightIconStyle,
705
+ onPress: toggleModal
706
+ }) : null)), children))
711
707
  );
712
708
  };
713
709