dhre-ui-kit 0.0.50 → 0.0.51
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 +1 -1
- package/src/components/accordion/Accordion.interface.ts +4 -1
- package/src/components/accordion/Accordion.tsx +5 -1
- package/src/components/customSearchBar/CustomSearchBar.interface.ts +2 -0
- package/src/components/customSearchBar/CustomSearchBar.test.tsx +9 -1
- package/src/components/customSearchBar/CustomSearchBar.tsx +3 -3
package/package.json
CHANGED
|
@@ -6,6 +6,9 @@ export interface AccordionProps {
|
|
|
6
6
|
testId?: string;
|
|
7
7
|
containerStyle?: ViewStyle;
|
|
8
8
|
titleStyle?: TextStyle;
|
|
9
|
-
children: React.ReactNode;
|
|
10
9
|
headerStyle?: ViewStyle;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
onToggle: () => void;
|
|
13
|
+
optionalElement?: () => React.ReactNode; // Update this line
|
|
11
14
|
}
|
|
@@ -15,7 +15,8 @@ const Accordion = ({
|
|
|
15
15
|
children,
|
|
16
16
|
isOpen,
|
|
17
17
|
onToggle,
|
|
18
|
-
|
|
18
|
+
optionalElement, // Destructure the new prop
|
|
19
|
+
}: AccordionProps) => {
|
|
19
20
|
const contentRef = useRef<View>(null);
|
|
20
21
|
const [animation] = useState(new Animated.Value(0));
|
|
21
22
|
const [contentHeight, setContentHeight] = useState(0);
|
|
@@ -55,6 +56,9 @@ const Accordion = ({
|
|
|
55
56
|
style: styles.iconStyle,
|
|
56
57
|
})}
|
|
57
58
|
</Pressable>
|
|
59
|
+
|
|
60
|
+
{optionalElement ? optionalElement() : null}
|
|
61
|
+
|
|
58
62
|
<Animated.View style={[styles.content, {height: cardHeight}]}>
|
|
59
63
|
<View
|
|
60
64
|
ref={contentRef}
|
|
@@ -11,7 +11,15 @@ const mockProps = {
|
|
|
11
11
|
|
|
12
12
|
describe('Custom search bar component', () => {
|
|
13
13
|
it('Component renders correctly', () => {
|
|
14
|
-
const {getByTestId} = render(
|
|
14
|
+
const {getByTestId} = render(
|
|
15
|
+
<CustomSearchBar
|
|
16
|
+
setValue={(val: string) => {
|
|
17
|
+
return val;
|
|
18
|
+
}}
|
|
19
|
+
value={''}
|
|
20
|
+
{...mockProps}
|
|
21
|
+
/>,
|
|
22
|
+
);
|
|
15
23
|
expect(getByTestId(mockProps.testID)).toBeTruthy();
|
|
16
24
|
const textInput = getByTestId('CUSTOM-SEARCH-BAR-INPUT');
|
|
17
25
|
fireEvent.changeText(textInput, 'test@example.com');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {Pressable, TextInput, View} from 'react-native';
|
|
3
3
|
import {CrossIcon, SearchIcon} from '../../assets';
|
|
4
4
|
import {moderateScale, verticalScale} from '../../utils/stylehelper';
|
|
@@ -6,6 +6,7 @@ import {CustomSearchBarProps} from './CustomSearchBar.interface';
|
|
|
6
6
|
import styles from './CustomSearchBar.styles';
|
|
7
7
|
|
|
8
8
|
const CustomSearchBar = ({
|
|
9
|
+
value,
|
|
9
10
|
height = 40,
|
|
10
11
|
disabled = false,
|
|
11
12
|
testID = 'CUSTOM-SEARCH-BAR',
|
|
@@ -16,6 +17,7 @@ const CustomSearchBar = ({
|
|
|
16
17
|
onSearchIconPress,
|
|
17
18
|
onCrossIconPress,
|
|
18
19
|
handleOnChangeText,
|
|
20
|
+
setValue,
|
|
19
21
|
rightIcon = <CrossIcon />,
|
|
20
22
|
disableBorderColor = '#4F4F4F',
|
|
21
23
|
borderColor = '#FFFFFF',
|
|
@@ -23,8 +25,6 @@ const CustomSearchBar = ({
|
|
|
23
25
|
enablePlaceHolderStyle = '#A7A7A7',
|
|
24
26
|
...props
|
|
25
27
|
}: CustomSearchBarProps) => {
|
|
26
|
-
const [value, setValue] = useState('');
|
|
27
|
-
|
|
28
28
|
return (
|
|
29
29
|
<View
|
|
30
30
|
testID={testID}
|