dhre-ui-kit 0.0.25 → 0.0.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -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
  )}