dhre-ui-kit 0.0.24 → 0.0.26

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.
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import {CustomTextProps} from '../src/components/customText/CustomText';
3
+ import CustomTypography from '../src/components/customTypography/CustomTypography';
4
+
5
+ // const mockProps: CustomTextProps = {
6
+ // text: 'string',
7
+ // variant: 'string',
8
+ // };
9
+
10
+ // const CustomText = jest.requireActual(
11
+ // 'dhre-ui-kit/src/components/customText/CustomText.tsx',
12
+ // );
13
+
14
+ export default {
15
+ CustomText: (mockProps: CustomTextProps) => {
16
+ const {text, variant} = mockProps;
17
+ return <CustomTypography variant={variant} text={text || ''} />;
18
+ },
19
+ };
@@ -0,0 +1,21 @@
1
+ jest.mock('rn-tooltip', () => {
2
+ return jest.fn(({children}) => children);
3
+ });
4
+
5
+ jest.mock('react-native-otp-verify', () => ({
6
+ getOtp: jest.fn(),
7
+ getHash: jest.fn(),
8
+ addListener: jest.fn(),
9
+ removeListener: jest.fn(),
10
+ }));
11
+
12
+ jest.mock('react-native-pdf', () => 'Pdf');
13
+
14
+ jest.mock('react-native-webview', () => {
15
+ return jest.fn().mockImplementation(() => {
16
+ return null;
17
+ });
18
+ });
19
+ jest.mock('react-redux', () => ({
20
+ useSelector: jest.fn(),
21
+ }));
@@ -0,0 +1,2 @@
1
+ module.exports = 'SvgMock';
2
+ module.exports.ReactComponent = 'SvgMock';
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
7
- "README.md"
7
+ "README.md",
8
+ "__mocks__"
8
9
  ],
9
10
  "scripts": {
10
11
  "android": "react-native run-android",
@@ -1,9 +1,14 @@
1
- import {TextInputProps, ViewStyle} from 'react-native';
1
+ import {TextInputProps, TextStyle, ViewStyle} from 'react-native';
2
2
 
3
3
  export interface CustomSearchBarProps extends TextInputProps {
4
4
  height?: number;
5
- testID?: string;
6
5
  disabled?: boolean;
6
+ testID?: string;
7
7
  inputContainerStyle?: ViewStyle;
8
+ searchIconStyle?: TextStyle;
9
+ crossIconStyle?: TextStyle;
10
+ inputStyle?: TextStyle;
11
+ onSearchIconPress?: () => void;
12
+ onCrossIconPress?: () => void;
8
13
  handleOnChangeText?: (text: string) => void;
9
14
  }
@@ -10,10 +10,16 @@ const CustomSearchBar = ({
10
10
  disabled = false,
11
11
  testID = 'CUSTOM-SEARCH-BAR',
12
12
  inputContainerStyle,
13
+ searchIconStyle,
14
+ crossIconStyle,
15
+ inputStyle,
16
+ onSearchIconPress,
17
+ onCrossIconPress,
13
18
  handleOnChangeText,
14
19
  ...props
15
20
  }: CustomSearchBarProps) => {
16
21
  const [value, setValue] = useState('');
22
+
17
23
  return (
18
24
  <View
19
25
  testID={testID}
@@ -25,15 +31,22 @@ const CustomSearchBar = ({
25
31
  },
26
32
  inputContainerStyle,
27
33
  ]}>
28
- {React.cloneElement(<SearchIcon />, {
29
- width: moderateScale(24),
30
- height: moderateScale(24),
31
- style: styles.searchIconStyle,
32
- })}
34
+ <Pressable
35
+ onPress={() => {
36
+ console.log('Search icon pressed'); // Default behavior
37
+ onSearchIconPress?.(); // Call custom handler if provided
38
+ }}
39
+ style={searchIconStyle}>
40
+ {React.cloneElement(<SearchIcon />, {
41
+ width: moderateScale(24),
42
+ height: moderateScale(24),
43
+ style: [styles.searchIconStyle, searchIconStyle],
44
+ })}
45
+ </Pressable>
33
46
  <TextInput
34
47
  {...props}
35
48
  testID={`${testID}-INPUT`}
36
- style={styles.input}
49
+ style={[styles.input, inputStyle]} // Apply custom input styles
37
50
  editable={!disabled}
38
51
  value={value}
39
52
  placeholderTextColor={disabled ? '#686868' : '#A7A7A7'}
@@ -43,11 +56,16 @@ const CustomSearchBar = ({
43
56
  }}
44
57
  />
45
58
  {value && (
46
- <Pressable onPress={() => setValue('')}>
59
+ <Pressable
60
+ onPress={() => {
61
+ setValue(''); // Clear the input field
62
+ onCrossIconPress?.(); // Call custom handler if provided
63
+ }}
64
+ style={crossIconStyle}>
47
65
  {React.cloneElement(<CrossIcon />, {
48
66
  width: moderateScale(24),
49
67
  height: moderateScale(24),
50
- style: styles.crossIconStyle,
68
+ style: [styles.crossIconStyle, crossIconStyle],
51
69
  })}
52
70
  </Pressable>
53
71
  )}
package/src/index.ts CHANGED
@@ -41,3 +41,5 @@ export {
41
41
  } from './utils/stylehelper';
42
42
 
43
43
  export {default} from './theme/themes';
44
+
45
+ export {default as CustomTextTest} from '../__mocks__/custom-text.mock';