dhre-ui-kit 0.0.35 → 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.35",
3
+ "version": "0.0.37",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -11,10 +11,12 @@ 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;
17
18
  showRightIcon?: boolean;
18
19
  onLeftIconPress?: () => void;
19
20
  titleStyle?: TextStyle;
21
+ titleVariant?: string;
20
22
  }
@@ -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,51 +18,64 @@ 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 />,
23
25
  rightIcon = <CrossIcon />,
24
26
  onLeftIconPress,
25
27
  titleStyle,
28
+ titleVariant = 'B2_REGULAR',
26
29
  }) => {
30
+ const onSwipDown = (event: {nativeEvent: {translationY: number}}) => {
31
+ const {translationY} = event.nativeEvent;
32
+ if (translationY > 50) {
33
+ toggleModal();
34
+ }
35
+ };
36
+
27
37
  return (
28
38
  <Modal
29
39
  animationType="slide"
30
40
  transparent={true}
31
41
  visible={isModalVisible}
32
42
  onRequestClose={toggleModal}>
33
- <View style={[styles.mainContainer, style]} testID={testID}>
34
- <BlurView
35
- style={[styles.blurView, blurViewStyle]}
36
- blurType="light"
37
- blurAmount={blurAmount}
38
- />
39
- <View style={[styles.modalContainer, modalContainerStyle]}>
40
- <View style={styles.separator} />
41
- <View style={styles.headerContainer}>
42
- {showLeftIcon &&
43
- React.cloneElement(leftIcon, {
44
- width: moderateScale(24),
45
- height: moderateScale(24),
46
- style: styles.leftIconStyle,
47
- onPress: onLeftIconPress,
48
- })}
49
- <CustomTypography
50
- variant="B2_REGULAR"
51
- text={title}
52
- 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}
53
50
  />
54
- {showRightIcon &&
55
- React.cloneElement(rightIcon, {
56
- width: moderateScale(24),
57
- height: moderateScale(24),
58
- style: styles.rightIconStyle,
59
- onPress: toggleModal,
60
- })}
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}
61
76
  </View>
62
- {children}
63
77
  </View>
64
- </View>
78
+ </PanGestureHandler>
65
79
  </Modal>
66
80
  );
67
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>