Skip to content

Commit 5f54bbb

Browse files
adids1221nitzanyiz
andauthored
Picker - enhance modalProps merging in useNewPickerProps (#3719)
* Picker enhance modalProps merging in useNewPickerProps for improved customization * Update src/components/picker/helpers/useNewPickerProps.tsx Co-authored-by: Nitzan Yizhar <[email protected]> --------- Co-authored-by: Nitzan Yizhar <[email protected]>
1 parent 70e4c92 commit 5f54bbb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/picker/helpers/useNewPickerProps.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,28 @@ const useNewPickerProps = (props: PickerProps) => {
1717
renderOverlay
1818
} = props;
1919

20-
const modalProps: ExpandableOverlayProps['modalProps'] = {
20+
const defaultModalProps = {
2121
animationType: 'slide',
2222
transparent: Constants.isIOS && enableModalBlur,
2323
enableModalBlur: Constants.isIOS && enableModalBlur,
2424
onRequestClose: topBarProps?.onCancel
25+
} satisfies ExpandableOverlayProps['modalProps'];
26+
27+
const mergedModalProps = {
28+
...defaultModalProps,
29+
...(onShow && {onShow}),
30+
...pickerModalProps,
31+
...customPickerProps?.modalProps
2532
};
2633

2734
const newProps: PickerProps = {
2835
renderHeader: renderCustomDialogHeader || renderHeader,
2936
renderInput: renderPicker || renderInput,
3037
renderOverlay: renderCustomModal || renderOverlay,
31-
customPickerProps: {modalProps: {onShow, ...modalProps, ...pickerModalProps}, ...customPickerProps}
38+
customPickerProps: {
39+
...customPickerProps,
40+
modalProps: mergedModalProps
41+
}
3242
};
3343
return newProps;
3444
};

0 commit comments

Comments
 (0)