Skip to content

Commit c9edc4a

Browse files
authored
Picker migrate Dialog (#2657)
* Picker migrate Dialog * exported close expandable function * removed dialogProps prop from types file * added bak the native picker example
1 parent eb77e3c commit c9edc4a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/components/picker/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const Picker = React.forwardRef((props: PickerProps, ref) => {
8888
// TODO: Remove migrate props and migrate code
8989
migrate = true,
9090
migrateTextField = true,
91+
migrateDialog,
9192
accessibilityLabel,
9293
accessibilityHint,
9394
items: propItems,
@@ -194,10 +195,15 @@ const Picker = React.forwardRef((props: PickerProps, ref) => {
194195
}
195196
}, [fieldType, preset, themeProps.trailingAccessory]);
196197

197-
const _renderCustomModal: ExpandableOverlayProps['renderCustomOverlay'] = ({visible, toggleExpandable}) => {
198+
const _renderCustomModal: ExpandableOverlayProps['renderCustomOverlay'] = ({
199+
visible,
200+
closeExpandable,
201+
toggleExpandable
202+
}) => {
198203
if (renderCustomModal) {
199204
const modalProps = {
200205
visible,
206+
closeModal: closeExpandable,
201207
toggleModal: toggleExpandable,
202208
onSearchChange: _onSearchChange,
203209
children,
@@ -285,6 +291,7 @@ const Picker = React.forwardRef((props: PickerProps, ref) => {
285291
useDialog={useWheelPicker}
286292
modalProps={modalProps}
287293
dialogProps={DIALOG_PROPS}
294+
migrateDialog={migrateDialog}
288295
expandableContent={expandableModalContent}
289296
renderCustomOverlay={renderCustomModal ? _renderCustomModal : undefined}
290297
onPress={onPress}

src/components/picker/types.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export type PickerBaseProps = Omit<NewTextFieldProps, 'value' | 'onChange'> &
5858
* Temporary prop required for inner text field migration
5959
*/
6060
migrateTextField?: boolean;
61+
/**
62+
* Migrate the Dialog to DialogNew (make sure you use only new props in dialogProps)
63+
*/
64+
migrateDialog?: boolean;
6165
/**
6266
* Pass for different field type UI (form, filter or settings)
6367
*/

0 commit comments

Comments
 (0)