dhre-ui-kit 0.0.36 → 0.0.37

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.
@@ -19,3 +19,6 @@ jest.mock('react-native-webview', () => {
19
19
  jest.mock('react-redux', () => ({
20
20
  useSelector: jest.fn(),
21
21
  }));
22
+ jest.mock('react-native-gesture-handler', () => ({
23
+ PanGestureHandler: jest.fn(({children}) => children),
24
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -11,6 +11,7 @@ export interface BottomDrawerProps {
11
11
  modalContainerStyle?: ViewStyle;
12
12
  blurAmount?: number;
13
13
  blurViewStyle?: ViewStyle;
14
+ showBlurView?: boolean;
14
15
  leftIcon?: React.ReactElement;
15
16
  rightIcon?: React.ReactElement;
16
17
  showLeftIcon?: boolean;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import {View, Modal} from 'react-native';
3
+ import {PanGestureHandler} from 'react-native-gesture-handler';
3
4
  import {BlurView} from '@react-native-community/blur';
4
5
  import {BottomDrawerProps} from './BottomDrawer.interface';
5
6
  import styles from './BottomDrawer.styles';
@@ -17,6 +18,7 @@ const BottomDrawer: React.FC<BottomDrawerProps> = ({
17
18
  modalContainerStyle,
18
19
  blurAmount = 10,
19
20
  blurViewStyle,
21
+ showBlurView = true,
20
22
  showLeftIcon = false,
21
23
  showRightIcon = true,
22
24
  leftIcon = <ArrowLeft />,
@@ -25,44 +27,55 @@ const BottomDrawer: React.FC<BottomDrawerProps> = ({
25
27
  titleStyle,
26
28
  titleVariant = 'B2_REGULAR',
27
29
  }) => {
30
+ const onSwipDown = (event: {nativeEvent: {translationY: number}}) => {
31
+ const {translationY} = event.nativeEvent;
32
+ if (translationY > 50) {
33
+ toggleModal();
34
+ }
35
+ };
36
+
28
37
  return (
29
38
  <Modal
30
39
  animationType="slide"
31
40
  transparent={true}
32
41
  visible={isModalVisible}
33
42
  onRequestClose={toggleModal}>
34
- <View style={[styles.mainContainer, style]} testID={testID}>
35
- <BlurView
36
- style={[styles.blurView, blurViewStyle]}
37
- blurType="light"
38
- blurAmount={blurAmount}
39
- />
40
- <View style={[styles.modalContainer, modalContainerStyle]}>
41
- <View style={styles.separator} />
42
- <View style={styles.headerContainer}>
43
- {showLeftIcon &&
44
- React.cloneElement(leftIcon, {
45
- width: moderateScale(24),
46
- height: moderateScale(24),
47
- style: styles.leftIconStyle,
48
- onPress: onLeftIconPress,
49
- })}
50
- <CustomTypography
51
- variant={titleVariant}
52
- text={title}
53
- style={{...styles.title, ...titleStyle}}
43
+ <PanGestureHandler onGestureEvent={onSwipDown}>
44
+ <View style={[styles.mainContainer, style]} testID={testID}>
45
+ {showBlurView ? (
46
+ <BlurView
47
+ style={[styles.blurView, blurViewStyle]}
48
+ blurType="light"
49
+ blurAmount={blurAmount}
54
50
  />
55
- {showRightIcon &&
56
- React.cloneElement(rightIcon, {
57
- width: moderateScale(24),
58
- height: moderateScale(24),
59
- style: styles.rightIconStyle,
60
- onPress: toggleModal,
61
- })}
51
+ ) : null}
52
+ <View style={[styles.modalContainer, modalContainerStyle]}>
53
+ <View style={styles.separator} />
54
+ <View style={styles.headerContainer}>
55
+ {showLeftIcon &&
56
+ React.cloneElement(leftIcon, {
57
+ width: moderateScale(24),
58
+ height: moderateScale(24),
59
+ style: styles.leftIconStyle,
60
+ onPress: onLeftIconPress,
61
+ })}
62
+ <CustomTypography
63
+ variant={titleVariant}
64
+ text={title}
65
+ style={{...styles.title, ...titleStyle}}
66
+ />
67
+ {showRightIcon &&
68
+ React.cloneElement(rightIcon, {
69
+ width: moderateScale(24),
70
+ height: moderateScale(24),
71
+ style: styles.rightIconStyle,
72
+ onPress: toggleModal,
73
+ })}
74
+ </View>
75
+ {children}
62
76
  </View>
63
- {children}
64
77
  </View>
65
- </View>
78
+ </PanGestureHandler>
66
79
  </Modal>
67
80
  );
68
81
  };
@@ -29,10 +29,7 @@ const Checkbox: React.FC<CheckBoxProps> = ({
29
29
  testID={'Checkbox-Press'}
30
30
  onPress={handlePress}
31
31
  disabled={disable}
32
- style={({pressed}) => [
33
- styles.directionStyle,
34
- {opacity: pressed ? 0.5 : 1},
35
- ]}>
32
+ style={styles.directionStyle}>
36
33
  <View style={styles.checkboxContainer}>
37
34
  {React.cloneElement(checked ? checkedIcon : uncheckedIcon)}
38
35
  </View>